naive implementation of L2 #1129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |