|
| 1 | +name: Design index frozen evaluation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [codex/design-index-cloud-smoke] |
| 6 | + paths: [.github/workflows/design-index-evaluation.yml, scripts/design-diff/benchmark/index-evaluation.json] |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: design-index-frozen-evaluation |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +env: |
| 16 | + ENGINE: 7f2c2fd67fda51ff9bd46af1cd5f79ad70d7f75d |
| 17 | + |
| 18 | +jobs: |
| 19 | + manifest: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + timeout-minutes: 5 |
| 22 | + outputs: |
| 23 | + prs: ${{ steps.manifest.outputs.prs }} |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 |
| 26 | + with: |
| 27 | + persist-credentials: false |
| 28 | + sparse-checkout: scripts/design-diff/benchmark/index-evaluation.json |
| 29 | + sparse-checkout-cone-mode: false |
| 30 | + - id: manifest |
| 31 | + run: | |
| 32 | + python3 - <<'PY' |
| 33 | + import json, os |
| 34 | + data=json.load(open('scripts/design-diff/benchmark/index-evaluation.json')) |
| 35 | + prs=[item['pr'] for item in data['comparisons']] |
| 36 | + assert len(prs)==len(set(prs))==180 and all(type(pr) is int and pr>0 for pr in prs) |
| 37 | + with open(os.environ['GITHUB_OUTPUT'],'a') as f: f.write('prs='+json.dumps(prs)+'\n') |
| 38 | + PY |
| 39 | +
|
| 40 | + measure: |
| 41 | + needs: manifest |
| 42 | + strategy: |
| 43 | + fail-fast: false |
| 44 | + max-parallel: 30 |
| 45 | + matrix: |
| 46 | + pr: ${{ fromJSON(needs.manifest.outputs.prs) }} |
| 47 | + runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }} |
| 48 | + timeout-minutes: 15 |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 |
| 51 | + with: |
| 52 | + ref: ${{ env.ENGINE }} |
| 53 | + fetch-depth: 0 |
| 54 | + persist-credentials: false |
| 55 | + - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 |
| 56 | + with: |
| 57 | + bun-version: 1.4.1 |
| 58 | + - run: bun install --frozen-lockfile --ignore-scripts |
| 59 | + - name: Select frozen comparison and fetch Git data |
| 60 | + env: |
| 61 | + PR_NUMBER: ${{ matrix.pr }} |
| 62 | + GH_TOKEN: ${{ github.token }} |
| 63 | + run: | |
| 64 | + git show "$GITHUB_SHA:scripts/design-diff/benchmark/index-evaluation.json" > "$RUNNER_TEMP/frozen.json" |
| 65 | + python3 - <<'PY' |
| 66 | + import json, os, pathlib, re |
| 67 | + root=pathlib.Path(os.environ['RUNNER_TEMP']) |
| 68 | + frozen=json.loads((root/'frozen.json').read_text()) |
| 69 | + entries=[item for item in frozen['comparisons'] if item['pr']==int(os.environ['PR_NUMBER'])] |
| 70 | + assert len(entries)==1 |
| 71 | + assert all(re.fullmatch('[a-f0-9]{40}',entries[0][key]) for key in ['base','head','mergeBase']) |
| 72 | + (root/'comparison.json').write_text(json.dumps({'comparisons':entries})) |
| 73 | + with open(os.environ['GITHUB_ENV'],'a') as f: |
| 74 | + f.write('BASE_SHA='+entries[0]['base']+'\nHEAD_SHA='+entries[0]['head']+'\n') |
| 75 | + PY |
| 76 | + AUTH_HEADER="$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 | tr -d '\n')" |
| 77 | + BASE_SHA="$(python3 -c 'import json,os; print(json.load(open(os.environ["RUNNER_TEMP"]+"/comparison.json"))["comparisons"][0]["base"])')" |
| 78 | + HEAD_SHA="$(python3 -c 'import json,os; print(json.load(open(os.environ["RUNNER_TEMP"]+"/comparison.json"))["comparisons"][0]["head"])')" |
| 79 | + git -c "http.extraheader=AUTHORIZATION: basic $AUTH_HEADER" fetch --no-tags origin "$BASE_SHA" "$HEAD_SHA" > /dev/null 2>&1 |
| 80 | + - name: Measure cold and baseline-warm analysis and require identical reports |
| 81 | + run: | |
| 82 | + bun --no-env-file scripts/design-diff/benchmark.ts --engine "$GITHUB_WORKSPACE" --sha "$ENGINE" --manifest "$RUNNER_TEMP/comparison.json" --output "$RUNNER_TEMP/results" --workers 1 --profile-index --no-results-cache |
| 83 | + - name: Retain comparison reports and metrics |
| 84 | + if: always() |
| 85 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 86 | + with: |
| 87 | + name: index-evaluation-${{ matrix.pr }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} |
| 88 | + path: | |
| 89 | + ${{ runner.temp }}/results/*.json |
| 90 | + ${{ runner.temp }}/comparison.json |
| 91 | + retention-days: 7 |
| 92 | + if-no-files-found: error |
0 commit comments