Skip to content

chore(ci): unify CI test infrastructure#22247

Open
gnodet wants to merge 8 commits intomainfrom
ci-merge-incremental-build-detect-dependencies
Open

chore(ci): unify CI test infrastructure#22247
gnodet wants to merge 8 commits intomainfrom
ci-merge-incremental-build-detect-dependencies

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 24, 2026

Summary

Unifies the CI test infrastructure into a single, maintainable system. Previously there were multiple independent mechanisms for detecting and testing affected modules, producing separate confusing PR comments.

1. Merge detect-dependencies into incremental-build

  • Single script that combines file-path analysis (for source changes) with Maveniverse Toolbox dependency analysis (for pom.xml property changes)
  • Both sets of affected modules are merged and deduplicated before testing
  • Pom-only parent modules (e.g. parent) are filtered out when Toolbox finds the real targets
  • Produces one unified PR comment instead of two
  • Raises the testable modules threshold to 1000 (effectively disabled — there are ~680 modules)
  • Removes the unused build mode (builds are handled by regen.sh)
  • Deletes the detect-dependencies action

2. Unify /component-test with the main workflow

  • /component-test now dispatches the main "Build and test" workflow via workflow_dispatch with the extra modules, instead of running its own independent build
  • Saves CI time by not duplicating the full build
  • Disabled-test detection (@DisabledIfSystemProperty(named = "ci.env.name")) added to the unified PR comment
  • Deletes the standalone component-test action

3. Fork PR comment support via workflow_run

  • Moves PR comment posting from the build workflow to a new pr-test-commenter.yml triggered by workflow_run
  • Runs in base repo context with full permissions — works for fork PRs where GITHUB_TOKEN is read-only
  • Build workflow no longer needs pull-requests: write permission
  • Comment includes a link to the full workflow run for detailed results

4. Miscellaneous fixes

  • Concurrency: /component-test dispatches get their own concurrency group so they don't cancel running normal builds
  • Dead labels: build-all and build-dependents labels removed from welcome message (were only used in the now-removed build mode)
  • Property detection bug fix: structural XML elements (<groupId>, <artifactId>, <version>, etc.) were incorrectly extracted as "changed properties" when adding new dependencies to parent/pom.xml, causing spurious failures (fixes the CI bug seen in CAMEL-21540: Add PGVector component for PostgreSQL vector database #22207)

Files changed

File Change
.github/actions/incremental-build/incremental-build.sh Rewritten: merged dependency analysis, extra modules, disabled-test detection
.github/actions/incremental-build/action.yaml Simplified: removed mode, added extra-modules
.github/workflows/pr-build-main.yml Removed inline comment posting, added artifact upload, concurrency fix
.github/workflows/pr-manual-component-test.yml Simplified to dispatch main workflow
.github/workflows/pr-test-commenter.yml New: posts unified comment via workflow_run
.github/workflows/pr-commenter.yml Removed dead label references
.github/workflows/main-build.yml Removed unused mode parameter
.github/actions/detect-dependencies/ Deleted (merged into incremental-build)
.github/actions/component-test/ Deleted (merged into incremental-build)

Test plan

  • Trigger via workflow_dispatch to verify the unified script works end-to-end
  • Test with a dependency bump PR to verify Toolbox detection
  • Test with a new component PR (like CAMEL-21540: Add PGVector component for PostgreSQL vector database #22207) to verify the property detection fix
  • Test /component-test dispatch to verify it triggers the main workflow
  • Verify comment posting works for fork PRs via workflow_run

Merge the separate detect-dependencies action into the incremental-build
action to provide a single unified CI test mechanism.

Previously, two independent mechanisms determined which modules to test:
1. incremental-build: file-path based module detection
2. detect-dependencies: POM property change analysis using Maveniverse Toolbox

For dependency version bumps in parent/pom.xml, the file-path approach would
identify "parent" as the changed module, find that everything depends on it,
and give up. The detect-dependencies action would then run separately and
find the actually affected modules via Toolbox dependency analysis.

This resulted in two separate PR comments, wasted CI time testing "parent"
(which has no tests), and general confusion.

The merged script now:
- Uses file-path analysis for source code changes (unchanged)
- Uses Toolbox dependency analysis for any changed pom.xml (generalized
  from parent-only to all pom.xml files)
- Merges and deduplicates both sets of affected modules
- Filters out pom-only parent modules when Toolbox found the real targets
- Runs tests once and posts a single unified PR comment
- Raises the testable modules threshold to 1000 (effectively disabled)
- Removes the unused "build" mode (builds are handled by regen.sh)
- Supports push builds (git diff HEAD~1) when no PR ID is provided

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

gnodet and others added 4 commits March 24, 2026 23:27
Make /component-test dispatch the main "Build and test" workflow instead
of running its own independent build. This avoids duplicate full builds
and produces a unified PR comment.

Changes:
- pr-manual-component-test.yml now resolves component names to paths and
  dispatches the main workflow via workflow_dispatch with extra_modules
- incremental-build action accepts extra-modules input
- incremental-build script merges extra modules into the test list
- Disabled-test detection (@DisabledIfSystemProperty with ci.env.name)
  is now included in the unified comment for all tested modules
- Removed the standalone component-test action (logic merged)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move the CI test summary comment posting from the build workflow to a
separate workflow_run-triggered workflow. This allows posting comments
on PRs from forks, where the GITHUB_TOKEN has read-only permissions.

Changes:
- pr-build-main.yml: replace inline comment posting with artifact upload
  (pr-number + incremental-test-comment.md), remove pull-requests:write
- New pr-test-commenter.yml: triggers on "Build and test" completion,
  downloads the artifact, and posts/updates the unified PR comment
  with full permissions (runs in base repo context)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix concurrency: /component-test dispatches get their own concurrency
  group so they don't cancel running normal builds
- Remove dead labels: build-all and build-dependents no longer exist,
  remove them from the welcome message
- Add workflow run link to the test summary comment so reviewers can
  easily access detailed results across all JDK versions
- Document paths-ignore with instructions for testing CI changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a new dependency is added to parent/pom.xml, the diff contains
structural XML elements like <groupId>, <artifactId>, <version> which
were incorrectly extracted as "changed properties" by detectChangedProperties.

This caused the script to search for modules using ${artifactId} or
${groupId} as property references, which either matched nothing useful
or caused spurious failures.

Fix: filter out known structural POM element names (groupId, artifactId,
version, scope, type, etc.) so only actual property names like
"pgvector-version" or "openai-java-version" are detected.

Fixes the CI script bug seen in PR #22207 where adding a new component
to parent/pom.xml caused the dependency detection to fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet changed the title chore(ci): merge detect-dependencies into incremental-build chore(ci): unify CI test infrastructure Mar 25, 2026
@gnodet gnodet requested a review from oscerd March 25, 2026 07:27
uses: ./.github/actions/detect-dependencies
extra-modules: ${{ inputs.extra_modules || '' }}
- name: Save PR number and test comment for commenter workflow
if: always() && matrix.java == '21'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it filtering only on JDK 21?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Claude Code on behalf of Guillaume Nodet

The comment lists which modules were tested — this is identical across all JDK versions since the same modules are tested on JDK 17, 21, and 25. Per-JDK pass/fail results are visible in the GitHub Actions checks UI. Uploading from one JDK avoids duplicate artifacts. Added a comment in the workflow to clarify this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Claude Code on behalf of Guillaume Nodet

Updated — removed the JDK 21 filter. All non-experimental matrix entries now upload the artifact with overwrite: true. Since the content is identical across JDKs, whichever finishes last wins.

Comment on lines -42 to -43
- name: Check Permission
uses: actions-cool/check-user-permission@7b90a27f92f3961b368376107661682c441f6103
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the check user permission has been removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Claude Code on behalf of Guillaume Nodet

Good catch — this was accidentally removed during the rewrite. Re-added in the latest commit.

Copy link
Contributor

@apupier apupier left a comment

Choose a reason for hiding this comment

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

I think we will need to be able to test it in some ways before merging as it is quite a complex change

Copy link
Contributor

@oscerd oscerd left a comment

Choose a reason for hiding this comment

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

This looks a really good improvement for maintainability. I think it would be important to have a document under .github folder where we show the architecture of our GH actions ecosystem. That way it could be used for knowledge in the future.

gnodet and others added 2 commits March 25, 2026 11:04
- Pin actions/github-script to hash (ed597411d8f9) in pr-test-commenter.yml
- Re-add check-user-permission step to pr-manual-component-test.yml
- Add comment explaining why JDK 21 filter for comment artifact upload

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add .github/CI-ARCHITECTURE.md documenting the GitHub Actions ecosystem:
workflow relationships, action descriptions, PR labels, and CI environment
configuration.

Addresses review feedback requesting architecture documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet
Copy link
Contributor Author

gnodet commented Mar 25, 2026

Claude Code on behalf of Guillaume Nodet

Regarding testing: since .github/** is in paths-ignore, this PR won't trigger the build workflow automatically. We can test via manual dispatch:

gh workflow run "Build and test" -f pr_number=22247 -f pr_ref=ci-merge-incremental-build-detect-dependencies

Regarding the architecture doc: added .github/CI-ARCHITECTURE.md with an overview of all workflows, actions, labels, and their relationships.

All review comments have been addressed:

  • actions/github-script pinned to hash
  • check-user-permission re-added
  • JDK 21 filter explained with inline comment

@github-actions github-actions bot added the docs label Mar 25, 2026
Remove the JDK 21 filter — all non-experimental matrix entries now
upload the comment artifact with overwrite:true. The content is
identical across JDKs (same modules tested), so whichever finishes
last wins.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants