Repository navigation
feat(ci): eliminate duplicate E2E tests and slim nextest archive - #1874
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1874 +/- ##
===========================================
+ Coverage 77.81% 80.83% +3.02%
===========================================
Files 382 368 -14
Lines 28637 27580 -1057
Branches 28637 27580 -1057
===========================================
+ Hits 22284 22295 +11
+ Misses 6049 4983 -1066
+ Partials 304 302 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… analysis - Remove `debug` target from container.yaml test matrix (saves ~40 min per CI run) - Replace docker-inspect step with four E2E test steps (e2e_tests_runner + qbittorrent sqlite3/mysql/postgresql) in container.yaml test job - Add `if:` skip condition to testing.yaml docker-e2e job so it does not run when container.yaml already covers the same trigger (PRs to develop/main, pushes to develop/main/releases/**) - Warm publish_development and publish_release caches from container-release scope to avoid redundant full rebuilds on the same commit - Add detailed comments to container.yaml explaining unit test environment (rust:slim-trixie vs distroless), cache flow, and skip rationale - Add ADR 20260603000000: keep unit tests inside the container build - Update ADR index with new ADR entry - Update issue torrust#1854 spec: add full analysis (T1–T14), implementation plan, acceptance criteria (AC1–AC15), and test binary landscape findings (T11–T14 with three concrete optimization opportunities) Closes part of torrust#1854 (T7–T10 done; T12–T14 tracked as follow-up).
…ackages T12: add --exclude torrust-tracker-client and --exclude torrust-tracker-contrib-bencode to all four cargo nextest archive calls (debug/release cook-warmup and debug/release archive) in Containerfile. T13: create packages/e2e-tools/ (torrust-tracker-e2e-tools) and move e2e_tests_runner, qbittorrent_e2e_runner, and profiling binaries out of src/bin/ via git mv; add --exclude torrust-tracker-e2e-tools to all four archive calls. T14a: create packages/persistence-benchmark/ (torrust-tracker-persistence-benchmark) and move persistence_benchmark_runner binary and full persistence_benchmark/ module tree out of tracker-core/src/bin/ via git mv; add --exclude torrust-tracker-persistence-benchmark to all four archive calls. T14b: move testcontainers from [dependencies] to [dev-dependencies] in packages/tracker-core/Cargo.toml so it is no longer linked into production binaries. Docs: add nextest-archive-analysis.md (binary landscape analysis for 47 compiled targets); mark T11-T14 DONE and check AC12-AC15 in ISSUE.md. Misc: add alloca, artefacts, bitcode, objcopy to project-words.txt. Closes tasks T12, T13, T14 of issue torrust#1854.
5a9ed4a to
c47173f
Compare
There was a problem hiding this comment.
Pull request overview
This PR reduces duplicated CI work by moving the Docker E2E execution into container.yaml, gating testing.yaml’s docker-e2e job when the container workflow already provides equivalent coverage, and documenting the policy/analysis in an ADR and issue spec.
Changes:
- Consolidate E2E coverage: run the E2E runners in
container.yamlright after building the image, and skiptesting.yaml’sdocker-e2eon overlapping triggers. - Simplify the container test matrix by removing the unused
debugtarget and warming publish jobs’ BuildKit cache from thecontainer-releasescope. - Add ADR + issue-spec documentation capturing the rationale, environment differences, and follow-up optimization opportunities.
Reviewed changes
Copilot reviewed 13 out of 36 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/container.yaml |
Removes debug matrix target, adds toolchain/cache setup, runs E2E steps after docker build, and reuses container-release cache in publish jobs. |
.github/workflows/testing.yaml |
Adds an if: guard to skip docker-e2e when container.yaml already runs equivalent E2E coverage for the same trigger. |
docs/adrs/20260603000000_keep_unit_tests_inside_container_build.md |
New ADR documenting the decision to keep unit tests inside the container build and how E2E provides distroless runtime validation. |
docs/adrs/index.md |
Registers the new ADR in the ADR index table. |
docs/issues/open/1854-1840-workflow-performance-container-test-gating/ISSUE.md |
Expands analysis, plan, and acceptance criteria for the CI test-gating work and follow-ups. |
project-words.txt |
Adds new spellcheck allowlist entries used by the new/updated documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…k extraction persistence_benchmark_runner was moved from packages/tracker-core/ to the new packages/persistence-benchmark/ package (T14a of issue torrust#1854). Update all three benchmark jobs (SQLite3, MySQL, PostgreSQL) to use -p torrust-tracker-persistence-benchmark instead of -p torrust-tracker-core. Also extend the path filter to include packages/persistence-benchmark/** so the workflow triggers on changes to the new package.
- Fix four 'cargo run --bin' invocations in container.yaml to include '-p torrust-tracker-e2e-tools' so Cargo resolves the binaries after they were extracted out of src/bin/ into the new e2e-tools package - Wrap the long e2e_tests_runner run step with a YAML '>-' multiline scalar to stay within the 200-char yamllint line-length limit - Remove duplicate 'bitcode' entry from project-words.txt and restore correct alphabetical order (binascii → binstall → bitcode) - Correct Containerfile comment about torrust-tracker-contrib-bencode: it IS a production dependency; the package is excluded from nextest archive to avoid compiling its own tests/bins, not because it is unused - Add packages/e2e-tools/README.md so Cargo.toml 'readme' field resolves
|
ACK 2d1ce24 |
da2ce7
left a comment
There was a problem hiding this comment.
This is a post-merge review of #1874 as its change stands at e170b9620 on the default branch.
What still runs: the Test (Docker) job builds only the release target (.github/workflows/container.yaml:76) and runs the four host-side E2E runners against torrust-tracker:local (.github/workflows/container.yaml:138-155); the docker-e2e job keeps the if: that skips it on the events the Container workflow covers (.github/workflows/testing.yaml:257-263); the runners and the persistence benchmark live in the packages/e2e-tools and packages/persistence-benchmark workspace members (Cargo.toml:172, Cargo.toml:177), and the benchmark workflow selects the new package and watches its path (.github/workflows/db-benchmarking.yaml:15, :21, :54, :81, :108). Three parts have changed since: f523e8d removed the publish jobs' read of the container-release cache scope, which any job holding a develop cache token could have written; 0b17ac8 replaced the six --exclude flags in the Containerfile with the default-members list (Cargo.toml:198-220); and a58ff98 added the -p torrust-tracker-e2e-tools that this change left out of the docker-e2e runner invocations, where Cargo had exited 101 at the workspace root before any E2E ran.
[Minor] The four E2E runner invocations are written twice, at .github/workflows/container.yaml:138-155 and .github/workflows/testing.yaml:314-331, and the if: at .github/workflows/testing.yaml:257-263 keeps the second copy off every pull request to develop or main, so no pull request's checks run it. A change to the runners' package, binary names or flags that updates only the first copy merges with every check passing and leaves the second broken until someone reads a branch-push run. That is what happened here: this change moved the binaries into torrust-tracker-e2e-tools and added -p in the Container workflow only, and docker-e2e failed before running any E2E from d9ec549 until a58ff98 (#2179). Smallest fix: move the four invocations into one composite action under .github/actions/ that takes the image tag as an input, and call it from both jobs, so the copy that pull requests exercise is the copy that branch pushes run.
[Minor] No workflow builds the debug target any more: the matrix at .github/workflows/container.yaml:76 holds only release, and no other workflow at e170b9620 names that target, while docs/containers.md:109 and docs/containers.md:119 tell users to build it. A change that breaks only the debug chain (the stages that start at Containerfile:95, :102, :149, :154, :171, :184, :199 and :278) passes every check and is first seen by a user following that page. Smallest fix: build --target debug on a schedule or on pushes to develop only, which keeps the pull-request time saving this change was after.
[Minor] Every automated dependency update still runs the Docker build and the four E2E runners twice. .github/dependabot.yaml:9 and :18 open daily updates against develop from branches in this repository. The push to such a branch runs docker-e2e, because the push half of the if: (.github/workflows/testing.yaml:260-263) exempts only develop, main and releases/, and the pull request it opens runs Test (Docker) (.github/workflows/container.yaml:39) with the same image and runners. Since other pull requests come from forks, these branches are the main same-repository source of the duplication this change set out to remove. Smallest fix: add startsWith(github.ref, 'refs/heads/dependabot/') to the push disjunction at .github/workflows/testing.yaml:261-263.
[Minor] Usage text and a benchmark script still call the moved binaries from the workspace root without -p, where Cargo exits 101 because torrust-tracker-e2e-tools is not a default member. contrib/dev-tools/workflow-benchmarks/run-testing-baseline.sh:121 runs under set -euo pipefail and so stops at its first E2E phase, and the examples at packages/e2e-tools/src/bin/qbittorrent_e2e_runner.rs:27, src/console/ci/e2e/runner.rs:6, :12, :18 and src/console/ci/qbittorrent_e2e/runner.rs:6 fail when copied. Smallest fix: add -p torrust-tracker-e2e-tools to those invocations, as a58ff98 did for the workflow.
[Nit] The if: at .github/workflows/testing.yaml:257-263 restates the Container workflow's triggers (.github/workflows/container.yaml:11-26) by hand, and the comment that names the link sits under the job (.github/workflows/container.yaml:60-63), not beside on:. The two agree at this tip. If a later edit drops main from .github/workflows/container.yaml:23, pull requests to main get no Docker E2E at all and no check says so. Smallest fix: a comment at .github/workflows/container.yaml:11 naming .github/workflows/testing.yaml:257 as the condition to change with it.
Checked and found sound: at this tip the skip condition matches the Container workflow's branch and path filters, including releases/**/* against the refs/heads/releases/ prefix and the identical paths-ignore lists; both runner binaries return their anyhow::Result from main, so a failed run fails its job; the two new manifests resolve against the versions of torrust-tracker, torrust-tracker-core, torrust-tracker-configuration and torrust-tracker-primitives at this tip, carry publish = false, and stay out of default-members, so they never enter the container test archives; and the benchmark workflow's new path filter and package selection.

Closes #1854
Summary
Eliminates duplicated E2E test work between
container.yamlandtesting.yaml,removes the unused
debugCI matrix target, documents the test binarylandscape, and slims
cargo nextest archiveby extracting dev-only packages.Changes
.github/workflows/container.yamldebugfrom test matrix — onlyreleasebuilt in CI (saves ~40 min per trigger)docker image inspectstep with four E2E test steps run immediately afterdocker build:e2e_tests_runner+ qBittorrent E2E for sqlite3, mysql, postgresqlsetup-toolchain,cache, andfetchsteps socargo runcan invoke the E2E runnerspublish_developmentandpublish_releasecache fromcontainer-releasescope toavoid redundant full rebuilds on the same commit
rust:slim-trixie, notdistroless), cache flow, and docker-e2e skip rationale.github/workflows/testing.yamlif:skip condition todocker-e2ejob so it does not run whencontainer.yamlalreadycovers the same trigger (PRs targeting
develop/main; pushes todevelop/main/releases/**)docs/adrs/20260603000000_keep_unit_tests_inside_container_build.md(new)rust:slim-trixievsdistroless/cc-debian13),three-layer defence-in-depth strategy, and rejected alternative
docs/adrs/index.mddocs/issues/open/1854-1840-workflow-performance-container-test-gating/ISSUE.mddocs/issues/open/1854-1840-workflow-performance-container-test-gating/nextest-archive-analysis.md(new)cold-build timing, and resolved open questions
Containerfilecargo nextest archivecalls (debug/release cook-warmup + debug/release archive)now
--excludesix packages:workspace-coupling,torrust-tracker-torrent-repository-benchmarking,torrust-tracker-client,torrust-tracker-contrib-bencode,torrust-tracker-e2e-tools,torrust-tracker-persistence-benchmarkpackages/e2e-tools/(new)torrust-tracker-e2e-toolscrate extracted fromsrc/bin/e2e_tests_runner,profiling,qbittorrent_e2e_runnerpackages/persistence-benchmark/(new)torrust-tracker-persistence-benchmarkcrate extracted frompackages/tracker-core/src/bin/persistence_benchmark_runnerwith fullpersistence_benchmarkmodule treepackages/tracker-core/Cargo.tomltestcontainersmoved from[dependencies]to[dev-dependencies](only needed in tests)project-words.txtalloca,artefacts,bitcode,objcopyStatus
torrust-tracker-clientandtorrust-tracker-contrib-bencodeexcluded)torrust-tracker-e2e-toolsextracted and excluded)torrust-tracker-persistence-benchmarkextracted and excluded;testcontainersto dev-deps)