Kotlin benchmarks #1
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: Kotlin benchmarks | ||
on: | ||
workflow_dispatch: | ||
permissions: | ||
content: write | ||
jobs: | ||
get-inputs: | ||
uses: ephemient/aoc2023/.github/workflows/get-inputs.yml@main | ||
secrets: | ||
SESSION: ${{ secrets.SESSION }} | ||
jmh-visualizer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: jzillmann/jmh-visualizer | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
- run: npm install | ||
- run: npm run providedZip | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: jmh-visualizer | ||
path: jmh-visualizer.zip | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: inputs | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
- uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: assembleBenchmarks | ||
build-root-directory: kt | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: jvmBench | ||
path: kt/aoc2023-exe/build/benchmarks/*/jars/*.jar | ||
run: | ||
needs: [ get-inputs, jmh-visualizer, build ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: gh-docs | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: inputs | ||
path: inputs | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: jmh-visualizer | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: jvmBench | ||
- run: rm -rf jmh-visualizer | ||
- run: unzip -d jmh-visualizer jmh-visualizer.zip | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
- name: Run JVM benchmarks | ||
run: | | ||
cat >config <<EOF | ||
name:jvmBench | ||
reportFile:jvmBench.json | ||
traceFormat:text | ||
warmups:1 | ||
iterationTime:1 | ||
outputTimeUnit:SECONDS | ||
EOF | ||
java -cp jvmBench/jars/*.jar kotlinx.benchmark.jvm.JvmBenchmarkRunnerKt config | ||
env: | ||
AOC2023_DATADIR: inputs | ||
- name: Create provided.js | ||
run: | | ||
shopt -s failglob | ||
names=() jsonargs=() | ||
for file in *.json; do | ||
name=${file##*/} | ||
name=${name%.*} | ||
names+=("$name") | ||
jsonargs+=(--slurpfile "$name" "$file") | ||
done | ||
cat >jmh-visualizer/provided.js <<EOF | ||
// provided.js - generated by ${{ github.repository }}/${{ github.workflow }}, $(date +'%Y-%m-%d %H:%M:%S.%N') | ||
var providedBenchmarks = $(jq --null-input --compact-output '$ARGS.positional|unique' --args "${names[@]}"); | ||
var providedBenchmarkStore = $(jq --null-input '$ARGS.named|map_values(.[0])' "${jsonargs[@]}"); | ||
EOF | ||
- uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: jmh-visualizer | ||
message: 'kotlinx.benchmark ${{ github.sha }}' |