name: Test
on:
push:
branches:
- master
- ci/*
pull_request:
branches:
- master
jobs:
tests:
name: Test ${{ matrix.os }}
strategy:
matrix:
os: ["windows-latest", "macos-latest", "ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the code
uses: actions/checkout@v5
- name: Install Rust
run: rustup toolchain add --profile=minimal stable
- name: Install system libs
run: sudo apt-get install libusb-1.0-0-dev libudev-dev
if: runner.os == 'Linux'
- name: Build
run: cargo build --all --release
env:
RUST_BACKTRACE: "1"
- name: Test
run: cargo test --all --release
env:
RUST_BACKTRACE: "1"
coverage:
name: Coverage Report
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v5
- name: Install grcov
run: |
wget https://github.com/mozilla/grcov/releases/download/v0.10.5/grcov-x86_64-unknown-linux-gnu.tar.bz2
tar -xvf grcov-x86_64-unknown-linux-gnu.tar.bz2
rustup component add llvm-tools
- name: Install system libs
run: sudo apt-get install libusb-1.0-0-dev libudev-dev
- name: Test
run: cargo test --no-fail-fast --all-features
env:
CARGO_INCREMENTAL: '0'
LLVM_PROFILE_FILE: "emerald-hwkey-%p-%m.profraw"
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cpanic=abort'
- name: Coverage Report
run: ./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
- name: Upload to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info