-
Notifications
You must be signed in to change notification settings - Fork 1
194 lines (179 loc) · 6.91 KB
/
Copy pathnightly-benchmark.yml
File metadata and controls
194 lines (179 loc) · 6.91 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Nightly Cross-Runtime Benchmark
on:
schedule:
- cron: "30 14 * * *" # 22:30 UTC+8, after diff-fuzz starts
workflow_dispatch:
inputs:
modes:
description: "Storage modes override (comma-separated, empty = use fixture default)"
default: ""
filter:
description: "Only run fixtures matching this substring"
default: ""
skip:
description: "Runtimes to skip (comma-separated)"
default: ""
generate:
description: "Also generate synthetic fixtures"
type: boolean
default: false
permissions:
actions: read
jobs:
cross-runtime-benchmark:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: pine-go/go.mod
cache-dependency-path: pine-go/go.sum
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "25"
cache: maven
- name: Install system deps
# ci-apt-install.sh retries with a per-attempt timeout so one slow
# mirror rotation doesn't burn the whole budget (#125, #164). cmake /
# gcc / make (build-essential) are preinstalled on the runner image —
# assert instead of apt-installing shadowed duplicates.
run: |
bash scripts/ci-apt-install.sh libluajit-5.1-dev libcurl4-openssl-dev
cmake --version | head -1
g++ --version | head -1
- name: Install hey
run: go install github.com/rakyll/hey@latest
- name: Stop unneeded services for isolation
run: |
sudo systemctl stop mysql.service 2>/dev/null || true
sudo systemctl stop postgresql.service 2>/dev/null || true
sudo systemctl stop mono-xsp4.service 2>/dev/null || true
sudo systemctl stop docker.service 2>/dev/null || true
sudo systemctl stop snapd.service 2>/dev/null || true
- name: Download previous successful report
id: prev
run: |
PREV_RUN_ID=$(gh run list \
--workflow="nightly-benchmark.yml" \
--status=success \
-L1 --json databaseId -q '.[0].databaseId' 2>/dev/null || echo "")
if [ -n "$PREV_RUN_ID" ] && [ "$PREV_RUN_ID" != "null" ]; then
mkdir -p /tmp/bench_prev
ARTIFACT_NAME=$(gh api "repos/${{ github.repository }}/actions/runs/${PREV_RUN_ID}/artifacts" \
--jq '.artifacts[] | select(.name | startswith("cross-runtime-benchmark-")) | .name' \
| head -1)
if [ -n "$ARTIFACT_NAME" ]; then
gh run download "$PREV_RUN_ID" -n "$ARTIFACT_NAME" -D /tmp/bench_prev/ 2>/dev/null || true
fi
if [ -f /tmp/bench_prev/report.txt ]; then
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "found=false" >> "$GITHUB_OUTPUT"
fi
else
echo "found=false" >> "$GITHUB_OUTPUT"
fi
- name: Run cross-runtime benchmark
run: |
ARGS=""
MODES="${{ inputs.modes || '' }}"
FILTER="${{ inputs.filter || '' }}"
SKIP="${{ inputs.skip || '' }}"
GENERATE="${{ inputs.generate || 'false' }}"
if [ -n "$MODES" ]; then
ARGS="$ARGS --modes $MODES"
fi
if [ -n "$FILTER" ]; then
ARGS="$ARGS --filter $FILTER"
fi
if [ -n "$SKIP" ]; then
ARGS="$ARGS --skip $SKIP"
fi
if [ "$GENERATE" = "true" ]; then
ARGS="$ARGS --generate"
fi
bash scripts/bench-cross-runtime.sh $ARGS \
2>&1 | tee bench-output.log
- name: Generate comparison report
if: steps.prev.outputs.found == 'true'
run: |
python3 scripts/bench-compare.py \
--prev /tmp/bench_prev/report.txt \
--curr bench-results/report.txt \
--output bench-results/comparison.txt
- name: Analyze benchmark results
if: always()
run: |
if [ -f bench-results/report.txt ]; then
python3 scripts/bench-analyze.py bench-results/report.txt \
-o bench-results/analysis.txt
python3 scripts/bench-analyze.py bench-results/report.txt \
--json -o bench-results/analysis.json
fi
- name: Write benchmark summary
if: always()
shell: bash
run: |
{
echo "### Cross-Runtime Benchmark"
echo ""
if [ -f bench-results/analysis.txt ]; then
echo "#### Analysis"
echo '```text'
cat bench-results/analysis.txt
echo '```'
echo ""
fi
if [ -f bench-results/comparison.txt ]; then
echo "#### Delta vs previous run"
echo '```text'
cat bench-results/comparison.txt
echo '```'
echo ""
fi
echo "#### Full results"
echo '```text'
cat bench-results/report.txt 2>/dev/null || echo "No report generated"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload benchmark report
uses: actions/upload-artifact@v7
if: always()
with:
name: cross-runtime-benchmark-${{ github.run_number }}
# report.txt is the stable alias the next run's `gh run download`
# looks for by name; keep it first and keep the name unchanged.
path: |
bench-results/report.txt
bench-results/comparison.txt
bench-results/analysis.txt
bench-results/analysis.json
retention-days: 30
- name: Notify via Bark
if: always()
env:
BARK_KEY: ${{ secrets.BARK_DEVICE_KEY }}
run: |
if [ -z "$BARK_KEY" ]; then
echo "BARK_DEVICE_KEY not set, skipping notification"
exit 0
fi
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
if [ -f bench-results/analysis.txt ]; then
BODY=$(grep -A5 "## Verdict" bench-results/analysis.txt | tail -n+2)
elif [ -f bench-results/comparison.txt ]; then
BODY=$(head -20 bench-results/comparison.txt)
elif [ -f bench-results/report.txt ]; then
BODY=$(grep -E "^\s+(go|java|cpp)" bench-results/report.txt | head -12)
else
BODY="No report generated. Check logs."
fi
STATUS="${{ job.status }}"
TITLE="Benchmark ${STATUS}"
ENCODED_BODY=$(echo "$BODY" | python3 -c "import sys,urllib.parse; print(urllib.parse.quote(sys.stdin.read()))")
curl -sf "http://api.day.app/${BARK_KEY}/${TITLE}/${ENCODED_BODY}?url=${RUN_URL}&group=pineapple-ci" \
|| echo "Bark notification failed (non-fatal)"