From 95b826e9dce969ae1150611958dfcf68e88f1867 Mon Sep 17 00:00:00 2001 From: jtmoon79 <815261+jtmoon79@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:09:31 -0700 Subject: [PATCH] change code coverage from grcov to cargo-llvm-cov --- .github/workflows/codecov.yml | 25 +++++++++ .github/workflows/grcov.yml | 103 ---------------------------------- 2 files changed, 25 insertions(+), 103 deletions(-) create mode 100644 .github/workflows/codecov.yml delete mode 100644 .github/workflows/grcov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000000..f080f254a5 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,25 @@ +name: codecov +on: + push: + branches: [main, 0.4.x] + pull_request: +jobs: + # Run code coverage using cargo-llvm-cov then upload to codecov.io + job_code_coverage: + name: llvm-cov + runs-on: ubuntu-latest + env: + CARGO_TERM_COLOR: always + steps: + - uses: actions/checkout@v3 + - name: Install Rust + run: rustup update stable + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Generate code coverage + run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: lcov.info + fail_ci_if_error: true diff --git a/.github/workflows/grcov.yml b/.github/workflows/grcov.yml deleted file mode 100644 index 97422d0334..0000000000 --- a/.github/workflows/grcov.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: grcov -on: - push: - branches: [main, 0.4.x] - pull_request: -jobs: - # Run code coverage with rust "stable" then upload code coverage result to - # codecov.io - # Help from: - # - https://github.com/marketplace/actions/rust-grcov - # - https://eipi.xyz/blog/rust-code-coverage-with-github-workflows/ - # - https://github.com/mozilla/grcov/blob/v0.8.18/README.md#example-how-to-generate-gcda-files-for-a-rust-project - # - https://github.com/mozilla/grcov/blob/v0.8.18/README.md#lcov-output - job_grcov: - name: grcov - runs-on: ubuntu-latest - steps: - - name: git checkout - uses: actions/checkout@v3 - - name: get toolchain stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: cargo install - uses: actions-rs/cargo@v1 - with: - command: install - args: -- rustfilt grcov - - name: cargo build with special profiling - uses: actions-rs/cargo@v1 - env: - CARGO_INCREMENTAL: 0 - RUSTC_BOOTSTRAP: 1 - RUSTDOCFLAGS: -Cpanic=abort - RUSTFLAGS: -Zprofile - -Ccodegen-units=1 - -Copt-level=0 - -Clink-dead-code - -Coverflow-checks=off - -Zpanic_abort_tests - -Cpanic=abort - with: - command: build - - name: cargo test with special profiling - uses: actions-rs/cargo@v1 - env: - CARGO_INCREMENTAL: 0 - RUSTC_BOOTSTRAP: 1 - RUSTDOCFLAGS: -Cpanic=abort - RUSTFLAGS: -Zprofile - -Ccodegen-units=1 - -Copt-level=0 - -Clink-dead-code - -Coverflow-checks=off - -Zpanic_abort_tests - -Cpanic=abort - with: - command: test - args: --no-fail-fast --all-targets - - name: grcov - shell: bash - env: - CARGO_INCREMENTAL: 0 - RUSTC_BOOTSTRAP: 1 - RUSTDOCFLAGS: -Cpanic=abort - RUSTFLAGS: -Zprofile - -Ccodegen-units=1 - -Copt-level=0 - -Clink-dead-code - -Coverflow-checks=off - -Zpanic_abort_tests - -Cpanic=abort - run: | - set -eux - grcov --version - grcov \ - . \ - --source-dir ./src \ - --log-level DEBUG \ - --llvm \ - --binary-path ./target/debug/ \ - --branch \ - --ignore-not-existing \ - --output-type lcov \ - --output-path lcov.info - # print output for manual sanity check of lcov.info file - ls -l - head lcov.info - # action from https://github.com/codecov/codecov-action - - name: upload codecov - uses: codecov/codecov-action@v3 - with: - files: lcov.info - verbose: true - fail_ci_if_error: true - # public repository does not need secret section `with: token` - # see - # https://about.codecov.io/blog/javascript-code-coverage-using-github-actions-and-codecov/ - # - # list of acceptable formats: - # https://docs.codecov.com/docs/supported-report-formats