Skip to content

Bump version to 0.2.0-SNAPSHOT #13

Bump version to 0.2.0-SNAPSHOT

Bump version to 0.2.0-SNAPSHOT #13

Workflow file for this run

name: Benchmark
on:
pull_request:
push:
branches: [main]
concurrency:
group: benchmark-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
deployments: write
jobs:
benchmark:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check if baseline exists
id: baseline
run: |
if git ls-remote --exit-code origin gh-pages >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
# ── PR: smoke benchmark (advisory) ──────────────────────────────────
- name: Run smoke benchmark
if: github.event_name == 'pull_request'
run: ./gradlew :benchmark:smokeBenchmark
- name: Find smoke result
if: github.event_name == 'pull_request'
id: smoke-result
run: |
RESULT_FILE=$(find benchmark/build/reports/benchmarks -name '*.json' -type f | head -1)
if [ -z "$RESULT_FILE" ]; then
echo "::error::No benchmark JSON found"
exit 1
fi
echo "file=$RESULT_FILE" >> "$GITHUB_OUTPUT"
- name: Compare smoke result
if: github.event_name == 'pull_request' && steps.baseline.outputs.exists == 'true'
uses: benchmark-action/github-action-benchmark@v1
with:
name: KotlinTextMate Benchmark
tool: jmh
output-file-path: ${{ steps.smoke-result.outputs.file }}
github-token: ${{ secrets.GITHUB_TOKEN }}
save-data-file: false
skip-fetch-gh-pages: false
comment-always: true
summary-always: true
fail-on-alert: false
alert-threshold: "150%"
# ── Main: full benchmark (tracked + regression check) ──────────────
- name: Run full benchmark
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: ./gradlew :benchmark:benchmark
- name: Find full result
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
id: full-result
run: |
RESULT_FILE=$(find benchmark/build/reports/benchmarks -name '*.json' -type f | head -1)
if [ -z "$RESULT_FILE" ]; then
echo "::error::No benchmark JSON found"
exit 1
fi
echo "file=$RESULT_FILE" >> "$GITHUB_OUTPUT"
- name: Store full result
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: benchmark-action/github-action-benchmark@v1
with:
name: KotlinTextMate Benchmark
tool: jmh
output-file-path: ${{ steps.full-result.outputs.file }}
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
save-data-file: true
skip-fetch-gh-pages: ${{ steps.baseline.outputs.exists != 'true' }}
summary-always: true
comment-on-alert: true
fail-on-alert: false
alert-threshold: "150%"
max-items-in-chart: 100
- name: Fetch benchmark history
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
if git fetch origin gh-pages 2>/dev/null; then
git checkout origin/gh-pages -- dev/bench/data.js 2>/dev/null || echo "No data.js found on gh-pages yet"
else
echo "No gh-pages branch yet — skipping regression check"
fi
- name: Check for performance regression (IQR)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
if [ -f dev/bench/data.js ]; then
python .github/scripts/check_regression.py dev/bench/data.js "KotlinTextMate Benchmark"
else
echo "No benchmark history found — skipping regression check"
fi
- name: Upload benchmark results
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: benchmark-results-${{ github.sha }}
path: benchmark/build/reports/benchmarks/
retention-days: 90