-
Notifications
You must be signed in to change notification settings - Fork 8
89 lines (84 loc) · 2.76 KB
/
benchmark.yaml
File metadata and controls
89 lines (84 loc) · 2.76 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Benchmark
on:
pull_request:
branches: [ "main" ]
permissions:
pull-requests: write
jobs:
prep:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.last_tag.outputs.tag }}
short_sha: ${{ steps.short.outputs.sha }}
steps:
- uses: actions/checkout@v6
with:
fetch-tags: true
fetch-depth: 0
- id: last_tag
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
- id: short
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
benchmark:
needs: prep
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- name: ${{ needs.prep.outputs.short_sha }}
ref: ${{ github.sha }}
- name: main
ref: main
# Tag comparison disabled until next release (missing benchmark dependencies)
# - name: ${{ needs.prep.outputs.tag }}
# ref: ${{ needs.prep.outputs.tag }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ matrix.target.ref }}
submodules: true
- uses: astral-sh/setup-uv@v8.1.0
- run: uv sync --extra "cloud"
- name: Run benchmarks
run: |
FILENAME="benchmark-${{ matrix.target.name }}-PR-${{ github.event.pull_request.number }}.json"
uv run .github/scripts/run_benchmarks.py --output "$FILENAME"
echo "REPORT_PATH=$FILENAME" >> $GITHUB_ENV
- uses: actions/upload-artifact@v7
with:
name: benchmark-${{ matrix.target.name }}-PR-${{
github.event.pull_request.number }}
path: ${{ env.REPORT_PATH }}
retention-days: 1
overwrite: true
report:
needs: [ prep, benchmark ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v8.1.0
- uses: actions/download-artifact@v8
with:
pattern: benchmark-*
merge-multiple: true
path: benchmark-results
- name: Generate report
run: |
uv run .github/scripts/compare_benchmarks.py \
--output "benchmarks.md" \
--pattern "benchmark-results/benchmark-*-PR-${{ github.event.pull_request.number }}.json"
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "Benchmark Results"
- name: Create / update comment
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body-path: "benchmarks.md"
edit-mode: replace