|
| 1 | +name: Coverage |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + pull_request: |
| 9 | + |
| 10 | +jobs: |
| 11 | + codecov: |
| 12 | + name: Code coverage |
| 13 | + runs-on: ${{ matrix.job.os }} |
| 14 | + timeout-minutes: 90 |
| 15 | + env: |
| 16 | + SCCACHE_GHA_ENABLED: "true" |
| 17 | + RUSTC_WRAPPER: "sccache" |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + job: |
| 22 | + - { os: ubuntu-latest , features: unix, toolchain: nightly } |
| 23 | + - { os: macos-latest , features: macos, toolchain: nightly } |
| 24 | + # FIXME: Re-enable Code Coverage on windows, which currently fails due to "profiler_builtins". See #6686. |
| 25 | + # - { os: windows-latest , features: windows, toolchain: nightly-x86_64-pc-windows-gnu } |
| 26 | + |
| 27 | + env: |
| 28 | + CARGO_INCREMENTAL: "0" |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Install Rust |
| 34 | + run: rustup update stable |
| 35 | + |
| 36 | + - name: Install cargo-llvm-cov |
| 37 | + uses: taiki-e/install-action@cargo-llvm-cov |
| 38 | + |
| 39 | + - name: Install Rust |
| 40 | + run: rustup update stable |
| 41 | + |
| 42 | + - name: llvm-cov show-env |
| 43 | + run: cargo llvm-cov show-env --export-prefix |
| 44 | + |
| 45 | + - name: Build bindingTester |
| 46 | + run: source <(cargo llvm-cov show-env --export-prefix) && cargo build --features=${{ matrix.job.features }} |
| 47 | + |
| 48 | + - name: Test main crate |
| 49 | + run: source <(cargo llvm-cov show-env --export-prefix) && cargo test --features=${{ matrix.job.features }} -p uucore -p coreutils |
| 50 | + |
| 51 | + - name: Generate code coverage |
| 52 | + run: source <(cargo llvm-cov show-env --export-prefix) && cargo llvm-cov report --lcov --output-path lcov.info |
| 53 | + |
| 54 | + - name: Upload coverage to Codecov |
| 55 | + uses: codecov/codecov-action@v3 |
| 56 | + with: |
| 57 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 58 | + files: lcov.info |
| 59 | + fail_ci_if_error: true |
0 commit comments