name: Resource Profile (RSS + Cold Start) # Measures peak RSS + cold-start time per engine × preset on a fixed # corpus, and gates on the CI memory budget (80% of 7 GB ubuntu-latest). # # Scheduled monthly because the measurement is sensitive to runner # generation drift; PR-gating would dwarf the bench's value with CI # minutes. Also runs on demand via workflow_dispatch. # # Closes the §3 (Peak memory + Cold start) and §12 (CI memory profile) # gates in `distribution/EVALUATION_METRICS.md`. on: schedule: # 1st of each month, 06:00 UTC. # 07:40 on the 1st, not 06:00: `weekly-corpus-scan` holds 06:00 on # Mondays, so these two collided whenever the 1st fell on a Monday. - cron: "40 7 1 * *" workflow_dispatch: inputs: corpus: description: "Corpus path to scan (default: apps/docs/src)" required: false default: "apps/docs/src" runs: description: "Runs per preset (default: 3, takes median)" required: false default: "3" permissions: contents: read concurrency: group: resource-profile-${{ github.ref }} cancel-in-progress: false jobs: profile: name: Profile peak RSS + cold-start runs-on: ubuntu-latest timeout-minutes: 25 permissions: contents: write # commit the profile snapshot pull-requests: write # open/update the snapshot PR issues: write # open/comment the failure issue steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # Pushed and opened with a PAT where one is configured: GitHub fires no workflows # for events made with GITHUB_TOKEN, so the bot PR's required checks would never # report and it would sit BLOCKED forever (docs-data.yml has the full note). token: ${{ secrets.RELEASE_BOT_PAT || secrets.AGENTS_REPO_PAT || github.token }} - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6 with: node-version-file: .nvmrc - run: npm ci --no-audit --no-fund - name: Build (so eslint can find compiled rule artifacts) run: npm run build - name: Run resource profile run: | npm run ilb:resource-profile -- \ --corpus "${{ inputs.corpus || 'apps/docs/src' }}" \ --runs "${{ inputs.runs || '3' }}" # Was a bare `git push` at main; branch protection declines it with GH006 # (run 33502632167), so every profile measured was discarded at the last step. - name: Commit snapshot if changed if: success() uses: ./.github/actions/commit-via-pr env: GH_TOKEN: ${{ secrets.RELEASE_BOT_PAT || secrets.AGENTS_REPO_PAT || github.token }} with: branch: automated/resource-profile-snapshot paths: benchmark-results/resource-profile.json benchmark-results/resource-profile.md commit-message: "chore(benchmarks): refresh resource profile (peak RSS + cold start)" pr-title: "chore(benchmarks): refresh resource profile (peak RSS + cold start)" pr-body: | Automated monthly refresh of the peak-RSS / cold-start measurements named in `distribution/EVALUATION_METRICS.md` §3 + §12. Fails CI when any preset crosses 80% of the 7 GB `ubuntu-latest` runner ceiling. Generated by the profiler, so review the diff rather than hand-editing. - name: Upload report if: always() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: name: resource-profile path: | benchmark-results/resource-profile.json benchmark-results/resource-profile.md retention-days: 90 # A scheduled refresher that fails notifies nobody by default. This one failed # every run for months — the commit step used a scope commitlint rejected — and # the snapshot it exists to refresh silently stopped moving. One issue, reopened # and commented rather than a new one per run, same shape as integration-health. - name: 🚨 Open an issue on failure if: failure() env: GH_TOKEN: ${{ github.token }} RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} run: | set -euo pipefail TITLE="resource-profile refresh is failing" EXISTING=$(gh issue list --state open --search "$TITLE in:title" \ --json number --jq '.[0].number // empty') BODY=$(printf '%s\n\n[Run](%s)\n' \ 'The monthly resource-profile refresher failed, so `benchmark-results/resource-profile.{json,md}` (peak RSS + cold start) is now stale.' "$RUN_URL") if [ -n "$EXISTING" ]; then gh issue comment "$EXISTING" --body "$BODY" else gh issue create --title "$TITLE" --body "$BODY" fi