name: Rust
on:
push:
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose --all-features
env:
RUSTFLAGS: '-C instrument-coverage -C codegen-units=1 -C inline-threshold=0 -Coverflow-checks=off'
- name: Run tests
run: cargo test --verbose
env:
RUSTFLAGS: '-C instrument-coverage -C codegen-units=1 -C inline-threshold=0 -Coverflow-checks=off'
- name: Install llvm tools
run: |
rustup component add llvm-tools-preview
- name: Download grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.18/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Generate coverage report
run: |
mkdir -p "./target/coverage"
grcov . --binary-path target/debug/deps -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o "./target/coverage/tests.lcov"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: ThatRedox/mcp4725-async
directory: ./target/coverage/
verbose: true