name: Miri

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always
  MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-disable-isolation

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
  miri:
    name: miri (abi_unit)
    runs-on: ubuntu-latest
    # Cranelift's JIT path can't execute under Miri (FFI + generated machine
    # code). The `abi_unit` integration test only exercises the type-level
    # `JitParam` mapping with no JIT invocation, so we scope Miri to it.
    continue-on-error: true
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: miri
      - uses: Swatinem/rust-cache@v2
      - run: cargo miri setup
      - run: cargo miri test --test abi_unit
