on: [push, pull_request]

name: Continuous integration

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.74.0
        with:
          components: rustfmt
      - uses: Swatinem/rust-cache@v2
      - run: cargo fmt -- --check
      - run: cargo test
      - run: cargo bench
  miri:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust
        run: rustup toolchain install nightly --component miri && rustup default nightly
      - run: cargo miri test
        env:
          MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-disable-isolation
          RUSTFLAGS: ${{ env.RUSTFLAGS }} -Z randomize-layout
