diff --git a/.github/workflows/ci-routing-probe.yml b/.github/workflows/ci-routing-probe.yml new file mode 100644 index 0000000000..d78ebfae36 --- /dev/null +++ b/.github/workflows/ci-routing-probe.yml @@ -0,0 +1,252 @@ +name: CI non-browser routing probe +on: + push: + branches: + - investigate-ci-throughput + paths: + - .github/workflows/ci-routing-probe.yml + workflow_dispatch: {} +permissions: + contents: read +env: + ONNXRUNTIME_NODE_INSTALL: skip +jobs: + changes: + runs-on: ubuntu-latest + outputs: + full: ${{ steps.route.outputs.full }} + browser: ${{ steps.route.outputs.browser }} + format: ${{ steps.route.outputs.format }} + quality: ${{ steps.route.outputs.quality }} + relay: ${{ steps.route.outputs.relay }} + sdk: ${{ steps.route.outputs.sdk }} + steps: + - id: route + run: >- + for contract in full browser quality relay sdk; do echo "$contract=false" >> + "$GITHUB_OUTPUT"; done + + echo "format=true" >> "$GITHUB_OUTPUT" + quality: + name: quality + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.format != + 'false' || needs.changes.outputs.quality != 'false' || needs.changes.outputs.relay != 'false' + || needs.changes.outputs.sdk != 'false') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + - name: Install dependencies + id: install + run: node scripts/npm-retry.mjs ci + - name: Check formatting + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.format != 'false') }} + run: npm run format:check + - name: Lint lockfile + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.quality != 'false') }} + run: npx --yes lockfile-lint --path package-lock.json --type npm --allowed-hosts npm + --validate-https --validate-integrity + - name: Verify dependency signatures + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.quality != 'false') }} + run: npm audit signatures + - name: Lint + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.quality != 'false') }} + run: npm run lint + - name: Build relay + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.relay != 'false') }} + run: npm run build:relay + - name: Run relay tests + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.relay != 'false') }} + run: npm run test --workspace=@getpaseo/relay + - name: Build client dependencies + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.sdk != 'false') }} + run: npm run build:relay && npm run build:client + - name: Build plugin SDK + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.sdk != 'false') }} + run: npm run build:plugin + - name: Run plugin SDK tests + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.sdk != 'false') }} + run: npm run test --workspace=@getpaseo/plugin + - name: Run protocol tests + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.sdk != 'false') }} + run: npm run test --workspace=@getpaseo/protocol + - name: Run client tests + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.sdk != 'false') }} + run: npm run test --workspace=@getpaseo/client + - name: Run highlight tests + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.sdk != 'false') }} + run: npm run test --workspace=@getpaseo/highlight + - name: Typecheck client examples + if: + ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' + || needs.changes.outputs.sdk != 'false') }} + run: npm run typecheck:examples --workspace=@getpaseo/client + playwright-1: + name: playwright (shard 1/8) + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.browser != + 'false') }} + runs-on: ubuntu-latest + steps: + - run: echo "Browser coverage was intentionally unrouted; this must not execute"; exit 99 + playwright-2: + name: playwright (shard 2/8) + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.browser != + 'false') }} + runs-on: ubuntu-latest + steps: + - run: echo "Browser coverage was intentionally unrouted; this must not execute"; exit 99 + playwright-3: + name: playwright (shard 3/8) + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.browser != + 'false') }} + runs-on: ubuntu-latest + steps: + - run: echo "Browser coverage was intentionally unrouted; this must not execute"; exit 99 + playwright-4: + name: playwright (shard 4/8) + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.browser != + 'false') }} + runs-on: ubuntu-latest + steps: + - run: echo "Browser coverage was intentionally unrouted; this must not execute"; exit 99 + playwright-5: + name: playwright (shard 5/8) + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.browser != + 'false') }} + runs-on: ubuntu-latest + steps: + - run: echo "Browser coverage was intentionally unrouted; this must not execute"; exit 99 + playwright-6: + name: playwright (shard 6/8) + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.browser != + 'false') }} + runs-on: ubuntu-latest + steps: + - run: echo "Browser coverage was intentionally unrouted; this must not execute"; exit 99 + playwright-7: + name: playwright (shard 7/8) + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.browser != + 'false') }} + runs-on: ubuntu-latest + steps: + - run: echo "Browser coverage was intentionally unrouted; this must not execute"; exit 99 + playwright-8: + name: playwright (shard 8/8) + needs: changes + if: + ${{ !cancelled() && (needs.changes.outputs.full != 'false' || needs.changes.outputs.browser != + 'false') }} + runs-on: ubuntu-latest + steps: + - run: echo "Browser coverage was intentionally unrouted; this must not execute"; exit 99 + playwright: + name: playwright + needs: + - changes + - playwright-1 + - playwright-2 + - playwright-3 + - playwright-4 + - playwright-5 + - playwright-6 + - playwright-7 + - playwright-8 + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + steps: + - name: Require all routed Playwright shards + env: + NEEDS_JSON: ${{ toJSON(needs) }} + run: > + node --input-type=module <<'NODE' + + const needs = JSON.parse(process.env.NEEDS_JSON); + + const routed = needs.changes.outputs.full !== 'false' || needs.changes.outputs.browser !== + 'false'; + + const failures = Object.entries(needs).filter(([name, job]) => + job.result !== (name === 'changes' || routed ? 'success' : 'skipped')); + for (const [name, job] of failures) console.error(`${name}: ${job.result}`); + + process.exitCode = failures.length ? 1 : 0; + + NODE + verify: + needs: + - changes + - quality + - playwright + - playwright-1 + - playwright-2 + - playwright-3 + - playwright-4 + - playwright-5 + - playwright-6 + - playwright-7 + - playwright-8 + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + steps: + - env: + NEEDS_JSON: ${{ toJSON(needs) }} + run: >- + node --input-type=module <<'NODE' + + import assert from 'node:assert/strict'; + + const needs=JSON.parse(process.env.NEEDS_JSON); + + for(const name of ['changes','quality','playwright']) + assert.equal(needs[name].result,'success',name); + + for(let i=1;i<=8;i++) + assert.equal(needs['playwright-'+i].result,'skipped','playwright-'+i); + + console.log('PASS: real quality ran formatting only; all eight real browser job conditions + skipped; the actual result gate succeeded'); + + NODE