Benchmark ⌛ #4
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: Benchmark ⌛ | |
on: | |
workflow_call: | |
inputs: | |
runner: | |
type: string | |
description: 'The machine runner the workflow should run on' | |
default: macos-13 | |
required: false | |
branch: | |
type: string | |
description: 'The branch to be benchmarked' | |
required: true | |
should-commit-benchmark: | |
type: boolean | |
description: 'If the produced report should be commited to the active branch' | |
default: false | |
required: false | |
workflow_dispatch: | |
inputs: | |
runner: | |
type: string | |
description: 'The machine runner the workflow should run on' | |
default: macos-13 | |
required: true | |
branch: | |
type: string | |
description: 'The branch to be benchmarked' | |
required: true | |
should-commit-benchmark: | |
type: boolean | |
description: 'If the produced report should be committed to the active branch' | |
default: false | |
required: false | |
jobs: | |
build: | |
runs-on: ${{ inputs.runner }} | |
permissions: | |
contents: write | |
steps: | |
- name: Clone Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch }} | |
- name: Set up jdk@21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '21' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Execute Gradle build | |
run: ./gradlew benchmark | |
- name: Upload any new reports | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reports | |
path: | | |
**/build/**/*Benchmark.csv | |
**/build/**/*Benchmark.json | |
- name: Move benchmark files | |
run: | | |
mkdir -p benchmark # This command ensures that the 'benchmark' directory exists | |
find . -type f \( -iname '*benchmark.json' -o -iname '*benchmark.csv' \) -exec mv {} ./benchmark/ \; | |
- name: Commit benchmark files | |
if: ${{ inputs.should-commit-benchmark }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add benchmark/* | |
git commit -m "Commit benchmark results" -a | |
git push |