name: Rust

on:
  push:
    branches: [ "**" ]
  pull_request:
    branches: [ "main" ]

env:
  CARGO_TERM_COLOR: always

jobs:

  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Clippy
      run: |
        cargo clippy
        cargo clippy --no-default-features
        cargo clippy --no-default-features --features="alloc"
    - name: Build
      run: |
        cargo build --verbose
        cargo build --verbose --no-default-features
        cargo build --verbose --no-default-features --features="alloc"
    - name: Run tests
      run: |
        cargo test
        cargo test --examples

  miri:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Install Miri
        run: |
          rustup component add --toolchain nightly-2026-04-18 miri
          cargo miri setup
      - name: Test with Miri
        run: cargo miri test --all-targets -- --skip compile_fail_tests
