Skip to content

chore(ci): run dependency:analyze in its own parallel job#24044

Merged
stian-sandvold merged 1 commit into
masterfrom
ci/dependency-analyze-own-job
Jun 1, 2026
Merged

chore(ci): run dependency:analyze in its own parallel job#24044
stian-sandvold merged 1 commit into
masterfrom
ci/dependency-analyze-own-job

Conversation

@stian-sandvold
Copy link
Copy Markdown
Contributor

Why

The unit-test job runs two Maven invocations back to back:

- name: Run unit tests
  run: mvn clean test ... --activate-profiles unit-test
- name: Run dependency analysis
  run: mvn dependency:analyze --file ./dhis-2/pom.xml

dependency:analyze (the standalone goal) forks its own build up to test-compile. So that second step quietly recompiles the entire reactor a second time, inside the unit-test job, just to run a dependency check that has nothing to do with unit tests. On recent runs that step costs ~1m35s.

What this does

  • Removes the dependency:analyze step from unit-test.
  • Adds a dedicated dependency-analysis job that runs mvn dependency:analyze on its own runner, in parallel with the test jobs.
  • Adds the new job to the Slack-on-failure notification's needs list so a failure on master is still reported.

The check still runs on every PR and push, with the same fail-on-warning behaviour (<failOnWarning>true</failOnWarning> is configured on the plugin in dhis-2/pom.xml, including the same ignoredUnusedDeclaredDependencies allowlist) — it just no longer sits on the unit-test critical path.

Effect

  • unit-test drops ~1m35s and the confusing hidden recompile.
  • The dependency check moves off to a parallel job. The integration jobs gate the overall workflow, so a ~3–4 min analysis job runs for free on wall-clock.

Note: this does not change the overall workflow wall-clock (the integration jobs are the critical path, not unit-test) — it's a cleanup that speeds up the unit-test check itself and removes a hidden second compile.

For a maintainer to check

If dependency:analyze (previously surfaced under the unit-test check) was a required status check in branch protection, the new dependency-analysis check name needs to be added there so it stays required.

🤖 Generated with Claude Code

The unit-test job ran 'mvn dependency:analyze' as a second step after the unit
tests. That goal forks its own build up to test-compile, so it recompiled the
whole reactor a second time inside unit-test (~1m35s) for a check that has
nothing to do with unit tests.

Move it into its own 'dependency-analysis' job that runs in parallel on its own
runner, off the critical path. The dependency check still runs on every PR and
push with the same fail-on-warning behaviour (configured in dhis-2/pom.xml), and
the unit-test job no longer pays for the extra recompile.

The new job is added to the Slack-on-failure notification's needs so a failure
on master is still reported.
@stian-sandvold stian-sandvold marked this pull request as ready for review May 31, 2026 06:47
@stian-sandvold stian-sandvold requested a review from a team as a code owner May 31, 2026 06:47
@sonarqubecloud
Copy link
Copy Markdown

@enricocolasante
Copy link
Copy Markdown
Contributor

Effect

  • unit-test drops ~1m35s and the confusing hidden recompile.
  • The dependency check moves off to a parallel job. The integration jobs gate the overall workflow, so a ~3–4 min analysis job runs for free on wall-clock.

The analysis job is faster than 3~4 minutes, right? Because it is true that it will run in parallel so the overall time do not change, but if we add a new job with that big overhead, it could be a shot in the feet when there are multiple PRs running.

Copy link
Copy Markdown
Contributor

@enricocolasante enricocolasante left a comment

Choose a reason for hiding this comment

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

Are you going to make dependency-analysis job required after the PR is merged?

@stian-sandvold
Copy link
Copy Markdown
Contributor Author

Yeah, I'll make it required after!

@stian-sandvold stian-sandvold merged commit ebeec7b into master Jun 1, 2026
23 checks passed
@stian-sandvold stian-sandvold deleted the ci/dependency-analyze-own-job branch June 1, 2026 13:42
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.

3 participants