| name: Coverage | |
| on: [pull_request, push] | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| CI: 1 | |
| RUST_BACKTRACE: short | |
| RUSTUP_MAX_RETRIES: 10 | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup update --no-self-update nightly | |
| rustup default nightly | |
| rustup component add --toolchain nightly rust-src rustc-dev rustfmt | |
| # We also install a nightly rustfmt, because we use `--file-lines` in | |
| # a test. | |
| rustup toolchain install nightly --profile minimal --component rustfmt | |
| rustup toolchain install nightly --component llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - name: Install nextest | |
| uses: taiki-e/install-action@nextest | |
| - name: Generate code coverage | |
| run: cargo llvm-cov --workspace --lcov --output-path lcov.info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| with: | |
| files: lcov.info | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true |