name: Check and Test
on:
push:
schedule:
- cron: 0 0 * * *
jobs:
check:
name: Check the code
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
rust: [stable, beta]
steps:
- name: Install the appropriate Rust toolchain
run: |
rustup toolchain install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
- uses: actions/checkout@v1
- name: Run rustfmt
run: |
rustup component add rustfmt
cargo fmt --all -- --check
- name: Run clippy
run: |
rustup component add clippy
cargo clippy --workspace --all-features --all-targets -- -D clippy::all -W clippy::cargo -W clippy::pedantic -W clippy::cognitive-complexity
test:
name: Test the code
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
rust: [stable, beta, nightly]
steps:
- name: Install the appropriate Rust toolchain
run: |
rustup toolchain install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
- uses: actions/checkout@v1
- name: Run cargo test
run: |
cargo test --workspace --all-features --all-targets --no-fail-fast
coverage:
name: Measure test coverage
runs-on: ubuntu-20.04
strategy:
matrix:
rust: [nightly]
steps:
- name: Install the appropriate Rust toolchain
run: |
rustup toolchain install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
- uses: actions/checkout@v1
- name: Run tests with profiling
run: |
cargo test --workspace --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: >
-Zprofile
-Ccodegen-units=1
-Copt-level=0
-Clink-dead-code
-Coverflow-checks=off
-Zpanic_abort_tests
-Cpanic=abort
RUSTDOCFLAGS: '-Cpanic=abort'
- uses: actions-rs/grcov@v0.1
with:
config: .grcov.yml
- name: Upload coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash) -X gcov
- uses: actions/upload-artifact@v1
with:
name: lcov.info
path: ./lcov.info