ci: don't download webapps when only running tests #18801
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These are the maven lifecycles which we can execute. We can also bind
maven plugins (or some of their commands aka goals) to a phase, some are bound to a phase by default.
We for example bundled the webapps in
generate-resources
(which was used before by the frontend plugin we recently removed) as there was a race condition with packaging thedhis.war
when I bound it to thepackage
phase. This meant that wegit clone
d webapps when running tests. I found that theprepare-package
phase works and means we do not waste time cloning if we just want to run our tests.I changed our GitHub CI test jobs to only run up to
test
as we do not want to package the war in every unit and integration test job. Thedhis.war
is packaged in the run-api-tests.yml. You can see that I had to bind the coverage plugin totest
as it runs inverify
by default.Maven Plugins
Jacoco plugin
We use the Jacoco Plugin to generate coverage reports for codecov.io.
jacoco:report-aggregate is bound to
verify
by default.Move it earlier to
test
as shown by codecovhttps://github.com/codecov/example-java-maven/blob/5b913c6d90c7a83520cf082c4053f5422cd1e9db/pom.xml#L39-L45
Maven Enforcer Plugin
We use the Maven enforcer to ensure we import the correct library if there are multiple choices with the same name, ...
We don't bind it to a different phase
dhis2-core/dhis-2/pom.xml
Lines 2254 to 2259 in fd4619f
so its default applies which is
validate
.Maven Dependency Plugin
We use the Maven dependency plugin to ensure our builds are more reproducible. It forces us to declare used dependencies instead of relying on a dependency coming in transitively.
We did bind the plugin to the lifecycle phase
process-test-classes
so such problems show up early.dhis2-core/dhis-2/pom.xml
Lines 2358 to 2363 in fd4619f
This annoyed devs as multiple test jobs would then fail for the same reason. So we now rely on its default binding to the lifecycle phase
verify
. Note that we therefore executeverify
in the.github/workflows/run-api-tests.yml
so this plugin gets executed when the war is built for the e2e tests.