-
Notifications
You must be signed in to change notification settings - Fork 12
51 lines (46 loc) · 1.5 KB
/
benchmark-labeled.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
name: benchmark
on:
pull_request_target:
types: [opened, reopened, synchronize, labeled] # Default ([opened, reopened, synchronize]) + labeled
branches-ignore:
- '*docs'
- '*noci'
jobs:
get-setup:
name: Get Benchmark Setup(s)
runs-on: ubuntu-latest
outputs:
setup: ${{ steps.get-setup.outputs.setup }}
has-setup: ${{ steps.get-setup.outputs.has-setup }}
steps:
- name: Check Labels
id: get-setup
shell: python
run: |
import os
if '${{ github.event.action }}' == 'labeled':
# Get labels from event
labels = ['${{ github.event.label.name }}']
else:
# Get labels from PR
labels = ${{ toJson(github.event.pull_request.labels.*.name) }}
if 'benchmarks-all' in labels:
# Only run benchmarks-all
labels = ['benchmarks-all']
else:
# Filter out non-benchmark labels
labels = [l for l in labels if l.startswith('benchmark') or l.startswith('bm-')]
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
print(f'setup={labels}', file=f)
print(f'has-setup={len(labels) > 0}', file=f)
bm_invoker:
needs: get-setup
name: Trigger
if: needs.get-setup.outputs.has-setup == 'True'
strategy:
matrix:
setup: ${{ fromJson(needs.get-setup.outputs.setup) }}
uses: ./.github/workflows/benchmark.yml
secrets: inherit
with:
setup: ${{ matrix.setup }}