You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci: add Scalpel shadow comparison for skip-tests mode validation
Add a shadow comparison section to CI PR comments showing what
Maveniverse Scalpel's skip-tests mode would have tested — without
affecting actual test execution.
Changes:
- incremental-build.sh: configure Scalpel with skipTestsForDownstreamModules
and fetchBaseBranch=false, add writeScalpelComparison() for collapsible
PR comment section with failure reporting
- pr-build-main.yml / sonar-build.yml: add base branch fetch step for
Scalpel's merge-base detection in shallow CI clones, restore checkout v7
- CI-ARCHITECTURE.md: document shadow comparison approach and configuration
- Scalpel upgraded to 0.3.7: fixes inflated affectedModules count for
parent POM property changes (scalpel#39) and skipTestsForDownstreamModules
Copy file name to clipboardExpand all lines: .github/CI-ARCHITECTURE.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,12 +154,30 @@ Both methods run in parallel. Results are merged (union) before testing. This le
154
154
2.**No regression** — If Scalpel fails, grep results are still used
155
155
3.**Gradual migration** — Once Scalpel is validated, grep can be removed
156
156
157
-
Scalpel is configured permanently in `.mvn/extensions.xml` (version `0.1.0`). On developer machines it is a no-op — without CI environment variables (`GITHUB_BASE_REF`), no base branch is detected and Scalpel returns immediately. The `mvn validate` with report mode adds ~60-90 seconds in CI.
158
-
159
-
Note: the script overrides `fullBuildTriggers` to empty (`-Dscalpel.fullBuildTriggers=`) because Scalpel's default (`.mvn/**`) would trigger a full build whenever `.mvn/extensions.xml` itself changes (e.g., Dependabot bumping Scalpel).
157
+
Scalpel is configured permanently in `.mvn/extensions.xml`. On developer machines it is a no-op (disabled via `-Dscalpel.enabled=false` in `.mvn/maven.config`). The CI script overrides this with `-Dscalpel.enabled=true`. The `mvn validate` with report mode adds ~60-90 seconds in CI.
160
158
161
159
Scalpel is only invoked when a **subdirectory**`pom.xml` is changed (e.g. `parent/pom.xml`, `components/camel-kafka/pom.xml`). Changes to the **root**`pom.xml` are excluded because it contains build-infrastructure config (license plugin, checkstyle, etc.) that does not affect module compilation or test behavior. Without this filter, Scalpel would report every module as affected since they all inherit from the root POM.
162
160
161
+
#### Scalpel features used for shadow comparison
162
+
163
+
-**Source-set-aware propagation**: Distinguishes test-jar dependencies from regular dependencies. A module that depends only on another module's test-jar (e.g., `camel-core`'s test-jar with test utilities) is propagated through the `TEST` source set, not the `MAIN` source set. This prevents a change to test utilities from triggering tests in all ~500 modules that depend on `camel-core`.
164
+
-**`skipTestsForDownstreamModules`**: Allows specifying modules whose tests should be skipped when they appear as downstream dependents (mirrors the `EXCLUSION_LIST` in `incremental-build.sh`). This gives Scalpel an accurate picture of what skip-tests mode would actually test.
165
+
166
+
#### Shadow comparison
167
+
168
+
Scalpel runs in **shadow mode**: it observes what skip-tests mode *would* have done and reports it in a collapsible section of the PR comment, without affecting actual test execution. This allows the team to validate Scalpel's decisions across many PRs before switching to Scalpel-driven test execution.
169
+
170
+
The shadow comparison section shows:
171
+
- How many modules Scalpel would test (direct + downstream)
172
+
- How many downstream modules would have tests skipped (generated code, meta-modules)
173
+
- The full list of modules in each category
174
+
175
+
#### Configuration notes
176
+
177
+
The script overrides `fullBuildTriggers` to empty (`-Dscalpel.fullBuildTriggers=`) because Scalpel's default (`.mvn/**`) would trigger a full build whenever `.mvn/extensions.xml` itself changes (e.g., Dependabot bumping Scalpel).
178
+
179
+
The grep-based script fetches the PR diff via the GitHub REST API (unchanged). Scalpel uses local git history to compare effective POM models — the CI workflow pre-fetches the base branch (`git fetch --deepen=200` + fetch of `origin/main`) so Scalpel's JGit can find the merge-base. Scalpel disables its built-in JGit fetch (`-Dscalpel.fetchBaseBranch=false`) to avoid JGit issues in shallow CI clones. The `--deepen=200` fetches only commit metadata (not file blobs), adding ~2-3 seconds to the job.
180
+
163
181
## Manual Integration Test Advisories
164
182
165
183
Some modules are excluded from CI's `-amd` expansion (the `EXCLUSION_LIST`) because they are generated code, meta-modules, or expensive integration test suites. When a contributor changes one of these modules, CI cannot automatically test all downstream effects.
echo"> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)">>"$comment_file"
420
+
echo"">>"$comment_file"
421
+
echo"</details>">>"$comment_file"
422
+
return
423
+
fi
424
+
425
+
# Skip if no Scalpel data (Scalpel was not invoked for this PR)
426
+
if [ -z"$scalpel_would_test" ] && [ -z"$scalpel_would_skip" ];then
echo"**Scalpel skip-tests mode would test ${scalpel_test_count} modules** (${scalpel_direct_count} direct + ${scalpel_downstream_tested} downstream)">>"$comment_file"
443
+
444
+
if [ "$scalpel_downstream_skipped"-gt 0 ];then
445
+
echo"">>"$comment_file"
446
+
echo"${scalpel_downstream_skipped} downstream module(s) would have tests skipped (generated code, meta-modules)">>"$comment_file"
447
+
fi
448
+
449
+
# Show which modules Scalpel would test
450
+
if [ -n"$scalpel_would_test" ];then
451
+
echo"">>"$comment_file"
452
+
echo"<details><summary>Modules Scalpel would test (${scalpel_test_count})</summary>">>"$comment_file"
echo"> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)">>"$comment_file"
0 commit comments