Skip to content

Commit

Permalink
feat: get the runner version from a file
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Feb 22, 2024
1 parent 1d8d078 commit be36cbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .codspeed-runner-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.0
15 changes: 10 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ inputs:

runner-version:
description: "The version of the runner to use"
default: "2.2.0"
required: true
required: false

instruments:
description: |
Expand All @@ -45,6 +44,12 @@ runs:
run: |
# Configure and run codspeed-runner
if [ -n "${{ inputs.runner-version }}" ]; then
RUNNER_VERSION="${{ inputs.runner-version }}"
else
RUNNER_VERSION=$(cat .codspeed-runner-version)
fi
# Get the runner arguments
RUNNER_ARGS=""
if [ -n "${{ inputs.token }}" ]; then
Expand All @@ -64,12 +69,12 @@ runs:
fi
# Install the CodSpeedHQ/runner
head_status=$(curl -I -fsSL -w "%{http_code}" -o /dev/null https://github.com/CodSpeedHQ/runner/releases/download/v${{ inputs.runner-version }}/codspeed-runner-installer.sh)
head_status=$(curl -I -fsSL -w "%{http_code}" -o /dev/null https://github.com/CodSpeedHQ/runner/releases/download/v$RUNNER_VERSION/codspeed-runner-installer.sh)
if [ "$head_status" -eq 404 ]; then
echo "Error: Version ${{ inputs.runner-version }} is not available in https://github.com/CodSpeedHQ/runner/releases, please a correct version."
echo "Error: Version $RUNNER_VERSION is not available in https://github.com/CodSpeedHQ/runner/releases, please a correct version."
exit 1
else
curl -fsSL https://github.com/CodSpeedHQ/runner/releases/download/v${{ inputs.runner-version }}/codspeed-runner-installer.sh | bash -s -- --quiet
curl -fsSL https://github.com/CodSpeedHQ/runner/releases/download/v$RUNNER_VERSION/codspeed-runner-installer.sh | bash -s -- --quiet
fi
# Run the benchmarks
Expand Down

0 comments on commit be36cbf

Please sign in to comment.