Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ on:
workflow_dispatch:
inputs:
ref:
description: "Git ref to benchmark"
description: "Git ref to benchmark; defaults to the version input, then the selected workflow ref"
required: false
default: "main"
default: ""
version:
description: "Version label to publish; defaults to the selected ref"
required: false
default: ""
pattern:
description: "JMH benchmark pattern"
description: "JMH benchmark pattern; defaults to all benchmarks"
required: false
default: "JRTCompare2Benchmark"
default: ".*"
jmhArgs:
description: "Extra JMH arguments; when provided, CLI options override benchmark annotations"
required: false
Expand All @@ -33,7 +33,7 @@ concurrency:
cancel-in-progress: false

env:
DEFAULT_JMH_PATTERN: JRTCompare2Benchmark
DEFAULT_JMH_PATTERN: .*
BENCHMARK_SITE_URL: https://jawk.io/

jobs:
Expand All @@ -46,7 +46,15 @@ jobs:
publish: ${{ steps.select.outputs.publish }}

steps:
- name: Checkout repository
- name: Checkout selected benchmark ref
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ inputs.ref || inputs.version || github.ref }}

- name: Checkout triggering ref
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v6
with:
fetch-depth: 0
Expand Down Expand Up @@ -75,7 +83,7 @@ jobs:
jmh_args=""
publish="true"
else
ref="${INPUT_REF}"
ref="${INPUT_REF:-${INPUT_VERSION:-${GITHUB_REF_NAME}}}"
version="${INPUT_VERSION}"
pattern="${INPUT_PATTERN}"
jmh_args="${INPUT_JMH_ARGS}"
Expand All @@ -91,20 +99,6 @@ jobs:
if [ -z "${pattern}" ]; then
pattern="${DEFAULT_JMH_PATTERN}"
fi
if [[ "${ref}" == -* ]]; then
echo "Benchmark ref must not start with '-'." >&2
exit 1
fi

git fetch --tags --force origin
if commit="$(git rev-parse --verify --quiet -- "${ref}^{commit}")"; then
git checkout --detach "${commit}"
else
git fetch origin -- "${ref}"
commit="$(git rev-parse --verify --quiet -- "FETCH_HEAD^{commit}")"
git checkout --detach "${commit}"
fi

safe_version="$(printf '%s' "${version}" | tr '/\\ ' '---' | tr -cd 'A-Za-z0-9._-')"
if [ -z "${safe_version}" ]; then
safe_version="$(git rev-parse --short HEAD)"
Expand Down
Loading