bottom/.github/workflows/coverage.yml
Clement Tsang 6468f8af58
ci: lock cross to 0.2.1 on CI as well (#756)
Locks CI to cross 0.2.1.
2022-06-25 23:03:14 -04:00

58 lines
1.9 KiB
YAML

# Code coverage generation via cargo-tarpaulin, and uploaded to codecov.
name: codecov
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
env:
CARGO_INCREMENTAL: 0
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@38c3738dcac87b41e2b7038775457756c793566e # https://github.com/fkirc/skip-duplicate-actions/commit/38c3738dcac87b41e2b7038775457756c793566e
with:
concurrent_skipping: "same_content_newer"
skip_after_successful_duplicate: "false"
paths: '["tests/**", "src/**", ".github/workflows/coverage.yml", ".cargo/**", "Cargo.toml", "Cargo.lock", "build.rs"]'
do_not_skip: '["workflow_dispatch", "push"]'
coverage:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@88e7c2e1da2693cf72d58fce9416206818e61dea # https://github.com/dtolnay/rust-toolchain/commit/88e7c2e1da2693cf72d58fce9416206818e61dea
with:
toolchain: stable
- name: Enable Rust cache
uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # 1.4.0
- name: Install cargo-llvm-cov
run: |
rustup component add llvm-tools-preview
cargo install cargo-llvm-cov --version 0.4.8 --locked
- name: Generate code coverage
run: |
cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload to codecov.io
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # 2.1.0
with:
files: lcov.info
fail_ci_if_error: true