feat: basic authn benchmark #5
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 jmhResults = fs.readFileSync('./benchmark/jmh-results.json', 'utf-8'); | |
const prNumber = context.payload.pull_request.number; | |
function createCommentBody(results) { | |
const benchmarkInfo = results[0]; | |
const benchmarkName = benchmarkInfo.benchmark; | |
const score = benchmarkInfo.primaryMetric.score.toFixed(2); | |
const scoreUnit = benchmarkInfo.primaryMetric.scoreUnit; | |
return `JMH Benchmark Results:\n\n| Benchmark | Score | Score Unit |\n| --- | --- | --- |\n| ${benchmarkName} | ${score} ops/${scoreUnit} |`; | |
} | |
github.issues.createComment({ | |
issue_number: prNumber, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: createCommentBody(jmhResults), | |
}); | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |