name: Code Coverage
on:
pull_request:
push:
branches:
- master
jobs:
code-coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v1
- name: Setup yt-dlp PPA
run: sudo add-apt-repository ppa:tomtomtom/yt-dlp
- name: Install yt-dlp
run: sudo apt update && sudo apt install -y yt-dlp
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: llvm-tools-preview
override: true
- name: Install cargo-binstall
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install grcov
run: cargo binstall --no-confirm --force grcov
- name: Install cargo-nextest
run: cargo binstall --no-confirm --force cargo-nextest
- name: Run nextest with coverage instrumentation
run: cargo nextest run --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Cinstrument-coverage --cfg coverage'
LLVM_PROFILE_FILE: 'coverage-%p-%m.profraw'
- name: Run grcov
run: >
grcov .
--binary-path ./target/debug/
--source-dir .
--output-types lcov
--output-path lcov.info
--ignore-not-existing
--llvm
--filter covered
--ignore "*.cargo/*"
--ignore "tests/**"
--excl-start "grcov-excl-start"
--excl-stop "grcov-excl-stop"
--excl-line "grcov-excl-line|#\[derive\(|^\s*\}\s*$|^\s*\)+\?\)*;\s*$"
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
debug: true