-
Notifications
You must be signed in to change notification settings - Fork 149
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
readme: example uses -Zprofile
which has been removed from Rust nightly
#1240
Comments
Thanks, we should update the README to remove the mention to "-Zprofile". |
Could anyone tell me what the solution is? It seems it does not work if I remove the Original:
I've tried without the
|
@josecelano the solution is using source-based coverage, as described at https://github.com/mozilla/grcov?tab=readme-ov-file#example-how-to-generate-source-based-coverage-for-a-rust-project. |
Thank you @marco-c; I'm trying to upload the generated report to codecov.io. I'm trying to figure out how to update my GitHub workflows. I'm just posting this here in case other people have the same problem. I haven't found the solution yet. I was using the https://github.com/marketplace/actions/grcov-for-rust action to generate the coverage report and upload it to codecov with a workflow similar to this: name: Coverage
on:
push:
branches:
- develop
env:
CARGO_TERM_COLOR: always
jobs:
report:
name: Report
environment: coverage
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
steps:
- id: setup
name: Setup Toolchain
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
components: llvm-tools-preview
- id: tools
name: Install Tools
uses: taiki-e/install-action@v2
with:
tool: grcov
- id: coverage
name: Generate Coverage Report
uses: alekitto/[email protected]
- id: upload
name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ steps.coverage.outputs.report }}
verbose: true
fail_ci_if_error: true The "alekitto/grcov" hasn't been updated for a while and I don't know what type of artefacts generating. Snice the action seems to be unmantained I'm trying to generate the report info manually with a workflow like this: name: Coverage V2
on:
push:
branches:
- develop
env:
CARGO_TERM_COLOR: always
jobs:
report:
name: Report
environment: coverage
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- id: setup
name: Setup Toolchain
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
components: llvm-tools-preview
- id: cache
name: Enable Workflow Cache
uses: Swatinem/rust-cache@v2
- id: tools
name: Install Tools
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- id: coverage
name: Generate Coverage Report
run: |
mkdir .coverage
cargo llvm-cov --lcov --output-path=./.coverage/lcov.info
- id: upload
name: Upload Coverage Report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./.coverage/lcov.info
verbose: true
fail_ci_if_error: true But I don't know why I needed |
We used to rely on `-Zprofile`, but it was recently removed from Rust Nightly: rust-lang/rust#131829 This commit switches to a stable alternative; cf. mozilla/grcov#1240 This change is accompanied by a change in the build environment: instead of using Clang 18 with Rust Nightly, we now use Clang 18 with Rust 1.81. That's the last Rust version based on LLVM 18. Previously we tried to match LLVM versions between C++ and Rust to avoid weird coverage results. Now, it's *required* to match them, otherwise no coverage is gathered at all. Fixes #2912.
Example: How to generate .gcda files for a Rust project in the readme uses
-Zprofile
which has been removed recently from Rust nightly (see rust-lang/rust#131829).The text was updated successfully, but these errors were encountered: