NPM Package Sweep #76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: NPM Package Sweep | |
| on: | |
| schedule: | |
| # Nightly advisory signal for package drift. It does not run on PRs. | |
| - cron: '25 5 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| packages: | |
| description: 'Optional comma-separated package specs. Empty uses packages.json.' | |
| type: string | |
| default: '' | |
| limit: | |
| description: 'Maximum packages to sweep. Use 0 for all selected packages.' | |
| type: number | |
| default: 6 | |
| strict: | |
| description: 'Fail the workflow if any package fails.' | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: read | |
| concurrency: | |
| # #7966: keyed per RUN for non-PR events. A group that is constant across | |
| # scheduled runs lets only the first one execute -- GitHub keeps at most one | |
| # PENDING run per group and cancels the rest with `jobs: 0`, regardless of | |
| # `cancel-in-progress`. PR runs keep the shared per-ref group so superseded | |
| # pushes still coalesce. Enforced by scripts/gc_gate_wiring_check.py. | |
| group: npm-package-sweep-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} | |
| cancel-in-progress: false | |
| env: | |
| CARGO_TERM_COLOR: always | |
| MACOSX_DEPLOYMENT_TARGET: "13.0" | |
| jobs: | |
| compile-packages-sweep: | |
| name: compilePackages sweep | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: ./.github/actions/setup-llvm22 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "${{ runner.os }}-perry-npm-sweep" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| # Single source of truth: .node-version at the repo root. | |
| node-version-file: .node-version | |
| - name: Build Perry release binary | |
| run: cargo build --release -p perry-runtime -p perry-stdlib -p perry-runtime-static -p perry-stdlib-static -p perry | |
| - name: Run npm package sweep | |
| env: | |
| SWEEP_PACKAGES: ${{ github.event.inputs.packages }} | |
| SWEEP_LIMIT: ${{ github.event.inputs.limit }} | |
| SWEEP_STRICT: ${{ github.event.inputs.strict }} | |
| run: | | |
| set -euo pipefail | |
| mkdir -p .npm-sweep-results | |
| flags=( | |
| --perry-bin "$GITHUB_WORKSPACE/target/release/perry" | |
| --out-dir .npm-sweep-results | |
| --history test-compat/npm-sweep-history.csv | |
| --limit "${SWEEP_LIMIT:-6}" | |
| ) | |
| if [[ -n "${SWEEP_PACKAGES:-}" ]]; then | |
| flags+=(--packages "$SWEEP_PACKAGES") | |
| fi | |
| if [[ "${SWEEP_STRICT:-false}" == "true" ]]; then | |
| flags+=(--strict) | |
| fi | |
| set +e | |
| python3 test-compat/npm-sweep/run.py "${flags[@]}" | |
| sweep_rc=$? | |
| set -e | |
| cp test-compat/npm-sweep-history.csv .npm-sweep-results/npm-sweep-history.csv | |
| cat .npm-sweep-results/summary.md >> "$GITHUB_STEP_SUMMARY" | |
| exit "$sweep_rc" | |
| - name: Upload sweep artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: npm-package-sweep-${{ github.sha }} | |
| path: .npm-sweep-results/ | |
| if-no-files-found: ignore | |
| retention-days: 90 |