sim-shape 0.2.2

Shape algebra, comparison, and match-hook helpers.
Documentation
# GitHub Actions CI for this crate.
name: ci
on:
  pull_request: {}
  push:
    branches: [main]

concurrency:
  group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

permissions:
  contents: read
  pull-requests: read

jobs:
  scope:
    name: select validation scope
    runs-on: ubuntu-latest
    outputs:
      run-heavy: ${{ steps.scope.outputs.run-heavy }}
    steps:
      - id: scope
        name: Avoid duplicate PR and main validation
        env:
          GH_TOKEN: ${{ github.token }}
          EVENT_NAME: ${{ github.event_name }}
          REPOSITORY: ${{ github.repository }}
          PR_NUMBER: ${{ github.event.pull_request.number }}
        run: |
          run_heavy=true
          if [ "$EVENT_NAME" = pull_request ]; then
            sleep 15
            state="$(gh api "repos/$REPOSITORY/pulls/$PR_NUMBER" --jq .state)"
            sole="$(gh api "repos/$REPOSITORY/pulls/$PR_NUMBER" \
              --jq 'any(.labels[]; .name == "roadmap-sole-contributor")')"
            if [ "$state" != open ] || [ "$sole" = true ]; then
              run_heavy=false
            fi
          fi
          echo "run-heavy=$run_heavy" >> "$GITHUB_OUTPUT"

  heavy:
    name: heavy validation
    needs: scope
    if: ${{ needs.scope.outputs.run-heavy == 'true' }}
    runs-on: ubuntu-latest
    env:
      SIMDOC_TOOLING_MANIFEST: ${{ github.workspace }}/sim-tooling/Cargo.toml
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha || github.sha }}
      - uses: actions/checkout@v4
        with:
          repository: sim-nest/sim-tooling
          # Keep standalone CI reproducible. A moving tooling checkout can make
          # an unchanged repository fail after its exact head was validated.
          ref: 2d69cd37629c072210b2b166d4451ce139b201e8
          path: sim-tooling
      - id: toolchain
        shell: bash
        run: |
          channel="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
          if [ -z "$channel" ]; then
            echo "missing rust-toolchain.toml channel" >&2
            exit 1
          fi
          echo "channel=$channel" >> "$GITHUB_OUTPUT"
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ steps.toolchain.outputs.channel }}
          components: rustfmt, clippy
      - run: cargo fmt --all --check
      - run: cargo test --workspace
      - run: cargo test --workspace --all-features
      - run: cargo clippy --workspace --all-targets -- -D warnings
      - run: cargo doc --workspace --no-deps
        env:
          RUSTDOCFLAGS: -D warnings
      - run: cargo run -p xtask -- simdoc --check
        env:
          SIMDOC_TOOLING_MANIFEST: ${{ github.workspace }}/sim-tooling/Cargo.toml
      - run: cargo run -p xtask -- check-file-sizes

  check:
    name: check
    if: ${{ always() }}
    needs: [scope, heavy]
    runs-on: ubuntu-latest
    steps:
      - name: Require heavy validation when enabled
        env:
          HEAVY_RESULT: ${{ needs.heavy.result }}
          RUN_HEAVY: ${{ needs.scope.outputs.run-heavy }}
        run: |
          if [ "$RUN_HEAVY" != true ]; then
            exit 0
          fi
          test "$HEAVY_RESULT" = success