feat: basic authn benchmark #12
Workflow file for this run
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: Benchmarks | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: Run Benchmarks | |
run: ./run-benchmarks.sh | |
working-directory: ./benchmark | |
- name: Upload Results | |
uses: actions/[email protected] | |
with: | |
name: Benchmark Results | |
path: ./benchmark/jmh-result.json | |
- name: Comment With Results | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const results = JSON.parse(fs.readFileSync('./benchmark/jmh-result.json', 'utf8')); | |
function resultsAsTable() { | |
const benchmarkInfo = results[0]; | |
const benchmarkName = benchmarkInfo.benchmark; | |
const score = benchmarkInfo.primaryMetric.score; | |
const scoreUnit = benchmarkInfo.primaryMetric.scoreUnit; | |
const header = '| Benchmark | Score |\n| --- | --- | --- |'; | |
const rows = results.map(benchmarkInfo => { | |
const benchmarkName = benchmarkInfo.benchmark; | |
const score = benchmarkInfo.primaryMetric.score.toFixed(2); | |
const scoreUnit = benchmarkInfo.primaryMetric.scoreUnit; | |
return `| ${benchmarkName} | ${score} ${scoreUnit} |`; | |
}); | |
return `Benchmark Results\n---\n\n${header}\n${rows.join('\n')}`; | |
} | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: resultsAsTable(), | |
}); | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |