ci: move to Nix #253
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: Code Coverage | |
jobs: | |
Codecov: | |
name: Code Coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@v14 | |
- name: Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
# Code Coverage | |
- name: Install grcov | |
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi | |
- name: Test | |
run: nix develop ".#coverage" -L --command cargo test --all-features | |
- name: Make coverage directory | |
run: mkdir coverage | |
- name: Run grcov | |
run: nix develop ".#coverage" -L --command grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --keep-only '**/crates/**' --ignore '**/tests/**' --ignore '**/examples/**' -o ./coverage/lcov.info | |
- name: Generate HTML coverage report | |
run: nix develop ".#coverage" -L --command genhtml -o coverage-report.html --ignore-errors source ./coverage/lcov.info | |
- name: Coveralls upload | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage-report.html |