Skip to content

Commit 9334719

Browse files
committed
Restructure to multi-layer workflow dispatch
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent 5bddb05 commit 9334719

3 files changed

Lines changed: 59 additions & 54 deletions

File tree

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: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,25 @@
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

56
concurrency:
67
# The group causes runs to queue instead of running in parallel.
7-
# Use a unique group for non-benchmark label events so they don't interfere with in-progress benchmark runs.
8-
group: >-
9-
${{ github.workflow }}-${{
10-
github.event.label.name == 'action/benchmark'
11-
&& github.head_ref
12-
|| github.run_id
13-
}}
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
149
# Don't cancel benchmarks that are already running, instead just queue them up.
1510
cancel-in-progress: false
1611

1712
on:
18-
pull_request:
19-
types: [labeled, synchronize]
20-
branches: ["develop"]
13+
workflow_call: { }
2114
workflow_dispatch: { }
2215

2316
permissions:
24-
actions: write # for removing labels
2517
contents: read
2618
pull-requests: write # for commenting on PRs
2719
id-token: write # enables AWS-GitHub OIDC
2820

2921
jobs:
30-
label_trigger:
31-
runs-on: ubuntu-latest
32-
timeout-minutes: 120
33-
if: ${{ contains(github.event.head_commit.message, '[benchmark]') || github.event.label.name == 'action/benchmark' && github.event_name == 'pull_request' }}
34-
steps:
35-
# We remove the benchmark label first so that the workflow can be re-triggered.
36-
- uses: actions-ecosystem/action-remove-labels@v1
37-
if: ${{ github.event.pull_request.head.repo.full_name == 'vortex-data/vortex' }}
38-
with:
39-
labels: action/benchmark
40-
fail_on_error: true
41-
4222
bench:
43-
needs: label_trigger
4423
timeout-minutes: 120
4524
runs-on: >-
4625
${{ github.repository == 'vortex-data/vortex'
@@ -54,7 +33,6 @@ jobs:
5433
build_args: "--features lance"
5534
- id: compress-bench
5635
name: Compression
57-
if: ${{ contains(github.event.head_commit.message, '[benchmark]') || github.event.label.name == 'action/benchmark' && github.event_name == 'pull_request' }}
5836
steps:
5937
- uses: runs-on/action@v2
6038
if: github.event.pull_request.head.repo.fork == false
@@ -143,17 +121,16 @@ jobs:
143121
comment-tag: bench-pr-comment-${{ matrix.benchmark.id }}
144122

145123
- name: Comment PR on failure
146-
if: failure() && inputs.mode == 'pr' && github.event.pull_request.head.repo.fork == false
124+
if: failure() && github.event.pull_request.head.repo.fork == false
147125
uses: thollander/actions-comment-pull-request@v3
148126
with:
149127
message: |
150-
# 🚨🚨🚨❌❌❌ BENCHMARK FAILED ❌❌❌🚨🚨🚨
128+
# BENCHMARK FAILED
151129
152130
Benchmark `${{ matrix.benchmark.name }}` failed! Check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
153131
comment-tag: bench-pr-comment-${{ matrix.benchmark.id }}
154132

155133
sql:
156-
needs: label_trigger
157134
uses: ./.github/workflows/sql-benchmarks.yml
158135
secrets: inherit
159136
with:

.github/workflows/sql-pr.yml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,23 @@
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

56
concurrency:
6-
# Use a unique group for non-benchmark label events so they don't interfere with in-progress benchmark runs.
7-
group: >-
8-
${{ github.workflow }}-${{
9-
github.event.label.name == 'action/benchmark-sql'
10-
&& github.head_ref
11-
|| github.run_id
12-
}}
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
138
cancel-in-progress: true
149

1510
on:
16-
pull_request:
17-
types: [labeled, synchronize]
18-
branches: ["develop"]
11+
workflow_call: { }
1912
workflow_dispatch: { }
2013

2114
permissions:
22-
actions: write # for removing labels
2315
contents: read
2416
pull-requests: write # for commenting on PRs
2517
id-token: write # enables AWS-GitHub OIDC
2618

2719
jobs:
28-
label_trigger:
29-
runs-on: ubuntu-latest
30-
timeout-minutes: 2
31-
if: ${{ contains(github.event.head_commit.message, '[benchmark-sql]') || github.event.label.name == 'action/benchmark-sql' && github.event_name == 'pull_request' }}
32-
steps:
33-
# We remove the benchmark label first so that the workflow can be re-triggered.
34-
- uses: actions-ecosystem/action-remove-labels@v1
35-
if: ${{ github.event.pull_request.head.repo.full_name == 'vortex-data/vortex' }}
36-
with:
37-
labels: action/benchmark-sql
38-
fail_on_error: true
39-
4020
sql:
41-
needs: label_trigger
4221
uses: ./.github/workflows/sql-benchmarks.yml
4322
secrets: inherit
4423
with:

0 commit comments

Comments
 (0)