ci: scope pull-request analysis and avoid redundant compilation - #1484
Draft
joaodinissf wants to merge 4 commits into
Draft
joaodinissf wants to merge 4 commits into
joaodinissf wants to merge 4 commits into
Conversation
joaodinissf
force-pushed
the
ci/spotbugs-skip
branch
from
September 22, 2026 22:40
8ec1682 to
37e4b7d
Compare
This was referenced Sep 22, 2026
SpotBugs' per-module analysis is the spotbugs job's long pole. A PR only needs its changed modules scanned, so a pre-step injects <spotbugs.skip>true> into every unchanged reactor module's pom — the plugin then skips the goal, and the per-module JVM fork, for them. The full-reactor compile is kept (a changed module keeps its complete aux-classpath); a build/config change falls back to a full scan. pull_request only — master/snapshot run a full scan. -Dspotbugs.onlyAnalyze was the cleaner-looking alternative but screens too late (after the per-module fork), ~17% vs ~88% measured; the script header documents the migration if an upstream SpotBugs early-exit ever lands. - .github/scripts/compute-spotbugs-skip.sh: diff -> changed modules -> inject skip into the unchanged ones (idempotent; build/config change -> full scan). - verify.yml spotbugs job: fetch-depth 0 + a scope step before compile; -Djgit.dirtyWorkingTree=ignore because the scope step dirties poms on purpose and this job releases nothing (releases/maven-verify keep =error); SARIF upload guarded so an empty scan set (no module scanned) doesn't fail the upload. Validate and merge only expected SpotBugs reports. When the scope contains no analysable modules, both merging and gating succeed without reports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Export SPOTBUGS_SCOPE_ARGS with the changed modules and -am so the lane compiles only those modules and their upstream dependencies. Unchanged dependencies retain spotbugs.skip and provide the analysis classpath without being analysed themselves. Include ddk-target explicitly because the target definition is not a MANIFEST dependency that -am can discover. Shared build/config changes retain a full reactor and scan. Export the full expected-report list and an explicit scope state on that path. With no analysable changed modules, skip Maven and accept no reports in the merge and gate. Otherwise preserve shared validation for every expected report, including failed analysis and invalid input, before counting findings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CPD tokenizes sources under src/ and needs neither bytecode nor a resolved target platform, so the second lint invocation drops its compile goals. cpd.xml outputs are identical with and without the compile pass, verified at the current token threshold and at the PMD default of 100 (timestamp attributes aside). Measured locally (warm tree, JDK 21): 6.8s vs 44.3s at the current threshold; 4.5s vs 28.5s at threshold 100. In CI the invocation was 53s, ~40s of it redundant recompilation and JVM startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generalize compute-spotbugs-skip.sh to compute-analysis-skip.sh with a mode argument. The lint mode injects pmd.skip, cpd.skip and checkstyle.skip into unchanged modules and exports the expected reports and -pl/-am scope. SpotBugs keeps its existing scoping behavior through the same script. Compile the changed modules and their dependencies before PMD/Checkstyle so type resolution has the complete classpath. Run CPD separately without compilation. Shared build/config changes trigger a full scan in both lanes. Skip the report goals, merging and gating when the scope contains no analysable modules. Otherwise retain the common validation of every expected SARIF report, URI bases and rule descriptors. Count CPD duplications from the expected reports, including a single-module scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joaodinissf
force-pushed
the
ci/spotbugs-skip
branch
from
September 26, 2026 12:03
37e4b7d to
6fe8869
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #1483 · supersedes #1485, #1486 and #1400
Why the change
Pull-request analysis now covers only the modules a change touches, and CPD no longer compiles, which shortens the lint and SpotBugs lanes while master keeps the full scan.
Special things to note
Change outline
How the scope is chosen, in
.github/scripts/compute-analysis-skip.sh:The four commits keep the steps apart for review: SpotBugs skip selection, scoped compilation, CPD without compile, and lint scoping.
🤖 Generated with Claude Code