sax 1.0.0

A simple but smart archiving and extraction tool.
name: CI

on:
  pull_request:
    branches:
      - main

permissions:
  contents: read

jobs:
  test:
    name: test
    runs-on: ubuntu-latest

    steps:
      - name: Checkout pull request branch
        uses: actions/checkout@v6
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0

      - name: Verify branch is rebased onto main
        run: |
          git fetch origin "$GITHUB_BASE_REF"
          git merge-base --is-ancestor "origin/$GITHUB_BASE_REF" HEAD

          if git rev-list --min-parents=2 "origin/$GITHUB_BASE_REF..HEAD" | grep -q .; then
            echo "Pull request branches must not contain merge commits."
            exit 1
          fi

      - name: Install stable Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt

      - name: Restore Rust build cache
        uses: Swatinem/rust-cache@v2

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

      - name: Lint
        run: cargo clippy --locked -- -D warnings

      - name: Test
        run: cargo test --locked