Skip to content

Commit

Permalink
ci: use -Cinstrument-coverage instead of -Zprofile
Browse files Browse the repository at this point in the history
and use cargo-llvm-cov instead of grcov.

Support for -Zprofile has been removed from Rust nightly: rust-lang/rust#131829
  • Loading branch information
cakebaker committed Nov 13, 2024
1 parent 50b7ec6 commit bca84ba
Showing 1 changed file with 4 additions and 30 deletions.
34 changes: 4 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bca84ba

Please sign in to comment.