generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.yml
81 lines (72 loc) · 3.05 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: "CodSpeed Performance Analysis"
description: "Continuous benchmarking and performance checks"
branding:
color: orange
icon: activity
author: "Arthur Pastel"
inputs:
token:
description: "CodSpeed upload token"
required: false
run:
description: "The command to run the benchmarks"
required: true
working-directory:
description: |
The directory where the `run` command will be executed.
Warning: if you use defaults.working-directory, you must still set this parameter.
required: false
upload-url:
description: "The upload endpoint (for on-premise deployments)"
required: false
runner-version:
description: "The version of the runner to use"
required: false
instruments:
description: |
Comma separated list of instruments to enable. The following instruments are available:
- `mongodb`: MongoDB instrumentation, requires the MongoDB instrument to be enabled for the organization in CodSpeed
required: false
mongo-uri-env-name:
description: |
The name of the environment variable containing the MongoDB URI. Requires the `mongodb` instrument to be activated in `instruments`.
If the instrumentation is enabled and this value is not set, the user will need to dynamically provide the MongoDB URI to the CodSpeed runner.
required: false
runs:
using: "composite"
steps:
- shell: bash
run: |
# Configure and run codspeed-runner
if [ -n "${{ inputs.runner-version }}" ]; then
RUNNER_VERSION="${{ inputs.runner-version }}"
else
RUNNER_VERSION=$(cat $GITHUB_ACTION_PATH/.codspeed-runner-version)
fi
# Get the runner arguments
RUNNER_ARGS=""
if [ -n "${{ inputs.token }}" ]; then
RUNNER_ARGS="$RUNNER_ARGS --token ${{ inputs.token }}"
fi
if [ -n "${{ inputs.working-directory }}" ]; then
RUNNER_ARGS="$RUNNER_ARGS --working-directory=${{ inputs.working-directory }}"
fi
if [ -n "${{ inputs.upload-url }}" ]; then
RUNNER_ARGS="$RUNNER_ARGS --upload-url=${{ inputs.upload-url }}"
fi
if [ -n "${{ inputs.instruments }}" ]; then
RUNNER_ARGS="$RUNNER_ARGS --instruments=${{ inputs.instruments }}"
fi
if [ -n "${{ inputs.mongo-uri-env-name }}" ]; then
RUNNER_ARGS="$RUNNER_ARGS --mongo-uri-env-name=${{ inputs.mongo-uri-env-name }}"
fi
# Install the CodSpeedHQ/runner
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 $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$RUNNER_VERSION/codspeed-runner-installer.sh | bash -s -- --quiet
fi
# Run the benchmarks
codspeed run $RUNNER_ARGS -- '${{ inputs.run }}'