name: ci

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

jobs:
  rust:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt

      - name: Check formatting
        run: cargo fmt --check

      - name: Run tests
        run: cargo test

      - name: Build docs
        run: cargo doc --no-deps

      - name: Check package contents
        run: cargo package --allow-dirty --list
