name: Build
on:
push:
pull_request:
jobs:
build-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup Cache uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/debug/deps/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Cargo Hack Check
run: cargo hack check --feature-powerset --mutually-exclusive-features no_std,default --lib --tests --examples
- name: Cargo Hack Test
run: cargo hack test --feature-powerset --mutually-exclusive-features no_std,default
build-on-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Setup Cache uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/debug/deps/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Cargo Hack Check
run: cargo hack check --feature-powerset --mutually-exclusive-features no_std,default --lib --tests --examples
- name: Cargo Hack Test
run: cargo hack test --feature-powerset --mutually-exclusive-features no_std,default
build-on-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustc, rust-std, cargo, clippy, llvm-tools, llvm-tools-preview
- name: Install grcov
uses: baptiste0928/cargo-install@v3
with:
crate: grcov
- name: Setup Cache uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/debug/deps/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo
- name: Linting run: cargo clippy --all-targets --all-features -- -Dwarnings
- name: Update dependencies run: cargo update
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Cargo Hack Check
run: cargo hack check --feature-powerset --mutually-exclusive-features no_std,default --lib --tests --examples
- run: mkdir -p ./target/debug/coverage
- name: Cargo Hack Test
run: cargo hack test --feature-powerset --mutually-exclusive-features no_std,default
env:
CARGO_INCREMENTAL: '0'
LLVM_PROFILE_FILE: 'target/debug/coverage/dcaf-%p-%m.profraw'
RUSTFLAGS: '-Cinstrument-coverage -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-C instrument-coverage -Cpanic=abort -Zpanic_abort_tests -Z unstable-options --persist-doctests target/debug/'
- run: zip ./target/debug/coverage/files.zip ./target/debug/coverage/dcaf-*.profraw
- run: grcov ./target/debug/coverage/files.zip -s . --binary-path ./target/debug/ --service-name "Continous Integration" --commit-sha ${GITHUB_SHA} -t lcov --branch --ignore-not-existing -o ./lcov.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}