From ee4a6bf7acac31ed81c4bedad7057febca9d2dfa Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 16 Nov 2024 13:02:34 +0100 Subject: [PATCH] try a different approach --- .github/workflows/coverage.yml | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..f221a3b2ca0 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,56 @@ +name: Coverage + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +jobs: + codecov: + name: Code coverage (new) + runs-on: ${{ matrix.job.os }} + timeout-minutes: 90 + + strategy: + fail-fast: false + matrix: + job: + - { os: ubuntu-latest , features: unix, toolchain: nightly } + - { os: macos-latest , features: macos, toolchain: nightly } + # FIXME: Re-enable Code Coverage on windows, which currently fails due to "profiler_builtins". See #6686. + # - { os: windows-latest , features: windows, toolchain: nightly-x86_64-pc-windows-gnu } + env: + CARGO_INCREMENTAL: "0" + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + run: rustup update stable + + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + + - name: Install Rust + run: rustup update stable + + - name: llvm-cov show-env + run: cargo llvm-cov show-env --export-prefix + + - name: Build + run: source <(cargo llvm-cov show-env --export-prefix) && cargo build --features=${{ matrix.job.features }} + + - name: Test main crate + run: source <(cargo llvm-cov show-env --export-prefix) && cargo test --features=${{ matrix.job.features }} -p uucore -p coreutils + + - name: Generate code coverage + run: source <(cargo llvm-cov show-env --export-prefix) && cargo llvm-cov report --lcov --output-path lcov.info + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: lcov.info + fail_ci_if_error: true