@@ -19,11 +19,31 @@ concurrency:
1919 cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
2020
2121jobs :
22+ ci-scope :
23+ name : Detect CI Scope
24+ runs-on : ubuntu-latest
25+ outputs :
26+ fast-path : ${{ steps.scope.outputs.runtime-fast-path }}
27+ steps :
28+ - name : Checkout Repo
29+ uses : actions/checkout@v4
30+
31+ - name : Classify changed files
32+ id : scope
33+ uses : ./.github/actions/detect-ci-scope
34+ with :
35+ github-token : ${{ secrets.GITHUB_TOKEN }}
36+
2237 # Phase 0: Update PR comment to show benchmarks are running
2338 pr-comment-start :
2439 name : Create PR Comment
2540 runs-on : ubuntu-latest
26- if : github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'workflow-server-test')
41+ needs : ci-scope
42+ if : >-
43+ github.event_name == 'pull_request' &&
44+ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') &&
45+ (needs.ci-scope.outputs.fast-path != 'true' ||
46+ contains(github.event.pull_request.labels.*.name, 'community-benchmarks'))
2747 timeout-minutes : 2
2848
2949 steps :
@@ -127,7 +147,12 @@ jobs:
127147 build :
128148 name : Build Packages
129149 runs-on : ubuntu-latest
130- if : ${{ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
150+ needs : ci-scope
151+ if : >-
152+ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') &&
153+ (needs.ci-scope.outputs.fast-path != 'true' ||
154+ github.event_name == 'workflow_dispatch' ||
155+ contains(github.event.pull_request.labels.*.name, 'community-benchmarks'))
131156 timeout-minutes : 30
132157 env :
133158 TURBO_TOKEN : ${{ secrets.TURBO_TOKEN }}
@@ -156,8 +181,8 @@ jobs:
156181 benchmark-local :
157182 name : Benchmark Local (${{ matrix.app }})
158183 runs-on : ubuntu-latest
159- needs : build
160- if : ${{ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
184+ needs : [ci-scope, build]
185+ if : ${{ needs.ci-scope.outputs.fast-path != 'true' && !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
161186 timeout-minutes : 60
162187 strategy :
163188 fail-fast : false
@@ -239,8 +264,8 @@ jobs:
239264 benchmark-postgres :
240265 name : Benchmark Postgres (${{ matrix.app }})
241266 runs-on : ubuntu-latest
242- needs : build
243- if : ${{ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
267+ needs : [ci-scope, build]
268+ if : ${{ needs.ci-scope.outputs.fast-path != 'true' && !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
244269 timeout-minutes : 60
245270 strategy :
246271 fail-fast : false
@@ -343,8 +368,8 @@ jobs:
343368 benchmark-vercel :
344369 name : Benchmark Vercel (${{ matrix.app.name }})
345370 runs-on : ubuntu-latest
346- needs : build
347- if : ${{ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
371+ needs : [ci-scope, build]
372+ if : ${{ needs.ci-scope.outputs.fast-path != 'true' && !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
348373 timeout-minutes : 90
349374 permissions :
350375 id-token : write
@@ -446,7 +471,11 @@ jobs:
446471 getCommunityWorldsMatrix :
447472 name : Get Community Worlds Matrix
448473 runs-on : ubuntu-latest
449- if : ${{ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
474+ needs : ci-scope
475+ if : >-
476+ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') &&
477+ (github.event_name == 'workflow_dispatch' ||
478+ contains(github.event.pull_request.labels.*.name, 'community-benchmarks'))
450479 outputs :
451480 matrix : ${{ steps.set-matrix.outputs.matrix }}
452481 steps :
@@ -471,7 +500,10 @@ jobs:
471500
472501 benchmark-community :
473502 name : Benchmark Community World (${{ matrix.world.name }})
474- if : ${{ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') }}
503+ if : >-
504+ !contains(github.event.pull_request.labels.*.name, 'workflow-server-test') &&
505+ (github.event_name == 'workflow_dispatch' ||
506+ contains(github.event.pull_request.labels.*.name, 'community-benchmarks'))
475507 needs : [build, getCommunityWorldsMatrix]
476508 strategy :
477509 fail-fast : false
@@ -491,8 +523,12 @@ jobs:
491523 summary :
492524 name : Benchmark Summary
493525 runs-on : ubuntu-latest
494- needs : [benchmark-local, benchmark-postgres, benchmark-vercel, benchmark-community]
495- if : always() && !cancelled()
526+ needs : [ci-scope, benchmark-local, benchmark-postgres, benchmark-vercel, benchmark-community]
527+ if : >-
528+ always() && !cancelled() &&
529+ (needs.ci-scope.outputs.fast-path != 'true' ||
530+ github.event_name == 'workflow_dispatch' ||
531+ contains(github.event.pull_request.labels.*.name, 'community-benchmarks'))
496532 timeout-minutes : 10
497533
498534 steps :
0 commit comments