Skip to content

Save screenshots to Maven build output directory#3819

Open
basilevs wants to merge 1 commit into
eclipse-platform:masterfrom
basilevs:surefire_screenshot
Open

Save screenshots to Maven build output directory#3819
basilevs wants to merge 1 commit into
eclipse-platform:masterfrom
basilevs:surefire_screenshot

Conversation

@basilevs
Copy link
Copy Markdown
Contributor

@basilevs basilevs commented May 13, 2026

Partial fix for eclipse-platform/eclipse.platform.swt#3303.

SWT does not use Platform, so existing heuristics do not work in GitHub Actions.

Once this more sensible screenshot location is set, SWT GHA workflows can be updated to archive screenshots to artifacts. Before the change they have been thrown away and could not be inspected.

@basilevs basilevs force-pushed the surefire_screenshot branch from 0b25779 to c5aabc8 Compare May 13, 2026 22:21
@basilevs
Copy link
Copy Markdown
Contributor Author

@merks @HeikoKlare could you suggest a better heuristic or another way to work with CI screenshots in SWT?

@merks
Copy link
Copy Markdown
Contributor

merks commented May 14, 2026

I have no knowledge in this area. Maybe @HannesWell has a good idea.

@HeikoKlare
Copy link
Copy Markdown
Contributor

It sounds reasonable to have a properly defined place for storing the screenshots so that they can be archived during GHA runs. I remember that I did some tweaks when analyzing an issue only occurring in GHA runs for which I required screenshots. So having a general solution for this would be great. Thank you for putting effort into this.

I wonder if we couldn't just define a proper value for the existing system property junitReportOutput in the Maven build. Doing that in the parent might only require it to be properly defined/parameterized once.
In case we only want a specific folder to be used in GHA runs, as we align the GHA workflow configuration with specific code for defining the output folder, we may also simply guard this behavior with the GHA context, like we do in some utilities such as: https://github.com/eclipse-platform/eclipse.platform.swt/blob/f33b79ee65f5cedfa8f7ac4e1bf93994a904a445/tests/org.eclipse.swt.tests/JUnit%20Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java#L121-L123

Regarind the proposed change: Unless the Eclipse platform is present and the system property for the output folder is specified, the results will now always be written into the surefire target repository (if existing). Is that what we want to happen? For example, when executing the tests locally in the IDE, do we want to have the screenshots placed in a Maven-build-specific folder? In case I have execute a local Maven build at some earlier point in time, that folder will be present and used.

Maybe @akurtakov can also help here, as he guarded the screenshot output folder extraction with the Platform being present recently:

@basilevs
Copy link
Copy Markdown
Contributor Author

existing system property junitReportOutput

Is not it an application argument and not a system property?

@HeikoKlare
Copy link
Copy Markdown
Contributor

Is not it an application argument and not a system property?

You're right. Then we maybe want to check for a GHA environment and then define a dedicated folder that is also used for artifact upload?

@basilevs basilevs force-pushed the surefire_screenshot branch from c5aabc8 to c9bbda8 Compare May 14, 2026 11:19
@basilevs
Copy link
Copy Markdown
Contributor Author

basilevs commented May 14, 2026

@HeikoKlare

You're right. Then we maybe want to check for a GHA environment and then define a dedicated folder that is also used for artifact upload?

The decision should be based on whether Maven is in use, not on which environment it is running on.
I've added a dedicated property and a suitable default via parent pom in the latest revision. Is it better?

As some projects reuse aggregator's workflow, and most use it's parent POM, the maintenance effort per-project should be minimal.

@basilevs basilevs changed the title Save screenshot to Surefire directory if any Save screenshots to Maven build output directory May 14, 2026
Copy link
Copy Markdown
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I think this is fine.
Do you know if the screenshots are also saved for I-build tests and if some according adaption is needed then? I'm not aware of it, but might have missed it.

Comment thread eclipse-platform-parent/pom.xml Outdated
<printApiMessages>false</printApiMessages>
<failOnJavadocErrors>false</failOnJavadocErrors>
<compileLogDir>${project.build.directory}/compilelogs</compileLogDir>
<eclipse.screenshot_directory>${project.build.directory}/screenshots</eclipse.screenshot_directory>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the property be better named surefire.screenshot_directory (and be placed next to the other surefire related properties)?

Suggested change
<eclipse.screenshot_directory>${project.build.directory}/screenshots</eclipse.screenshot_directory>
<surefire.screenshot_directory>${project.build.directory}/screenshots</surefire.screenshot_directory>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JVM system property is naturally usable outside of surefire. For example, it could be configured via launch configuration. This makes naming it surefire specific confusing.

Maven property was named to exactly match the JVM system property to help with identification and search.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied anyway.

@basilevs
Copy link
Copy Markdown
Contributor Author

basilevs commented May 14, 2026

Do you know if the screenshots are also saved for I-build tests

I did fix screenshots for platform.ui a few years back. Those relied on Platform to be present. I'm not sure if that fix applies to I-build.

eclipse-platform/eclipse.platform.swt#3303

As screenshots are effectively a build artifact, save them in build
output directory (target/ by default).

SWT does not use Platform, so existing heuristics have not worked in
GitHub Actions, abandoning screenshots in /tmp without archiving into
artifacts.

The change breaks existing Gerrit jobs, but as Gerrit is no longer used,
this should be fine.
@basilevs basilevs force-pushed the surefire_screenshot branch from c9bbda8 to 1e5e3cc Compare May 14, 2026 17:50
@basilevs basilevs requested a review from HannesWell May 15, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants