io-pimdir 0.4.0

Rust implementation of Pimdir standard
Documentation
name: Tests

on:
  push:
  pull_request:

jobs:
  check:
    name: fmt + clippy + test
    runs-on: ubuntu-latest
    steps:
      # NOTE: the spec is a sibling checkout, not a vendored copy, and three
      # test files skip without it: the schema and statement fidelity suite
      # (tests/spec_drift.rs), the object-naming vectors the format makes a
      # MUST (tests/objects.rs) and the Annex A conventions
      # (tests/conventions.rs). Checking it out is what makes them run, and
      # drift between the two repositories is exactly what nothing else
      # notices.
      - uses: actions/checkout@v4
        with:
          path: io-pimdir
      - uses: actions/checkout@v4
        with:
          repository: pimalaya/pimdir
          path: pimdir
      # NOTE: io-replica is a path dependency until the release carrying the
      # duplicate-link-id freeze is published (see Cargo.toml), so it has to
      # sit beside this checkout too.
      - uses: actions/checkout@v4
        with:
          repository: pimalaya/io-replica
          path: io-replica
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - run: cargo fmt --all --check
        working-directory: io-pimdir
      - run: cargo clippy --all-targets --all-features -- -D warnings
        working-directory: io-pimdir
      - run: cargo test --all-features
        working-directory: io-pimdir
      # The three suites above skip silently when the spec is absent, so a
      # green run proves nothing unless they actually ran.
      - name: The spec suites ran rather than skipped
        working-directory: io-pimdir
        run: |
          set -eu
          for suite in spec_drift objects conventions; do
            if cargo test --all-features --test "$suite" -- --nocapture 2>&1 | grep -q "skipped: no pimdir spec checkout"; then
              echo "::error::$suite skipped: the pimdir checkout was not found"
              exit 1
            fi
          done