Skip to content

Coverage workflow fix and improvement #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@ jobs:
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
RUSTFLAGS: "-C instrument-coverage -C codegen-units=1 -C inline-threshold=0 -C link-dead-code -C overflow-checks=off -C panic=abort -Zpanic_abort_tests"
RUSTDOCFLAGS: "-C instrument-coverage -C codegen-units=1 -C inline-threshold=0 -C link-dead-code -C overflow-checks=off -C panic=abort -Zpanic_abort_tests"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"

steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4

# Setup Rust nightly
# Setup Rust nightly
- name: Install Rust
uses: actions-rs/toolchain@v1
id: toolchain
uses: hecrj/setup-rust-action@v1
with:
toolchain: nightly
override: true
rust-version: nightly

# Configure cache for Cargo
- name: Cache Cargo registry, index
Expand All @@ -44,18 +43,22 @@ jobs:

# Run tests with all features
- name: Test (cargo test)
uses: actions-rs/cargo@v1
with:
command: test
args: "--workspace"
run: cargo test --workspace

# Install grcov
- uses: actions-rs/[email protected]
id: coverage
- name: Install grcov
run: cargo install grcov --force

- name: Generate lcov report
run: |
grcov . \
--ignore-not-existing \
-o lcov.info


# Upload to Codecov.io
- name: Upload to Codecov.io
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ steps.coverage.outputs.report }}
file: lcov.info