ci(workflow): Discuss selective execution of acceptance tests based on changed paths
Description
While reviewing the pr-testing-with-test-project.yml workflow, I noticed that the acceptance tests currently run for all three language templates (js, py, and java) whenever should_test is true, regardless of which part of the repository was modified.
After analyzing the workflow, test infrastructure, and template dependencies, I think there may be an opportunity to reduce unnecessary acceptance test executions. Before working on an implementation, I'd like to discuss whether this approach aligns with the project's expectations.
Current behavior
The acceptance workflow uses a matrix:
strategy:
matrix:
language: [js, py, java]
Once the changes job sets should_test=true, all three acceptance suites are executed.
Findings from the repository analysis
1. Language-specific acceptance tests are already isolated
The acceptance workflow executes one Docker Compose profile per matrix job:
test-jstest-pytest-java
Each profile starts only its corresponding tester service.
2. Shared infrastructure is independent
The workflow starts the common Microcks infrastructure using the ci profile before executing the language-specific profile.
The language-specific tester services do not depend on one another, only on the shared infrastructure.
3. Repository has both shared and language-specific areas
From tracing the acceptance test dependency chain, there appear to be two categories of paths:
Shared (should trigger all acceptance tests):
apps/generator/**packages/helpers/**packages/components/**apps/react-sdk/**- Shared acceptance infrastructure (
integration-test,__fixtures__,microcks-setup, etc.)
Language-specific (could potentially trigger only one acceptance suite):
packages/templates/clients/websocket/javascript/**packages/templates/clients/websocket/python/**packages/templates/clients/websocket/java/quarkus/**
Discussion
Would it make sense to extend the existing paths-filter configuration so that:
- changes to shared packages continue running all acceptance tests,
- while changes limited to a single client template execute only that client's acceptance suite?
The main goal would be to reduce unnecessary CI execution time without skipping any required validation.
@derberg I have analyse the whole generator repo I belive this is practical an possible to implement , if u find any point unclear we can can discuss as i have done sufficient analysis . So ,please have a look once.
@SHUBHANSHU602 thanks for digging into this — the underlying idea (avoiding redundant acceptance runs) is valid and something we've wanted for a while (there's actually a TODO for exactly this in microcks-podman.yml).
That said, I don't agree with the approach in the Discussion section — simply extending the existing paths-filter step isn't the right fix, for a couple of reasons:
-
pr-testing-with-test-project.ymlis not only about acceptance tests. The samechangesjob also gates thetestjob (the Node/test-project run). Bolting acceptance-specific, per-language logic onto that shared filter/output mixes two unrelated concerns into one config and makes the workflow harder to reason about and maintain. -
Our templates aren't self-contained, so naive per-client path filtering breaks. Each client template depends on
@asyncapi/generator-helpers,@asyncapi/generator-components, and@asyncapi/keeper. If we filter purely onpackages/templates/clients/websocket/<client>/**, we get it wrong the moment someone changes only a shared package and touches no client-specific files — that shared change can still affect the generated output/behavior of every client, so we can't skip that client's acceptance suite in that case.
Before starting implementation, please do a bit more research and share your proposed approach/design first.
ohk @Adi-204 I will explain my aproach soon.
@Adi-204 thanks for the feedback. I revisited the workflow and the test setup, and I agree that acceptance selection should have its own decision rather than extending the shared should_test output.
I'd propose adding a separate acceptance-plan job. The existing changes job would keep controlling the Node test-project run, while the new job would output the languages needed for the acceptance matrix.
For the first version, I'd keep selection conservative:
- Changes limited to one client's template or acceptance tests would select that client.
- Changes across multiple client directories would select their combined runners.
- Changes to shared packages, hooks, Keeper, fixtures, integration-test infrastructure, Microcks setup, or root build/dependency files would run all three.
- Any relevant path we haven't explicitly classified would also run all three.
This way we only reduce the matrix when we can confidently identify the affected clients.
I also found that the shared WebSocket integration tests already support TEST_CLIENT, with separate scripts for JavaScript, Python, and Java Quarkus. However, I'd keep the current npm run packages:test generation step in the first PR and focus on acceptance-job selection. Narrowing generation could be a follow-up after checking the build prerequisites.
I'd test the planner against single-client changes, mixed client changes, shared changes, renames, and documentation-only changes. I'd also check whether the existing acceptance job names are required checks before changing which jobs appear.
Does this make sense now ?
Hi @Adi-204 and @SHUBHANSHU602,
I dug into this issue and followed the suggestions of @Adi-204.
What I Found
- Current Compute Waste:
Looking at recent PRs (like #2238, where Dependabot only bumped
wsin the JavaScript client template), GitHub Actions still booted up Python and Maven/Quarkus containers:Acceptance tests (js): ~5 minAcceptance tests (py): ~5 minAcceptance tests (java): ~5.5 min About 16 runner-minutes were spent in total; roughly 10 minutes were wasted running Python and Java containers on a JS-only change.
- Branch Protection Check Names:
GitHub branch protection expects each matrix entry to report its status individually (
Acceptance tests (js),(py),(java)). If we dynamically shrink the matrix so unneeded languages do not run at all, those check names never report. This can block PR merges if branch protection requires them.
Proposed Solution
To address Adi's points on keeping changes clean and handling shared packages properly:
- Leave
changesandtestuntouched: Keep the existingchangesjob strictly responsible for the Nodetestproject run. It does not need to know anything about acceptance test languages. - Add a separate
acceptance_planjob: Usesdorny/paths-filterto classify changed files into clear buckets:shared: Any changes toapps/**,packages/helpers/**,packages/components/**,package.json,package-lock.json,turbo.json,.github/workflows/pr-testing-with-test-project.yml, shared fixtures (test/__fixtures__/**), or Microcks setup files (microcks-setup/**).- Rule: If
sharedis true, settest_all=true(forcesjs,py, andjavato run).
- Rule: If
js_client:packages/templates/clients/websocket/javascript/**andtest/javascript/**.py_client:packages/templates/clients/websocket/python/**andtest/python/**.java_client:packages/templates/clients/websocket/java/quarkus/**andtest/java/**.- Safety net: Any unclassified code file change also falls back to
test_all=true.
- Keep the static matrix
[js, py, java]: All three matrix jobs start, but the heavy steps (npm ci, Microcks setup, container test execution) are guarded by:
if: needs.changes.outputs.should_test == 'true'
&& (needs.acceptance_plan.outputs.test_all == 'true'
|| needs.acceptance_plan.outputs[matrix.language] == 'true')
- When a language is needed, it runs the full suite as usual.
- When a language is not needed, it checks out and exits green in roughly 30 seconds; it skips the heavy container and Maven downloads entirely.
- All three checks still report
SUCCESSto GitHub. This keeps branch protection completely safe while saving about 5 minutes of container setup per skipped language.
Evidence with Live run
I tested this workflow on my fork with a Python-only change to verify the behavior: Workflow Run Link: https://github.com/devxdh/asyncapi-generator/actions/runs/39118958707
In that run:
Determine acceptance test plancorrectly logged:Selective client changes detected (js=false, py=true, java=false).Acceptance tests (js)and(java)skipped their container steps and finished green in about 30 seconds (JS job link, Java job link).Acceptance tests (py)ran the full test suite.
@Adi-204 Your thoughts on it?
@devxdh for this one one i have already came up with the solution but the problem for now is that in many prs , these tests do not even run because the maintainer has limited that with github features for the security purposes, so that has to be fixed first in order to get the benefits of the this one , so once the issue is approved I will fix it. Also fantastic Analysis ❤️
Thanks for the kind words, @SHUBHANSHU602 ! I just wanted to share the findings of my investigation and a working proof of concept to help the team. You're more than welcome to use any of the filter logic or patterns from my fork if they save you time. Feel free to raise a PR once this issue is approved ;)