Skip to content

Commit 3698755

Browse files
committed
Filter out ci jobs when docs-only changes
1 parent 11b364b commit 3698755

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ concurrency:
4747
cancel-in-progress: true
4848

4949
jobs:
50+
path-filters:
51+
runs-on: ubuntu-latest
52+
outputs:
53+
docs: ${{ steps.filter.outputs.docs }}
54+
non_docs: ${{ steps.filter.outputs.non_docs }}
55+
steps:
56+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
57+
id: filter
58+
with:
59+
filters: |
60+
docs: 'docs/**'
61+
non_docs: '!docs/**'
62+
5063
maven-checks:
5164
runs-on: ubuntu-latest
5265
name: maven-checks ${{ matrix.java-version }}
@@ -86,6 +99,8 @@ jobs:
8699
run: rm -rf ~/.m2/repository/io/trino/trino-*
87100

88101
artifact-checks:
102+
needs: path-filters
103+
if: needs.path-filters.outputs.non_docs == 'true'
89104
runs-on: ubuntu-latest
90105
timeout-minutes: 45
91106
steps:
@@ -119,8 +134,9 @@ jobs:
119134
run: core/docker/build.sh
120135

121136
check-commits-dispatcher:
137+
needs: path-filters
138+
if: github.event_name == 'pull_request' && needs.path-filters.outputs.non_docs == 'true'
122139
runs-on: ubuntu-latest
123-
if: github.event_name == 'pull_request'
124140
outputs:
125141
matrix: ${{ steps.set-matrix.outputs.matrix }}
126142
steps:
@@ -172,6 +188,8 @@ jobs:
172188
base_ref: ${{ github.event.pull_request.base.ref }}
173189

174190
error-prone-checks:
191+
needs: path-filters
192+
if: needs.path-filters.outputs.non_docs == 'true'
175193
runs-on: ubuntu-latest
176194
timeout-minutes: 45
177195
steps:
@@ -200,6 +218,8 @@ jobs:
200218
-pl '!:trino-docs,!:trino-server'
201219
202220
test-jdbc-compatibility:
221+
needs: path-filters
222+
if: needs.path-filters.outputs.non_docs == 'true'
203223
runs-on: ubuntu-latest
204224
timeout-minutes: 30
205225
steps:
@@ -240,6 +260,8 @@ jobs:
240260
upload-heap-dump: ${{ env.SECRETS_PRESENT == '' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
241261

242262
hive-tests:
263+
needs: path-filters
264+
if: needs.path-filters.outputs.non_docs == 'true'
243265
runs-on: ubuntu-latest
244266
strategy:
245267
fail-fast: false
@@ -296,6 +318,8 @@ jobs:
296318
github_token: ${{ secrets.GITHUB_TOKEN }}
297319

298320
test-other-modules:
321+
needs: path-filters
322+
if: needs.path-filters.outputs.non_docs == 'true'
299323
runs-on: ubuntu-latest
300324
timeout-minutes: 60
301325
steps:
@@ -383,6 +407,8 @@ jobs:
383407
upload-heap-dump: ${{ env.SECRETS_PRESENT == '' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
384408

385409
build-test-matrix:
410+
needs: path-filters
411+
if: needs.path-filters.outputs.non_docs == 'true'
386412
runs-on: ubuntu-latest
387413
outputs:
388414
matrix: ${{ steps.set-matrix.outputs.matrix }}
@@ -806,6 +832,8 @@ jobs:
806832
github_token: ${{ secrets.GITHUB_TOKEN }}
807833

808834
build-pt:
835+
needs: path-filters
836+
if: needs.path-filters.outputs.non_docs == 'true'
809837
runs-on: ubuntu-latest
810838
outputs:
811839
matrix: ${{ steps.set-matrix.outputs.matrix }}
@@ -1099,6 +1127,7 @@ jobs:
10991127
- error-prone-checks
11001128
- hive-tests
11011129
- maven-checks
1130+
- path-filters
11021131
- pt
11031132
- test
11041133
- test-jdbc-compatibility
@@ -1115,6 +1144,7 @@ jobs:
11151144
echo '${{ needs.error-prone-checks.result }}' | grep -xE 'success|skipped' || { echo 'Job "error-prone-checks" failed' >&2; exit 1; }
11161145
echo '${{ needs.hive-tests.result }}' | grep -xE 'success|skipped' || { echo 'Job "hive-tests" failed' >&2; exit 1; }
11171146
echo '${{ needs.maven-checks.result }}' | grep -xE 'success|skipped' || { echo 'Job "maven-checks" failed' >&2; exit 1; }
1147+
echo '${{ needs.path-filters.result }}' | grep -xE 'success|skipped' || { echo 'Job "path-filters" failed' >&2; exit 1; }
11181148
echo '${{ needs.pt.result }}' | grep -xE 'success|skipped' || { echo 'Job "pt" failed' >&2; exit 1; }
11191149
echo '${{ needs.test.result }}' | grep -xE 'success|skipped' || { echo 'Job "test" failed' >&2; exit 1; }
11201150
echo '${{ needs.test-jdbc-compatibility.result }}' | grep -xE 'success|skipped' || { echo 'Job "test-jdbc-compatibility" failed' >&2; exit 1; }

0 commit comments

Comments
 (0)