WIP #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: [ '**' ] | |
push: | |
branches: [ '**' ] | |
tags: [ v* ] | |
jobs: | |
ci: | |
# run on external PRs, but not on internal PRs since those will be run by push to branch | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '21' | |
cache: 'maven' | |
- name: Test | |
run: mvn --batch-mode --update-snapshots verify | |
benchmark: | |
needs: [ ci ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '21' | |
cache: 'maven' | |
- name: Run java benchmarks | |
run: | | |
mvn package -DskipTests=true | |
java -Djmh.executor=VIRTUAL -jar bench/bench-java/target/benchmarks.jar -i 5 -wi 3 -f 3 -to 2100ms -r 2000ms -w 2000ms -rf json | |
- name: Run kotlin benchmarks | |
run: | | |
java -jar bench/bench-kotlin/target/benchmarks.jar -i 10 -wi 5 -f 3 -to 2100ms -r 2000ms -w 2000ms -rf json -rff jmh-result-kotlin.json | |
- name: Merge java and kotlin benchmark results | |
run: jq -s '.[0] + .[1]' jmh-result.json jmh-result-kotlin.json > jmh-result-both.json | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Check & store benchmark result | |
uses: benchmark-action/github-action-benchmark@v1 | |
# Only store updated benchmark results on main branch | |
if: steps.extract_branch.outputs.branch == 'main' | |
with: | |
tool: 'jmh' | |
output-file-path: jmh-result-both.json | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
auto-push: true | |
# Show alert with commit comment on detecting possible performance regression | |
alert-threshold: '120%' | |
# Enable alert commit comment | |
comment-on-alert: true | |
fail-on-alert: true | |
alert-comment-cc-users: '@adamw' | |
# Store benchmark results in the docs folder of the main branch | |
gh-pages-branch: ${{ steps.extract_branch.outputs.branch }} | |
benchmark-data-dir-path: 'docs/bench' | |
skip-fetch-gh-pages: true | |
- name: Check benchmark result | |
uses: benchmark-action/github-action-benchmark@v1 | |
# PRs, other branches - the only difference in config is auto-push: false | |
if: steps.extract_branch.outputs.branch != 'main' | |
with: | |
tool: 'jmh' | |
output-file-path: jmh-result-both.json | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
auto-push: false | |
alert-threshold: '120%' | |
comment-on-alert: true | |
fail-on-alert: true | |
alert-comment-cc-users: '@adamw' | |
gh-pages-branch: ${{ steps.extract_branch.outputs.branch }} | |
benchmark-data-dir-path: 'docs/bench' | |
skip-fetch-gh-pages: true |