-
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 2.18 KB
/
Copy pathbenchmarks.yml
File metadata and controls
55 lines (51 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: benchmarks
on:
push:
branches: [main]
pull_request: {}
permissions:
contents: read
pull-requests: write
concurrency:
group: benchmarks-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
bench:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v4
- uses: astral-sh/setup-uv@v8.2.0
# uv.lock is git-ignored (repo convention), so a clean checkout lacks it.
# `just bench-report` builds the compose `application` image, whose Dockerfile
# does `COPY uv.lock` + `uv sync --frozen`; regenerate the lock first.
- run: uv lock
- name: Run the gate and capture the markdown report
shell: bash
run: |
# `docker compose run` leaks buildkit image-build output onto stdout in
# CI, so a naive capture mixes it into the comment. The report always
# begins with the `## Benchmark gate` sentinel and the container prints
# it last, so slice from that heading to EOF -- independent of how
# compose routes its own noise. Own the exit code manually: `set +e`
# (shell: bash runs with -e) so a failing gate still lets us post the
# report, then re-exit with the gate's status so the build still fails.
set +e
just bench-report > "$RUNNER_TEMP/raw.log"
status=$?
sed -n '/^## Benchmark gate/,$p' "$RUNNER_TEMP/raw.log" \
| tee "$GITHUB_STEP_SUMMARY" "$RUNNER_TEMP/bench-report.md"
exit "$status"
- name: Comment the report on the PR
# always(): comment even when the gate failed -- that is when it matters most.
# continue-on-error: fork PRs get a read-only token and cannot comment; the
# gate above already decided the build, and the run Summary still has the table.
if: always() && github.event_name == 'pull_request'
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment "${{ github.event.pull_request.number }}" \
--edit-last --create-if-none \
--body-file "$RUNNER_TEMP/bench-report.md"