Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .github/workflows/nightly-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
name: Nightly Benchmarks

on:
schedule:
# Run at 2 AM UTC every day
- cron: "0 2 * * *"
workflow_dispatch:
inputs:
jmh_args:
description: "Additional JMH arguments (e.g., '-f 1 -wi 1 -i 3' for quick run)"
required: false
default: ""

permissions: {}

concurrency:
group: "benchmarks"

defaults:
run:
shell: bash

jobs:
benchmark:
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout main branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true
fetch-depth: 0

- name: Setup mise
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
with:
version: v2026.1.4
sha256: 79c798e39b83f0dd80108eaa88c6ca63689695ae975fd6786e7a353ef9f87002

- name: Cache local Maven repository
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build benchmarks module
run: ./mvnw -pl benchmarks -am -DskipTests clean package

- name: Run JMH benchmarks
run: |
# 3 forks, 3 warmup, 5 measurement iterations (~60 min total)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you added mise commands - maybe also make this one

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

DEFAULT_ARGS="-f 3 -wi 3 -i 5"
JMH_ARGS="${INPUT_JMH_ARGS:-$DEFAULT_ARGS}"

echo "Running benchmarks with args: $JMH_ARGS"

# shellcheck disable=SC2086 # Intentional word splitting for JMH args
java -jar ./benchmarks/target/benchmarks.jar \
-rf json \
-rff benchmark-results.json \
$JMH_ARGS
env:
INPUT_JMH_ARGS: ${{ github.event.inputs.jmh_args }}

- name: Generate benchmark summary
run: |
python3 .mise/tasks/generate_benchmark_summary.py \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should also work as mise run generate_benchmark_summary

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to use a mise task

--input benchmark-results.json \
--output-dir benchmark-results \
--commit-sha "${{ github.sha }}"
env:
GITHUB_REPOSITORY: ${{ github.repository }}

- name: Commit and push results to benchmarks branch
run: |
# Save results to a temp location
mkdir -p /tmp/benchmark-output
cp -r benchmark-results/* /tmp/benchmark-output/

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Checkout or create benchmarks branch (use -- to disambiguate from benchmarks/ directory)
if git ls-remote --heads origin benchmarks | grep -q benchmarks; then
git fetch origin benchmarks
git switch benchmarks
# Preserve existing history
if [ -d history ]; then
cp -r history /tmp/benchmark-output/
fi
else
git switch --orphan benchmarks
fi

# Clean working directory
git rm -rf . 2>/dev/null || true
find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +

# Copy only the benchmark results
cp -r /tmp/benchmark-output/* .

git add README.md results.json history/

DATE=$(date -u +"%Y-%m-%d")
COMMIT_SHORT=$(echo "${{ github.sha }}" | cut -c1-7)

git commit \
-m "Benchmark results for ${DATE} (${COMMIT_SHORT})" \
-m "From commit ${{ github.sha }}" \
|| echo "No changes to commit"

git push origin benchmarks --force-with-lease || git push origin benchmarks
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ dependency-reduced-pom.xml
**/.settings/
docs/public
.lycheecache

benchmark-results/
benchmark-results.json
benchmark-output.log
Loading