|
| 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 (Toolbox) |
| 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 uses [Maveniverse Toolbox](https://github.com/maveniverse/toolbox) |
| 79 | + `tree-find` to discover modules depending on affected artifacts (including |
| 80 | + transitive dependencies) |
| 81 | +3. **Extra modules**: Additional modules passed via `/component-test` |
| 82 | + |
| 83 | +Results are merged, deduplicated, and tested. The script also: |
| 84 | +- Detects tests disabled in CI (`@DisabledIfSystemProperty(named = "ci.env.name")`) |
| 85 | +- Applies an exclusion list for generated/meta modules |
| 86 | +- Generates a unified PR comment with all test information |
| 87 | + |
| 88 | +### `install-mvnd` |
| 89 | +Installs the Maven Daemon (mvnd) for faster builds. |
| 90 | + |
| 91 | +### `install-packages` |
| 92 | +Installs system packages required for the build. |
| 93 | + |
| 94 | +## PR Labels |
| 95 | + |
| 96 | +| Label | Effect | |
| 97 | +|-------|--------| |
| 98 | +| `skip-tests` | Skip all tests | |
| 99 | +| `test-dependents` | Force testing dependent modules even if threshold exceeded | |
| 100 | + |
| 101 | +## CI Environment |
| 102 | + |
| 103 | +The CI sets `-Dci.env.name=github.com` via `MVND_OPTS` (in `install-mvnd`). |
| 104 | +Tests can use `@DisabledIfSystemProperty(named = "ci.env.name")` to skip |
| 105 | +flaky tests in CI. The test comment warns about these skipped tests. |
| 106 | + |
| 107 | +## Comment Markers |
| 108 | + |
| 109 | +PR comments use HTML markers for upsert (create-or-update) behavior: |
| 110 | +- `<!-- ci-tested-modules -->` — Unified test summary comment |
0 commit comments