Repository navigation
feat(ci): add integration-coverage-upload-as to reusable-ci-rust - #443
Conversation
There was a problem hiding this comment.
Changes requested: coverage mode skips the pre-compile step, which reopens the idle-DB GC race.
Blocking
.github/workflows/reusable-ci-rust.yml:453: Coverage mode reintroduces the idle-DB GC race. Withintegration-coverage-upload-asset,Pre-compile integration test binariesis skipped.Create per-run databasethen runs before any build. The firstcargo llvm-covattempt compiles the whole instrumented test tree (about 10-15 min, per the comment at L441-449) while the freshci_*DB has zero connections. The hourly postgres-ci GC can drop it mid-build, which is the failure the pre-compile step exists to prevent.- Fix: keep one pre-compile step for both modes by using llvm-cov's env-export flow. In coverage mode, run
source <(cargo llvm-cov show-env --export-prefix)andcargo llvm-cov clean --workspace. Then runcargo test --locked --no-run ${INTEGRATION_ARGS%% -- *}before the DB is created. Re-source the env in the test step and keepcargo test --locked $INTEGRATION_ARGSas the runner in the retry loop. Runcargo llvm-cov report --lcov --output-path lcov.infoafter it. Retries then stop rebuilding too. Alternatively, write theshow-envoutput to$GITHUB_ENVonce so later steps inherit it.
- Fix: keep one pre-compile step for both modes by using llvm-cov's env-export flow. In coverage mode, run
Minor
.github/workflows/reusable-ci-rust.yml:496: Third copy of the lcov rebase awk. TheSF:rebase awk and the upload step are now pasted verbatim in the test, coverage and integration jobs. The repo already ships composite actions under.github/actions(e.g.setup-sccache), so a fix to the rebase logic now has to be made in three places. Consider a.github/actions/rebase-upload-lcovcomposite action (inputs: lcov path, base dir, artifact name), in this PR or a follow-up.
The rest of the wiring (components, install, rebase, upload) mirrors the unit-coverage path and looks correct.
|
Coverage mode now pre-compiles through llvm-cov's show-env flow before the DB is created, runs cargo test in the retry loop, and generates the lcov with llvm-cov report afterwards. |
There was a problem hiding this comment.
Approve. Integration coverage follows the job's existing llvm-cov, rebase and upload pattern. cargo llvm-cov show-env is sourced in both the pre-compile step and the test step, so the instrumented binaries are reused and not rebuilt. I found one minor issue and two suggestions. None of them blocks the merge.
Minor
.github/workflows/reusable-ci-rust.yml:499: a failedcargo llvm-cov reportis swallowed, and the job then fails in the next step. The test step runs underset -uo pipefailwithout-e, so a failing report command still reachesexit 0. The "Rebase integration lcov to repo root" step has nocontinue-on-error, so it then fails on the missinglcov.info. The gate goes red with a misleading error, even though the upload is meant to be a side output that must not fail the gate. Fix: usecargo llvm-cov report --lcov --output-path lcov.info || echo "::warning::integration coverage report failed"and guard the rebase step with[ -f lcov.info ] || exit 0. Or mark the rebase stepcontinue-on-error, as the upload step already is.
Suggestions
.github/workflows/reusable-ci-rust.yml:514: the lcov rebase awk is now copied in two places. It is identical to the program in the test job's "Rebase lcov to repo root" step (line 329), so a fix to one copy can miss the other. Optionally move it into a small script or a local composite action and call it from both jobs..github/workflows/reusable-ci-rust.yml:529: nothing stops the two coverage artifacts from sharing a name. If a caller setscoverage-upload-asandintegration-coverage-upload-asto the same value, upload-artifact v4+ rejects the second upload.continue-on-errorthen hides the failure and one lcov is silently lost. Say in the input description that the name must differ fromcoverage-upload-as.
DB-backed tests are
#[ignore]d, so the llvm-cov coverage job never executes them and SonarQube sees 0% on every route handler they exercise (FerrTrack-Cloud, FerrLabs/FerrTrack-Cloud#954).New optional input
integration-coverage-upload-as. When set, the integration step runs throughcargo llvm-covinstead ofcargo test, and its lcov is rebased to the repo root and uploaded as an artifact with that name. SonarQube merges it with the unit-test report. Default empty: behaviour unchanged.