diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 617f7e793..eccad310e 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -79,12 +79,12 @@ jobs: key: test-${{ runner.os }}-cargo-gcc-${{ matrix.gcc }}-clang-${{ matrix.clang }}-${{ hashFiles('**/Cargo.lock') }} - name: Build env: - RUSTFLAGS: -Zinstrument-coverage + RUSTFLAGS: -Cinstrument-coverage run: cargo build - name: Test env: LLVM_PROFILE_FILE: grcov-%p-%m.profraw - RUSTFLAGS: -Zinstrument-coverage + RUSTFLAGS: -Cinstrument-coverage run: cargo test - name: Generate coverage run: | diff --git a/README.md b/README.md index 036942889..8473d08e9 100644 --- a/README.md +++ b/README.md @@ -159,9 +159,6 @@ you can run `cargo install grcov`. ## Usage -**Nightly Rust is required** to use grcov for Rust coverage. Alternatively, you can `export -RUSTC_BOOTSTRAP=1`, which basically turns your stable rustc into a Nightly one. - ### Example: How to generate source-based coverage for a Rust project 1. Install the llvm-tools or llvm-tools-preview component: @@ -173,7 +170,7 @@ RUSTC_BOOTSTRAP=1`, which basically turns your stable rustc into a Nightly one. 2. Ensure that the following environment variable is set up: ```sh - export RUSTFLAGS="-Zinstrument-coverage" + export RUSTFLAGS="-Cinstrument-coverage" ``` 3. Build your code: @@ -198,6 +195,9 @@ Pass `--coverage` to `clang` or `gcc` (or for older gcc versions pass `-ftest-co ### Example: How to generate .gcda files for a Rust project +**Nightly Rust is required** to use grcov for Rust gcov-based coverage. Alternatively, you can `export +RUSTC_BOOTSTRAP=1`, which basically turns your stable rustc into a Nightly one. + 1. Ensure that the following environment variables are set up: ```sh @@ -265,11 +265,11 @@ before_install: matrix: include: - os: linux - rust: nightly + rust: stable script: - rustup component add llvm-tools-preview - - export RUSTFLAGS="-Zinstrument-coverage" + - export RUSTFLAGS="-Cinstrument-coverage" - cargo build --verbose - LLVM_PROFILE_FILE="your_name-%p-%m.profraw" cargo test --verbose - ./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info @@ -287,7 +287,7 @@ before_install: matrix: include: - os: linux - rust: nightly + rust: stable script: - export CARGO_INCREMENTAL=0