name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: build_and_test_${{ github.head_ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build_and_test:
strategy:
matrix:
include:
- name: Ubuntu amd64 - Release
runner: ubuntu-24.04
cargo_flags: --release
- name: Ubuntu amd64 - Debug
runner: ubuntu-24.04
cargo_flags:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.runner }} - ${{ matrix.cargo_flags }}
- name: Install cargo-hack
run: cargo install cargo-hack --version 0.5.8
- name: Check `cargo fmt` was run
run: cargo fmt --all -- --check
- name: Ensure that all crates compile and have no warnings under every possible combination of features
run: cargo hack --feature-powerset clippy --all-targets --locked ${{ matrix.cargo_flags }} -- -D warnings
- name: Ensure that tests pass
run: cargo test ${{ matrix.cargo_flags }} --all-features -- --include-ignored --show-output --nocapture
- name: Ensure that tests did not create or modify any files that arent .gitignore'd
run: |
if [ -n "$(git status --porcelain)" ]; then
git status
exit 1
fi