From c9708e8eb07734e0474e7a20dd1d836e42c310f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ihc=E7=AB=A5=E9=9E=8B=40=E6=8F=90=E4=B8=8D=E8=B5=B7?= =?UTF-8?q?=E5=8A=B2?= Date: Tue, 29 Oct 2024 20:11:24 +0800 Subject: [PATCH] test: fix coverage ci (#316) --- .github/workflows/coverage.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f5238485..80f49576 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -16,9 +16,12 @@ jobs: coverage: name: Run cargo coverage runs-on: ubuntu-latest + environment: coverage + env: + CARGO_TERM_COLOR: always steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install toolchain uses: actions-rs/toolchain@v1 with: @@ -26,16 +29,9 @@ jobs: toolchain: ${{ env.RUST_TOOLCHAIN }} override: true components: llvm-tools-preview - - name: Install grcov - uses: actions-rs/cargo@v1 - with: - command: install - args: grcov - - name: Cache - uses: Swatinem/rust-cache@v1 - - name: Run cargo test - run: sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && sudo -u runner RUSTUP_TOOLCHAIN=nightly RUSTFLAGS="-Cinstrument-coverage" LLVM_PROFILE_FILE="coverage-%p-%m.profraw" /home/runner/.cargo/bin/cargo test --all-features" - - name: Run grcov - run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "*cargo*" -o lcov.info - - name: Upload coverage - run: bash <(curl -s https://codecov.io/bash) -f lcov.info + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Generate code coverage + run: sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && sudo -u runner /home/runner/.cargo/bin/cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info" + - name: Upload coverage to Codecov + run: bash <(curl -s https://codecov.io/bash) -f lcov.info -t ${{ secrets.CODECOV_TOKEN }}