blob: 69c3164f1c67501c0100e9978e3cea2458f5ce65 (
plain)
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
|
name: Benchmark
on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:
# Cancel in-flight benchmark runs for the same PR/branch so only the latest commit is benchmarked.
concurrency:
group: benchmark-${{ github.ref }}
cancel-in-progress: true
jobs:
benchmark:
name: Run CIBenchmark
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run CIBenchmark
run: >
./gradlew :opendc-experiments:opendc-experiments-base:jmh
-PjmhIncludes=.*CIBenchmark.*
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: opendc-experiments/opendc-experiments-base/build/results/jmh/results.json
retention-days: 7
# Store the PR number so the comment workflow (which runs with write permissions)
# knows which PR to comment on. Only needed for pull_request runs.
- name: Save PR number
if: github.event_name == 'pull_request'
run: echo "${{ github.event.pull_request.number }}" > pr-number.txt
- name: Upload PR number
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: pr-number
path: pr-number.txt
retention-days: 1
# ── Master push: store results on the benchmark-data branch ──────────────────
store-results:
name: Store benchmark results
if: github.event_name == 'push'
needs: benchmark
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download current results
uses: actions/download-artifact@v4
with:
name: benchmark-results
path: current-results
- name: Check out or create benchmark-data branch
run: |
git fetch origin benchmark-data 2>/dev/null || true
if git rev-parse --verify origin/benchmark-data 2>/dev/null; then
git worktree add benchmark-data-dir origin/benchmark-data
else
git worktree add --orphan -b benchmark-data benchmark-data-dir
fi
- name: Update history
run: |
python .github/scripts/update_history.py \
current-results/results.json \
benchmark-data-dir \
"${{ github.sha }}"
- name: Commit and push
run: |
git -C benchmark-data-dir config user.name "github-actions[bot]"
git -C benchmark-data-dir config user.email "github-actions[bot]@users.noreply.github.com"
git -C benchmark-data-dir add benchmark-history.json
git -C benchmark-data-dir commit \
-m "chore: benchmark results for ${{ github.sha }}"
git -C benchmark-data-dir push origin HEAD:benchmark-data
|