Skip to content

Commit 2edda65

Browse files
committed
Filter out ci jobs when docs-only changes
1 parent 556cd4a commit 2edda65

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,22 @@ 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:
64+
needs: path-filters
65+
if: needs.path-filters.outputs.non_docs == 'true'
5166
runs-on: ubuntu-latest
5267
name: maven-checks ${{ matrix.java-version }}
5368
strategy:
@@ -86,6 +101,8 @@ jobs:
86101
run: rm -rf ~/.m2/repository/io/trino/trino-*
87102

88103
artifact-checks:
104+
needs: path-filters
105+
if: needs.path-filters.outputs.non_docs == 'true'
89106
runs-on: ubuntu-latest
90107
timeout-minutes: 45
91108
steps:
@@ -119,8 +136,9 @@ jobs:
119136
run: core/docker/build.sh
120137

121138
check-commits-dispatcher:
139+
needs: path-filters
140+
if: github.event_name == 'pull_request' && needs.path-filters.outputs.non_docs == 'true'
122141
runs-on: ubuntu-latest
123-
if: github.event_name == 'pull_request'
124142
outputs:
125143
matrix: ${{ steps.set-matrix.outputs.matrix }}
126144
steps:
@@ -172,6 +190,8 @@ jobs:
172190
base_ref: ${{ github.event.pull_request.base.ref }}
173191

174192
error-prone-checks:
193+
needs: path-filters
194+
if: needs.path-filters.outputs.non_docs == 'true'
175195
runs-on: ubuntu-latest
176196
timeout-minutes: 45
177197
steps:
@@ -200,6 +220,8 @@ jobs:
200220
-pl '!:trino-docs,!:trino-server'
201221
202222
test-jdbc-compatibility:
223+
needs: path-filters
224+
if: needs.path-filters.outputs.non_docs == 'true'
203225
runs-on: ubuntu-latest
204226
timeout-minutes: 30
205227
steps:
@@ -240,6 +262,8 @@ jobs:
240262
upload-heap-dump: ${{ env.SECRETS_PRESENT == '' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
241263

242264
hive-tests:
265+
needs: path-filters
266+
if: needs.path-filters.outputs.non_docs == 'true'
243267
runs-on: ubuntu-latest
244268
strategy:
245269
fail-fast: false
@@ -296,6 +320,8 @@ jobs:
296320
github_token: ${{ secrets.GITHUB_TOKEN }}
297321

298322
test-other-modules:
323+
needs: path-filters
324+
if: needs.path-filters.outputs.non_docs == 'true'
299325
runs-on: ubuntu-latest
300326
timeout-minutes: 60
301327
steps:
@@ -383,6 +409,8 @@ jobs:
383409
upload-heap-dump: ${{ env.SECRETS_PRESENT == '' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
384410

385411
build-test-matrix:
412+
needs: path-filters
413+
if: needs.path-filters.outputs.non_docs == 'true'
386414
runs-on: ubuntu-latest
387415
outputs:
388416
matrix: ${{ steps.set-matrix.outputs.matrix }}
@@ -806,6 +834,8 @@ jobs:
806834
github_token: ${{ secrets.GITHUB_TOKEN }}
807835

808836
build-pt:
837+
needs: path-filters
838+
if: needs.path-filters.outputs.non_docs == 'true'
809839
runs-on: ubuntu-latest
810840
outputs:
811841
matrix: ${{ steps.set-matrix.outputs.matrix }}
@@ -1099,6 +1129,7 @@ jobs:
10991129
- error-prone-checks
11001130
- hive-tests
11011131
- maven-checks
1132+
- path-filters
11021133
- pt
11031134
- test
11041135
- test-jdbc-compatibility
@@ -1115,6 +1146,7 @@ jobs:
11151146
echo '${{ needs.error-prone-checks.result }}' | grep -xE 'success|skipped' || { echo 'Job "error-prone-checks" failed' >&2; exit 1; }
11161147
echo '${{ needs.hive-tests.result }}' | grep -xE 'success|skipped' || { echo 'Job "hive-tests" failed' >&2; exit 1; }
11171148
echo '${{ needs.maven-checks.result }}' | grep -xE 'success|skipped' || { echo 'Job "maven-checks" failed' >&2; exit 1; }
1149+
echo '${{ needs.path-filters.result }}' | grep -xE 'success|skipped' || { echo 'Job "path-filters" failed' >&2; exit 1; }
11181150
echo '${{ needs.pt.result }}' | grep -xE 'success|skipped' || { echo 'Job "pt" failed' >&2; exit 1; }
11191151
echo '${{ needs.test.result }}' | grep -xE 'success|skipped' || { echo 'Job "test" failed' >&2; exit 1; }
11201152
echo '${{ needs.test-jdbc-compatibility.result }}' | grep -xE 'success|skipped' || { echo 'Job "test-jdbc-compatibility" failed' >&2; exit 1; }

0 commit comments

Comments
 (0)