name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
features: [ "", "arrayvec", "heapless", "vec" ]
rust: [ "nightly", "nightly-2023-05-31" ]
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Build
run: cargo build --verbose --no-default-features ${{ matrix.features == '' && ' ' || format('--features {0}', matrix.features) }}
- name: Run tests
run: cargo test --verbose --no-default-features ${{ matrix.features == '' && ' ' || format('--features {0}', matrix.features) }}
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: llvm-tools-preview
- name: Install Grcov
run: curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -
- name: Run tests
run: |
export RUSTFLAGS="-Cinstrument-coverage"
cargo build --verbose --features "vec arrayvec heapless"
LLVM_PROFILE_FILE="shares-%p-%m.profraw" cargo test --verbose
./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
bash <(curl -s https://codecov.io/bash) -f lcov.info