Skip to content

Make select clauses immutable & reusable (#26) #127

Make select clauses immutable & reusable (#26)

Make select clauses immutable & reusable (#26) #127

Workflow file for this run

name: CI
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
tags: [ v* ]
jobs:
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: Test
run: mvn --batch-mode --update-snapshots verify
- name: Prepare release notes
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
id: benchmark_java
run: |
mvn package -DskipTests=true
java -Djmh.executor=VIRTUAL -jar bench/bench-java/target/benchmarks.jar -i 5 -wi 5 -f 3 -to 2100ms -r 2000ms -w 2000ms -rf json | tee out.txt
echo 'output<<EOF' >> $GITHUB_OUTPUT
cat out.txt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Run kotlin benchmarks
id: benchmark_kotlin
run: |
java -jar bench/bench-kotlin/target/benchmarks.jar -i 5 -wi 5 -f 3 -to 2100ms -r 2000ms -w 2000ms -rf json -rff jmh-result-kotlin.json | tee out.txt
echo 'output<<EOF' >> $GITHUB_OUTPUT
cat out.txt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- 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: Comment on PR with results
uses: actions/github-script@v7
env:
JAVA_OUTPUT: ${{ steps.benchmark_java.outputs.output }}
KOTLIN_OUTPUT: ${{ steps.benchmark_kotlin.outputs.output }}
with:
script: |
function extractContent(str) {
const regex = /^Benchmark([\s\S]*?)(?=^Benchmark result)/m;
const match = str.match(regex);
return match ? match[1].trim() : null;
}
// Only if there's a PR within which we run
if (context.issue.number) {
let javaResults = extractContent(`${process.env.JAVA_OUTPUT}`);
let kotlinResults = extractContent(`${process.env.KOTLIN_OUTPUT}`);
let comment = `<details><summary>Benchmark results</summary>
\`\`\`
Java:
${javaResults}
Kotlin:
${kotlinResults}
\`\`\`
</details>`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
}
publishReleaseNotes:
name: Publish release notes
needs: [ ci ]
runs-on: ubuntu-22.04
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Extract version from tag name
run: |
version=${GITHUB_REF/refs\/tags\/v/}
echo "VERSION=$version" >> $GITHUB_ENV
- name: Publish release notes
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
publish: true
name: "v${{ env.VERSION }}"
tag: "v${{ env.VERSION }}"
version: "v${{ env.VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}