name: ci

on:
  push:
    branches: [ main, master ]
  pull_request:
    branches: [ main, master ]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - name: check
        run: cargo check --all-targets --all-features
      - name: test
        run: cargo test --all-features
      - name: run example assertions
        run: cargo run --example soft_rank_shootout
      - name: fmt
        run: cargo fmt --all -- --check
      - name: clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Semver check
        if: github.event_name == 'pull_request'
        run: |
          cargo install cargo-semver-checks --locked || true
          cargo semver-checks
