mirror of
https://github.com/ClementTsang/bottom.git
synced 2026-05-03 21:40:32 +00:00
fec56372bb
Use one single skip check job for CI like other workflows.
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
# Code coverage generation via cargo-llvm-cov, which is then uploaded to codecov.
|
|
|
|
name: codecov
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
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@f11521568414503656a5af807dc3018c012552c4 # v5.2.0
|
|
with:
|
|
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@ba37adf8f94a7d9affce79bd3baff1b9e3189c33 # https://github.com/dtolnay/rust-toolchain/commit/ba37adf8f94a7d9affce79bd3baff1b9e3189c33
|
|
with:
|
|
toolchain: stable
|
|
|
|
- name: Enable Rust cache
|
|
uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1
|
|
|
|
- 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@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # 3.1.1
|
|
with:
|
|
files: lcov.info
|
|
fail_ci_if_error: true
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|