-
Notifications
You must be signed in to change notification settings - Fork 31
74 lines (67 loc) · 2.27 KB
/
benchmark.yml
File metadata and controls
74 lines (67 loc) · 2.27 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
name: Benchmark
on:
workflow_dispatch:
inputs:
framework:
description: 'Framework to benchmark (leave empty for all)'
required: false
default: ''
profile:
description: 'Profile to run (e.g. baseline, baseline-h2, leave empty for all)'
required: false
default: ''
permissions:
contents: write
pull-requests: write
concurrency:
group: benchmark
cancel-in-progress: false
jobs:
benchmark:
runs-on: self-hosted
environment: runner
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 2
- name: Detect modified frameworks
id: detect
run: |
if [ -n "${{ inputs.framework }}" ]; then
echo "list=${{ inputs.framework }}" >> "$GITHUB_OUTPUT"
else
list=$(git diff --name-only HEAD~1 HEAD \
| grep '^frameworks/' \
| cut -d'/' -f2 \
| sort -u \
| tr '\n' ' ')
echo "list=$list" >> "$GITHUB_OUTPUT"
fi
- name: Run benchmarks
if: steps.detect.outputs.list != ''
run: |
for fw in ${{ steps.detect.outputs.list }}; do
echo ">>> Benchmarking: $fw"
./scripts/benchmark.sh --save "$fw" ${{ inputs.profile }} || echo "WARN: $fw benchmark failed"
done
- name: Create PR with results
if: steps.detect.outputs.list != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "HttpArena Bot"
git config user.email "bot@httparena"
git add site/data/ site/static/logs/ 2>/dev/null || true
if ! git diff --cached --quiet; then
branch="benchmark-results/$(date +%Y%m%d-%H%M%S)"
git fetch origin main
git checkout -b "$branch" origin/main
git checkout HEAD@{1} -- site/data/ site/static/logs/
git commit -m "benchmark: update results for ${{ steps.detect.outputs.list }}"
git push -u origin "$branch"
gh pr create \
--title "benchmark: update results for ${{ steps.detect.outputs.list }}" \
--body "Automated benchmark results update." \
--base main \
--head "$branch"
fi