Skip to content

Commit 0569554

Browse files
authored
Run nightly benchmarks (#1803)
Tested on my fork, results can be seen here: https://github.com/jaydeluca/client_java/tree/benchmarks --------- Signed-off-by: Jay DeLuca <jaydeluca4@gmail.com>
1 parent 663d52f commit 0569554

File tree

5 files changed

+536
-0
lines changed

5 files changed

+536
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
name: Nightly Benchmarks
3+
4+
on:
5+
schedule:
6+
# Run at 2 AM UTC every day
7+
- cron: "0 2 * * *"
8+
workflow_dispatch:
9+
inputs:
10+
jmh_args:
11+
description: "Additional JMH arguments (e.g., '-f 1 -wi 1 -i 3' for quick run)"
12+
required: false
13+
default: ""
14+
15+
permissions: {}
16+
17+
concurrency:
18+
group: "benchmarks"
19+
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
jobs:
25+
benchmark:
26+
runs-on: ubuntu-24.04
27+
permissions:
28+
contents: write
29+
steps:
30+
- name: Checkout main branch
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+
with:
33+
persist-credentials: true
34+
fetch-depth: 0
35+
36+
- name: Setup mise
37+
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
38+
with:
39+
version: v2026.1.4
40+
sha256: 79c798e39b83f0dd80108eaa88c6ca63689695ae975fd6786e7a353ef9f87002
41+
42+
- name: Cache local Maven repository
43+
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
44+
with:
45+
path: ~/.m2/repository
46+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
47+
restore-keys: |
48+
${{ runner.os }}-maven-
49+
50+
- name: Run JMH benchmarks
51+
run: mise run benchmark:ci-json
52+
env:
53+
JMH_ARGS: ${{ github.event.inputs.jmh_args }}
54+
55+
- name: Generate benchmark summary
56+
run: |
57+
mise run benchmark:generate-summary \
58+
--input benchmark-results.json \
59+
--output-dir benchmark-results \
60+
--commit-sha "${{ github.sha }}"
61+
env:
62+
GITHUB_REPOSITORY: ${{ github.repository }}
63+
64+
- name: Commit and push results to benchmarks branch
65+
run: |
66+
# Save results to a temp location
67+
mkdir -p /tmp/benchmark-output
68+
cp -r benchmark-results/* /tmp/benchmark-output/
69+
70+
git config user.name "github-actions[bot]"
71+
git config user.email "github-actions[bot]@users.noreply.github.com"
72+
73+
# Checkout or create benchmarks branch (use -- to disambiguate from benchmarks/ directory)
74+
if git ls-remote --heads origin benchmarks | grep -q benchmarks; then
75+
git fetch origin benchmarks
76+
git switch benchmarks
77+
# Preserve existing history
78+
if [ -d history ]; then
79+
cp -r history /tmp/benchmark-output/
80+
fi
81+
else
82+
git switch --orphan benchmarks
83+
fi
84+
85+
# Clean working directory
86+
git rm -rf . 2>/dev/null || true
87+
find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
88+
89+
# Copy only the benchmark results
90+
cp -r /tmp/benchmark-output/* .
91+
92+
git add README.md results.json history/
93+
94+
DATE=$(date -u +"%Y-%m-%d")
95+
COMMIT_SHORT=$(echo "${{ github.sha }}" | cut -c1-7)
96+
97+
git commit \
98+
-m "Benchmark results for ${DATE} (${COMMIT_SHORT})" \
99+
-m "From commit ${{ github.sha }}" \
100+
|| echo "No changes to commit"
101+
102+
git push origin benchmarks --force-with-lease || git push origin benchmarks

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ dependency-reduced-pom.xml
2020
**/.settings/
2121
docs/public
2222
.lycheecache
23+
24+
benchmark-results/
25+
benchmark-results.json
26+
benchmark-output.log

0 commit comments

Comments
 (0)