From bca84ba65df2963cfe2bc4e1305972b195f44cab Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 13 Nov 2024 10:29:13 +0100 Subject: [PATCH] ci: use -Cinstrument-coverage instead of -Zprofile and use cargo-llvm-cov instead of grcov. Support for -Zprofile has been removed from Rust nightly: https://github.com/rust-lang/rust/pull/131829 --- .github/workflows/ci.yml | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6231caf..960f266a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,49 +105,23 @@ jobs: - name: Install `rust` toolchain run: | - ## Install `rust` toolchain rustup toolchain install nightly --no-self-update -c rustfmt --profile minimal rustup default nightly - - name: "`grcov` ~ install" - run: cargo install grcov - - - name: cargo test - run: | - cargo test --all --no-fail-fast ${{ matrix.cargo_flags }} - env: - CARGO_INCREMENTAL: "0" - RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -Cdebug-assertions=off" - RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -Cdebug-assertions=off" + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Generate code coverage + run: cargo llvm-cov --all-features --lcov --branch --output-path lcov.info - - name: Generate coverage data - id: grcov - run: | - grcov target/debug/ \ - --branch \ - --llvm \ - --source-dir . \ - --output-path lcov.info \ - --ignore-not-existing \ - --excl-line "#\\[derive\\(" \ - --excl-br-line "#\\[derive\\(" \ - --excl-start "#\\[cfg\\(test\\)\\]" \ - --excl-br-start "#\\[cfg\\(test\\)\\]" \ - --commit-sha ${{ github.sha }} \ - --service-job-id ${{ github.job }} \ - --service-name "GitHub Actions" \ - --service-number ${{ github.run_id }} - name: Upload coverage as artifact uses: actions/upload-artifact@v4 with: name: lcov.info - # path: ${{ steps.grcov.outputs.report }} path: lcov.info - name: Upload coverage to codecov.io uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} - # file: ${{ steps.grcov.outputs.report }} file: lcov.info fail_ci_if_error: true