-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yml
136 lines (122 loc) · 5.33 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: benchdiff
description: Runs go benchmarks on HEAD and a base branch and reports the resulting benchstat output.
branding:
icon: zap
color: purple
inputs:
benchdiff_args:
description: |
Arguments for the benchdiff command line. This action will run the command line `benchdiff <benchdiff_args>`
after making some adjustments to the arguments (listed below).
If `--base-ref` isn't present in the arguments, then `--base-ref <default branch>` will be added.
`--json` is always added because the action requires json formatted output.
`--benchstat-output=markdown` is added when no other benchstat-output value is set because the reports look best
with markdown formatting.
Consider this example:
```
--cpu=1,2 --warmup-count=1 --warmup-time=10ms --tolerance=50 --debug
```
`--cpu=1,2` is important on actions because runners have only two cores available to them.
`--warmup-count=1` and `warmup-time=10ms` cause benchdiff to do a quick warmup before starting the benchmarks.
This is important on actions because the runners appear to have a small amount of cpu burst available. If you burn
through that in the warmup, then it makes for a better cmoparison between the real runs.
`--tolerance=50` means that a benchmark isn't considered degraded unless it's delta is greater than +50%. Action
runners can have inconsistent performance within the same run. This helps mitigate a lot of false alarms.
`--debug` causes benchdiff to output raw results to stderr (among other debug data). I like having this on just
to see progress in the logs.
See https://github.com/willabides/benchdiff for all available flags.
default: ""
required: false
benchdiff_version:
description: |
Version of the benchdiff command to use.
When a new version of this action is released, the default value will be updated to the latest version of
benchdiff that isn't a breaking change from the previous default.
default: 0.5.6
required: false
report_status:
description: |
Whether to report the status. Any value other than "true" is interpreted as false.
I call this "status" because that's a better known term. What is actually created is a check-run.
default: "true"
required: false
status_name:
description: |
Name to use in reporting status. This is the name of the check-run that is created.
default: benchdiff
required: false
status_sha:
description: Report status to this sha. Default is the head of your benchdiff run.
default: ""
required: false
status_on_degraded:
description: |
Status to report for degraded results.
Options are "success", "failure" and "neutral"
default: "failure"
required: false
github_token:
description: |
Authentication token to use for reporting status.
If you use a non-default token it needs to be a token for a GitHub App installation with permission to create a
check-run.
required: false
default: ${{ github.token }}
outputs:
benchstat_output:
description: |
Stdout from the benchdiff command.
value: ${{ steps.run-benchdiff.outputs.benchstat_output }}
bench_command:
description: |
Command used to run benchmarks. This is derived from the `benchdiff_args` input.
value: ${{ steps.run-benchdiff.outputs.bench_command }}
degraded_result:
description:
Whether any of the benchmarks degraded between base and head.
value: ${{ steps.run-benchdiff.outputs.degraded_result }}
head_sha:
description: The git revision benchstat used as head.
value: ${{ steps.run-benchdiff.outputs.head_sha }}
base_sha:
description: The git revision benchstat used as base.
value: ${{ steps.run-benchdiff.outputs.base_sha }}
runs:
using: composite
steps:
- id: linux-only
shell: bash
run: |
if [ "${{ runner.os }}" != "Linux" ]; then
echo This action only runs on Linux
exit 1
fi
- id: install
shell: bash
run: |
export ACTION_PATH='${{ github.action_path }}'
export BENCHDIFF_DIR='${{ runner.temp }}/benchdiff'
export BENCHDIFF_VERSION='${{ inputs.benchdiff_version }}'
"$ACTION_PATH/src/install.sh"
- id: run-benchdiff
shell: bash
run: |
export ACTION_PATH='${{ github.action_path }}'
export BENCHDIFF_ARGS='${{ inputs.benchdiff_args }}'
export BENCHDIFF_DIR='${{ runner.temp }}/benchdiff'
"$ACTION_PATH/src/run.sh"
- id: report-status
shell: bash
run: |
export ACTION_PATH='${{ github.action_path }}'
export REPORT_STATUS='${{ inputs.report_status }}'
export BENCH_COMMAND='${{ steps.run-benchdiff.outputs.bench_command }}'
export BENCHSTAT_OUTPUT='${{ steps.run-benchdiff.outputs.benchstat_output }}'
export DEGRADED_RESULT='${{ steps.run-benchdiff.outputs.degraded_result }}'
export HEAD_SHA='${{ steps.run-benchdiff.outputs.head_sha }}'
export BASE_SHA='${{ steps.run-benchdiff.outputs.base_sha }}'
export STATUS_SHA='${{ inputs.status_sha }}'
export GH_TOKEN='${{ inputs.github_token }}'
export STATUS_NAME='${{ inputs.status_name }}'
export STATUS_ON_DEGRADED='${{ inputs.status_on_degraded }}'
"$ACTION_PATH/src/report-status.sh"