nsip 0.4.0

NSIP Search API client for nsipsearch.nsip.org/api
Documentation
name: Test Matrix

on:
  pull_request:
  # schedule:
  #   - cron: '0 0 * * 0'  # Weekly on Sunday
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  test-matrix:
    name: Test on ${{ matrix.os }} / Rust ${{ matrix.rust }}
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable, beta, nightly, '1.92']  # MSRV is 1.92
        include:
          # Additional specific combinations
          - os: ubuntu-latest
            rust: stable
            features: '--all-features'
          - os: ubuntu-latest
            rust: stable
            features: '--no-default-features'
        exclude:
          # Skip some combinations to reduce CI time
          - os: macos-latest
            rust: beta
          - os: windows-latest
            rust: beta
    
    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2

      - name: Setup Rust ${{ matrix.rust }}
        uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
        with:
          toolchain: ${{ matrix.rust }}

      - name: Cache dependencies
        uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Check formatting (stable only)
        if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
        run: |
          rustup component add rustfmt
          cargo fmt --all -- --check

      - name: Run clippy (stable only)
        if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
        run: |
          rustup component add clippy
          cargo clippy --all-targets ${{ matrix.features || '--all-features' }} -- -D warnings

      - name: Build
        run: cargo build --verbose ${{ matrix.features || '' }}

      - name: Run tests
        run: cargo test --verbose ${{ matrix.features || '' }}

      - name: Run doc tests
        run: cargo test --doc ${{ matrix.features || '' }}

      - name: Check documentation
        if: matrix.rust == 'stable'
        run: cargo doc --no-deps ${{ matrix.features || '--all-features' }}

  integration-tests:
    name: Integration Tests
    runs-on: ubuntu-latest
    timeout-minutes: 20
    
    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2

      - name: Setup Rust
        uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
        with:
          toolchain: stable

      - name: Cache dependencies
        uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-integration-${{ hashFiles('**/Cargo.lock') }}

      - name: Run integration tests
        run: cargo test --test '*' --verbose

  miri:
    name: Miri (Undefined Behavior Detection)
    runs-on: ubuntu-latest
    timeout-minutes: 30
    
    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2

      - name: Setup Rust nightly with miri
        uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
        with:
          toolchain: nightly
          components: miri

      - name: Run miri
        run: cargo miri test || echo "Miri tests failed - review for undefined behavior"
        continue-on-error: true

  test-report:
    name: Generate Test Report
    runs-on: ubuntu-latest
    needs: [test-matrix, integration-tests]
    if: always()
    
    steps:
      - name: Generate report
        run: |
          echo "# Test Matrix Results" > test-report.md
          echo "" >> test-report.md
          echo "Test matrix completed. Check individual job results above." >> test-report.md

      - name: Upload report
        uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f  # v7.0.0
        with:
          name: test-matrix-report
          path: test-report.md
          retention-days: 30