|
| 1 | +name: Design diff process diagnostic |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [codex/design-diff-diagnostic-v3] |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | +jobs: |
| 8 | + diagnose: |
| 9 | + runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }} |
| 10 | + timeout-minutes: 15 |
| 11 | + env: |
| 12 | + ENGINE_SHA: e279fddb00dfc22ca181838352c436d7f480c286 |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 |
| 15 | + with: |
| 16 | + ref: ${{ env.ENGINE_SHA }} |
| 17 | + fetch-depth: 0 |
| 18 | + persist-credentials: false |
| 19 | + - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 |
| 20 | + with: |
| 21 | + bun-version: 1.4.1 |
| 22 | + - run: bun install --frozen-lockfile --ignore-scripts |
| 23 | + - name: Fetch frozen diagnostic comparison |
| 24 | + env: |
| 25 | + GH_TOKEN: ${{ github.token }} |
| 26 | + run: | |
| 27 | + bun --no-env-file -e ' |
| 28 | + const fs=require("node:fs"),cp=require("node:child_process"); |
| 29 | + const manifest=JSON.parse(fs.readFileSync("scripts/design-diff/benchmark/comparisons.json","utf8")); |
| 30 | + manifest.comparisons=manifest.comparisons.filter(p=>p.pr===7252); |
| 31 | + const item=manifest.comparisons[0]; |
| 32 | + fs.writeFileSync(process.env.RUNNER_TEMP+"/diagnostic-manifest.json",JSON.stringify(manifest)); |
| 33 | + for(const [name,sha] of [["BASE_SHA",item.base],["HEAD_SHA",item.head]]){ |
| 34 | + if(!/^[a-f0-9]{40}$/.test(sha))process.exit(1); |
| 35 | + fs.appendFileSync(process.env.GITHUB_ENV,`${name}=${sha}\n`); |
| 36 | + } |
| 37 | + try{cp.execFileSync("git",["-c","http.extraheader=AUTHORIZATION: basic "+Buffer.from("x-access-token:"+process.env.GH_TOKEN).toString("base64"),"fetch","--no-tags","origin",item.base,item.head],{stdio:"ignore"})}catch{process.stderr.write("Diagnostic source fetch failed\n");process.exit(1)} |
| 38 | + ' |
| 39 | + - name: Compare direct CLI and benchmark wrapper |
| 40 | + run: | |
| 41 | + mkdir -p "$RUNNER_TEMP/diagnostics" |
| 42 | + set +e |
| 43 | + /usr/bin/time -v bun --no-env-file scripts/design-diff/cli.ts \ |
| 44 | + --base "$BASE_SHA" --head "$HEAD_SHA" --output "$RUNNER_TEMP/diagnostics/direct.json" \ |
| 45 | + 2> "$RUNNER_TEMP/diagnostics/direct-stderr.txt" |
| 46 | + echo "$?" > "$RUNNER_TEMP/diagnostics/direct-exit.txt" |
| 47 | + bun --no-env-file scripts/design-diff/benchmark.ts --engine "$PWD" --sha "$ENGINE_SHA" \ |
| 48 | + --manifest "$RUNNER_TEMP/diagnostic-manifest.json" --output "$RUNNER_TEMP/diagnostics/wrapped" --workers 1 \ |
| 49 | + > "$RUNNER_TEMP/diagnostics/wrapper-stdout.txt" 2> "$RUNNER_TEMP/diagnostics/wrapper-stderr.txt" |
| 50 | + echo "$?" > "$RUNNER_TEMP/diagnostics/wrapper-exit.txt" |
| 51 | + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 |
| 52 | + if: always() |
| 53 | + with: |
| 54 | + name: design-diff-process-diagnostic-${{ github.run_id }} |
| 55 | + path: ${{ runner.temp }}/diagnostics/ |
| 56 | + retention-days: 7 |
0 commit comments