probation 0.2.2

A filtering proxy for npm and PyPI that withholds packages until they are eligible.
name: Rust

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

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
        with:
          persist-credentials: false
      - run: cargo fmt --check
      - run: cargo clippy --all-targets --locked -- -D warnings
      - run: cargo test --locked

  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
        with:
          persist-credentials: false
      - run: rustup component add llvm-tools
      - uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
        with:
          tool: cargo-llvm-cov
      - run: cargo llvm-cov --locked --summary-only --fail-under-lines 98

  # The real-client tests are `#[ignore]` because they spawn npm and pip. They pin
  # their clients (tests/e2e_npm.rs, tests/e2e_pip.rs, docs/operations.md ยง11); this
  # job installs exactly those pins so the matrix they claim is the one that ran.
  e2e:
    runs-on: ubuntu-latest
    env:
      PROBATION_E2E_CLIENTS: ${{ github.workspace }}/../e2e-clients
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
        with:
          persist-credentials: false
      - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: v24.19.0
      - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
        with:
          python-version: "3.12"
      - name: Install pinned clients
        run: |
          set -euo pipefail
          for v in 10.9.9 12.0.2; do
            npm install --prefix "$PROBATION_E2E_CLIENTS/npm-$v" "npm@$v"
          done
          for v in 25.0.1 26.2.1; do
            python3 -m pip install --target "$PROBATION_E2E_CLIENTS/pip-$v" "pip==$v"
          done
          # The pip tests build their fixture packages with `python -m build --no-isolation`.
          python3 -m pip install build==1.2.2 setuptools==78.1.1
          echo "PROBATION_E2E_NODE_BIN=$(dirname "$(command -v node)")" >> "$GITHUB_ENV"
      - run: cargo test --locked --test e2e_npm --test e2e_pip -- --ignored