Files
smart-rgb/.github/workflows/coverage.yml
2025-10-25 16:15:50 -05:00

67 lines
2.1 KiB
YAML

name: Coverage
on:
- push
env:
CARGO_TERM_COLOR: always
RUST_VERSION: "nightly"
jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: x86_64-unknown-linux-gnu
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Cache apt packages
uses: actions/cache@v4
with:
path: |
/var/cache/apt/archives/*.deb
key: ubuntu-latest-apt-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
ubuntu-latest-apt-
- name: Install Linux dependencies
run: |
sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends \
build-essential \
libglib2.0-dev \
libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
patchelf
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Run tests with coverage
run: cargo llvm-cov nextest --workspace --no-fail-fast
- name: Generate coverage reports
run: |
mkdir -p coverage
cargo llvm-cov report --html --output-dir coverage/html
cargo llvm-cov report --json --output-path coverage/coverage.json
cargo llvm-cov report --lcov --output-path coverage/lcov.info
- name: Upload HTML coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: coverage/html
retention-days: 7
- name: Upload JSON coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-json
path: coverage/coverage.json
retention-days: 7
- name: Upload LCOV coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-lcov
path: coverage/lcov.info
retention-days: 7