Skip to content

Commit 463ac2d

Browse files
gnodetclaude
andcommitted
chore(ci): rationalize CI into single workflow with unified comment
Merge three separate CI actions (incremental-build, detect-dependencies, component-test) into one unified incremental-build script and simplify the workflow architecture. Deleted: .github/actions/component-test/ .github/actions/detect-dependencies/ Added: .github/workflows/pr-test-commenter.yml .github/CI-ARCHITECTURE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 255463d commit 463ac2d

File tree

12 files changed

+842
-597
lines changed

12 files changed

+842
-597
lines changed

.github/CI-ARCHITECTURE.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# CI Architecture
2+
3+
Overview of the GitHub Actions CI/CD ecosystem for Apache Camel.
4+
5+
## Workflow Overview
6+
7+
```
8+
PR opened/updated
9+
10+
├──► pr-id.yml ──► pr-commenter.yml (welcome message)
11+
12+
└──► pr-build-main.yml (Build and test)
13+
14+
├── regen.sh (full build, no tests)
15+
├── incremental-build (test affected modules)
16+
│ ├── File-path analysis
17+
│ ├── POM dependency analysis
18+
│ └── Extra modules (/component-test)
19+
20+
└──► pr-test-commenter.yml (post unified comment)
21+
22+
PR comment: /component-test kafka http
23+
24+
└──► pr-manual-component-test.yml
25+
26+
└── dispatches "Build and test" with extra_modules
27+
```
28+
29+
## Workflows
30+
31+
### `pr-build-main.yml` — Build and test
32+
- **Trigger**: `pull_request` (main branch), `workflow_dispatch`
33+
- **Matrix**: JDK 17, 21, 25 (25 is experimental)
34+
- **Steps**:
35+
1. Full build via `regen.sh` (`mvn install -DskipTests -Pregen`)
36+
2. Check for uncommitted generated files
37+
3. Run incremental tests (only affected modules)
38+
4. Upload test comment as artifact
39+
- **Inputs** (workflow_dispatch): `pr_number`, `pr_ref`, `extra_modules`
40+
41+
### `pr-test-commenter.yml` — Post CI test comment
42+
- **Trigger**: `workflow_run` on "Build and test" completion
43+
- **Purpose**: Posts the unified test summary comment on the PR
44+
- **Why separate**: Uses `workflow_run` to run in base repo context, allowing
45+
comment posting on fork PRs (where `GITHUB_TOKEN` is read-only)
46+
47+
### `pr-manual-component-test.yml` — /component-test handler
48+
- **Trigger**: `issue_comment` with `/component-test` prefix
49+
- **Who**: MEMBER, OWNER, or CONTRIBUTOR only
50+
- **What**: Resolves component names to module paths, dispatches the main
51+
"Build and test" workflow with `extra_modules`
52+
53+
### `pr-id.yml` + `pr-commenter.yml` — Welcome message
54+
- **Trigger**: `pull_request` (all branches)
55+
- **Purpose**: Posts the one-time welcome message on new PRs
56+
- **Why two workflows**: `pr-id.yml` runs in PR context (uploads PR number),
57+
`pr-commenter.yml` runs via `workflow_run` with write permissions
58+
59+
### `main-build.yml` — Main branch build
60+
- **Trigger**: `push` to main, camel-4.14.x, camel-4.18.x
61+
- **Steps**: Same as PR build but without comment posting
62+
63+
### Other workflows
64+
- `pr-labeler.yml` — Auto-labels PRs based on changed files
65+
- `pr-doc-validation.yml` — Validates documentation changes
66+
- `pr-cleanup-branches.yml` — Cleans up merged PR branches
67+
- `alternative-os-build-main.yml` — Tests on non-Linux OSes
68+
- `check-container-versions.yml` — Checks test container version updates
69+
- `generate-sbom-main.yml` — Generates SBOM for releases
70+
- `security-scan.yml` — Security vulnerability scanning
71+
72+
## Actions
73+
74+
### `incremental-build`
75+
The core test runner. Determines which modules to test using:
76+
1. **File-path analysis**: Maps changed files to Maven modules
77+
2. **POM dependency analysis**: For changed `pom.xml` files, detects property
78+
changes and finds modules that reference the affected properties in their
79+
`pom.xml` files
80+
3. **Extra modules**: Additional modules passed via `/component-test`
81+
82+
Results are merged, deduplicated, and tested. The script also:
83+
- Detects tests disabled in CI (`@DisabledIfSystemProperty(named = "ci.env.name")`)
84+
- Applies an exclusion list for generated/meta modules
85+
- Generates a unified PR comment with all test information
86+
87+
### `install-mvnd`
88+
Installs the Maven Daemon (mvnd) for faster builds.
89+
90+
### `install-packages`
91+
Installs system packages required for the build.
92+
93+
## PR Labels
94+
95+
| Label | Effect |
96+
|-------|--------|
97+
| `skip-tests` | Skip all tests |
98+
| `test-dependents` | Force testing dependent modules even if threshold exceeded |
99+
100+
## CI Environment
101+
102+
The CI sets `-Dci.env.name=github.com` via `MVND_OPTS` (in `install-mvnd`).
103+
Tests can use `@DisabledIfSystemProperty(named = "ci.env.name")` to skip
104+
flaky tests in CI. The test comment warns about these skipped tests.
105+
106+
## Known Limitations of POM Dependency Detection
107+
108+
The property-grep approach has structural limitations that can cause missed modules:
109+
110+
1. **Managed dependencies without explicit `<version>`** — Most Camel modules
111+
inherit dependency versions via `<dependencyManagement>` in the parent POM
112+
and do not declare `<version>${property}</version>` themselves. When a managed
113+
dependency version property changes, only modules that explicitly reference
114+
the property are detected — modules relying on inheritance are missed.
115+
116+
2. **Maven plugin version changes are completely invisible** — Plugin version
117+
properties (e.g. `<maven-surefire-plugin-version>`) are both defined and
118+
consumed in `parent/pom.xml` via `<pluginManagement>`. Since the module
119+
search excludes `parent/pom.xml`, no modules are found and **no tests run
120+
at all** for plugin updates. Modules inherit plugins from the parent without
121+
any `${property}` reference in their own `pom.xml`.
122+
123+
3. **BOM imports** — When a BOM version property changes (e.g.
124+
`<spring-boot-bom-version>`), modules using artifacts from that BOM are not
125+
detected because they reference the BOM's artifacts, not the BOM property.
126+
127+
4. **Transitive dependency changes** — Modules affected only via transitive
128+
dependencies are not detected.
129+
130+
5. **Non-property version changes** — Direct edits to `<version>` values (not
131+
using `${property}` substitution) or structural changes to
132+
`<dependencyManagement>` sections are not caught.
133+
134+
These limitations mean the incremental build may under-test when parent POM
135+
properties change. A future improvement could use
136+
[Maveniverse Toolbox](https://github.com/maveniverse/toolbox) `tree-find` or
137+
[Scalpel](https://github.com/maveniverse/scalpel) to resolve the full
138+
dependency graph and detect all affected modules.
139+
140+
## Comment Markers
141+
142+
PR comments use HTML markers for upsert (create-or-update) behavior:
143+
- `<!-- ci-tested-modules -->` — Unified test summary comment

.github/actions/component-test/action.yaml

Lines changed: 0 additions & 121 deletions
This file was deleted.

.github/actions/component-test/component-test.sh

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/actions/detect-dependencies/action.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)