name: Rust
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
concurrency:
group: rust-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
actions: read
jobs:
test:
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
fail-fast: false
runs-on: ubuntu-22.04
name: "Rust ${{ matrix.toolchain }} tests"
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
steps:
- name: Checkout the project
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Setup rust cache
uses: Swatinem/rust-cache@2656b87321093db1cb55fbd73183d195214fdfd1 with:
key: ${{ matrix.toolchain }}
- name: Install rust ${{ matrix.toolchain }} toolchain
run: rustup toolchain add ${{ matrix.toolchain }} ${{ matrix.toolchain == 'stable' && '--component=clippy' || '' }}
- name: Check rust is formatted
if: ${{ matrix.toolchain == 'stable' }}
run: cargo fmt --check
- name: Check clippy
if: ${{ matrix.toolchain == 'stable' }}
run: cargo clippy --all-features --all-targets
- name: Execute cargo tests
env:
PROPTEST_CASES: 10000
run: cargo +${{ matrix.toolchain }} test --verbose --all-features