Repository navigation
Conversation
There was a problem hiding this comment.
Code Review: .github/workflows/coverage.yml
Overall this is a clean, idiomatic workflow. A few issues and suggestions below.
Issues
-
Coveralls upload on
pull_requestfrom forks (GITHUB_TOKEN/ secrets) — Mediumcoverallsapp/github-action@v2requires a token to upload.GITHUB_TOKENworks for pushes but may behave inconsistently on PRs from forks (secrets are not exposed to fork PRs by default). Recommend guarding the upload step or usingpull_request_target/COVERALLS_REPO_TOKENas appropriate:- name: Upload to Coveralls if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false uses: coverallsapp/github-action@v2 with: file: ./lcov.info format: lcov github-token: ${{ secrets.GITHUB_TOKEN }}
-
Coveralls
parallel/flag-namenot set — Low- With a single job this is fine, but if coverage is ever split across jobs you'll need
parallel: true+flag-nameand acoverallsapp/github-action@v2finalizer (carryforward/finish). Worth a comment for future maintainers.
- With a single job this is fine, but if coverage is ever split across jobs you'll need
-
--all-featurescoverage cost — Informationalcargo llvm-cov --workspace --all-featurescan be slow and may fail if mutually exclusive features exist. Confirm no conflicting features; otherwise consider--no-default-features --features ci.
-
fetch-depth: 0— Nit- Typically needed for accurate line/changed-code coverage (Coveralls computes diff vs. base). Good that you included it — no change needed, just noting it's intentional.
-
Missing
concurrencygroup — Low- Multiple PR pushes will queue duplicate runs. Consider:
concurrency: group: coverage-${{ github.ref }} cancel-in-progress: true
- Multiple PR pushes will queue duplicate runs. Consider:
-
Pin installer action to a version — Low
taiki-e/install-action@cargo-llvm-covis pinned by tool name, which is acceptable, but consider@v2plustool: cargo-llvm-covfor explicit version pinning and reproducibility:- uses: taiki-e/install-action@v2 with: tool: cargo-llvm-cov
-
LCOV upload path — Nit
file: ./lcov.infovs.output-path lcov.info— consistent, but prefer a workspace-relative path without./to avoid ambiguity (lcov.info).
-
No artifact retention of
lcov.info— Nit- Optional: add
actions/upload-artifacton failure/always so reviewers can inspect coverage locally if Coveralls upload fails.
- Optional: add
Style / consistency
envvalues as bare scalars (RUST_BACKTRACE: 1) are fine, though some linters (actionlint/yamllint) prefer strings. Not a blocker.permissions: contents: readis good and least-privilege for checkout.- Job timeout (60 min) and cache key (
shared-key: coverage) look reasonable.
No issues found in
- Branch triggers,
workflow_dispatch, toolchain component (llvm-tools-preview), cache strategy, and general structure are correct.
Summary
| Severity | Item |
|---|---|
| Medium | Coveralls upload token behavior on fork PRs — add if: guard |
| Low | Add concurrency to cancel stale runs |
| Low | Pin taiki-e/install-action to a version |
| Nit | Normalize lcov.info path; consider artifact upload |
Summary of changes
Medium severity1. Coveralls upload token behavior on pull requests from forksStatus: fixed (guard added); Secrets are not exposed to workflows triggered by if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
Tradeoff: coverage is currently not reported for fork PRs. Same-repository PRs Low severity2. Coveralls parallel jobs /
|
Measure workspace test coverage with cargo-llvm-cov and upload the resulting LCOV report to Coveralls. - Run on push to main and pull_request targeting main, plus workflow_dispatch. - Use --workspace --all-features to match the test suite in test.yml. - Install llvm-tools-preview and cargo-llvm-cov via taiki-e/install-action. - Cache cargo/target with Swatinem/rust-cache (shared-key: coverage). - Authenticate to Coveralls with GITHUB_TOKEN; the job fails if upload fails.
9f7809e to
380e202
Compare
Measure workspace test coverage with cargo-llvm-cov and upload the resulting LCOV report to Coveralls.