Skip to content

Commit 6fade3c

Browse files
authored
Unify benchmark dispatch into a workflow (#7178)
This PR started as something else, but I still think its nicer to split the flows into another workflow to handle triggering the benchmarks themselves. --------- Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent 48fe372 commit 6fade3c

File tree

3 files changed

+57
-40
lines changed

3 files changed

+57
-40
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Dispatches benchmark workflows when benchmark labels are added to pull requests.
2+
# This is a separate workflow so that non-benchmark label events don't create
3+
# phantom check suites that obscure in-progress benchmark runs on the PR.
4+
5+
name: Benchmark Dispatch
6+
7+
on:
8+
pull_request:
9+
types: [labeled]
10+
branches: ["develop"]
11+
12+
permissions:
13+
actions: write
14+
contents: read
15+
pull-requests: write # for label removal and PR comments
16+
id-token: write # enables AWS-GitHub OIDC
17+
18+
jobs:
19+
remove-bench-label:
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 2
22+
if: github.event.label.name == 'action/benchmark'
23+
steps:
24+
- uses: actions-ecosystem/action-remove-labels@v1
25+
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
26+
with:
27+
labels: action/benchmark
28+
fail_on_error: true
29+
30+
bench:
31+
needs: remove-bench-label
32+
uses: ./.github/workflows/bench-pr.yml
33+
secrets: inherit
34+
35+
remove-sql-label:
36+
runs-on: ubuntu-latest
37+
timeout-minutes: 2
38+
if: github.event.label.name == 'action/benchmark-sql'
39+
steps:
40+
- uses: actions-ecosystem/action-remove-labels@v1
41+
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
42+
with:
43+
labels: action/benchmark-sql
44+
fail_on_error: true
45+
46+
sql-bench:
47+
needs: remove-sql-label
48+
uses: ./.github/workflows/sql-pr.yml
49+
secrets: inherit

.github/workflows/bench-pr.yml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Runs all benchmarks once when we add the `action/benchmark` tag to a pull request.
1+
# Runs all benchmarks once for a pull request.
2+
# Called from bench-dispatch.yml when the `action/benchmark` label is added.
23

34
name: PR Benchmarks
45

@@ -9,32 +10,16 @@ concurrency:
910
cancel-in-progress: false
1011

1112
on:
12-
pull_request:
13-
types: [labeled, synchronize]
14-
branches: ["develop"]
13+
workflow_call: { }
1514
workflow_dispatch: { }
1615

1716
permissions:
18-
actions: write # for removing labels
1917
contents: read
2018
pull-requests: write # for commenting on PRs
2119
id-token: write # enables AWS-GitHub OIDC
2220

2321
jobs:
24-
label_trigger:
25-
runs-on: ubuntu-latest
26-
timeout-minutes: 120
27-
if: ${{ contains(github.event.head_commit.message, '[benchmark]') || github.event.label.name == 'action/benchmark' && github.event_name == 'pull_request' }}
28-
steps:
29-
# We remove the benchmark label first so that the workflow can be re-triggered.
30-
- uses: actions-ecosystem/action-remove-labels@v1
31-
if: ${{ github.event.pull_request.head.repo.full_name == 'vortex-data/vortex' }}
32-
with:
33-
labels: action/benchmark
34-
fail_on_error: true
35-
3622
bench:
37-
needs: label_trigger
3823
timeout-minutes: 120
3924
runs-on: >-
4025
${{ github.repository == 'vortex-data/vortex'
@@ -48,7 +33,6 @@ jobs:
4833
build_args: "--features lance"
4934
- id: compress-bench
5035
name: Compression
51-
if: ${{ contains(github.event.head_commit.message, '[benchmark]') || github.event.label.name == 'action/benchmark' && github.event_name == 'pull_request' }}
5236
steps:
5337
- uses: runs-on/action@v2
5438
if: github.event.pull_request.head.repo.fork == false
@@ -137,17 +121,16 @@ jobs:
137121
comment-tag: bench-pr-comment-${{ matrix.benchmark.id }}
138122

139123
- name: Comment PR on failure
140-
if: failure() && inputs.mode == 'pr' && github.event.pull_request.head.repo.fork == false
124+
if: failure() && github.event.pull_request.head.repo.fork == false
141125
uses: thollander/actions-comment-pull-request@v3
142126
with:
143127
message: |
144-
# 🚨🚨🚨❌❌❌ BENCHMARK FAILED ❌❌❌🚨🚨🚨
128+
# BENCHMARK FAILED
145129
146130
Benchmark `${{ matrix.benchmark.name }}` failed! Check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
147131
comment-tag: bench-pr-comment-${{ matrix.benchmark.id }}
148132

149133
sql:
150-
needs: label_trigger
151134
uses: ./.github/workflows/sql-benchmarks.yml
152135
secrets: inherit
153136
with:

.github/workflows/sql-pr.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Runs once when we add the `benchmark-sql` tag to a pull request.
1+
# Runs SQL benchmarks once for a pull request.
2+
# Called from bench-dispatch.yml when the `action/benchmark-sql` label is added.
23

34
name: PR SQL Benchmarks
45

@@ -7,32 +8,16 @@ concurrency:
78
cancel-in-progress: true
89

910
on:
10-
pull_request:
11-
types: [labeled, synchronize]
12-
branches: ["develop"]
11+
workflow_call: { }
1312
workflow_dispatch: { }
1413

1514
permissions:
16-
actions: write # for removing labels
1715
contents: read
1816
pull-requests: write # for commenting on PRs
1917
id-token: write # enables AWS-GitHub OIDC
2018

2119
jobs:
22-
label_trigger:
23-
runs-on: ubuntu-latest
24-
timeout-minutes: 2
25-
if: ${{ contains(github.event.head_commit.message, '[benchmark-sql]') || github.event.label.name == 'action/benchmark-sql' && github.event_name == 'pull_request' }}
26-
steps:
27-
# We remove the benchmark label first so that the workflow can be re-triggered.
28-
- uses: actions-ecosystem/action-remove-labels@v1
29-
if: ${{ github.event.pull_request.head.repo.full_name == 'vortex-data/vortex' }}
30-
with:
31-
labels: action/benchmark-sql
32-
fail_on_error: true
33-
3420
sql:
35-
needs: label_trigger
3621
uses: ./.github/workflows/sql-benchmarks.yml
3722
secrets: inherit
3823
with:

0 commit comments

Comments
 (0)