Skip to content

Commit 7a96300

Browse files
authored
Run CI tests only if Trino and Gateway file change (#351)
* Add conditional tests for Trino and Gateway file changes in CI/CD workflow * Add `always() && !failure()` condition for running downstream jobs
1 parent c93ed8b commit 7a96300

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,38 @@ jobs:
2828
- name: Lint charts
2929
run: ct lint --charts=charts/trino,charts/gateway --validate-maintainers=false
3030

31+
changes:
32+
runs-on: ubuntu-latest
33+
name: changed trino/gateway files
34+
outputs:
35+
trino-changed: ${{ steps.filter.outputs.trino }}
36+
gateway-changed: ${{ steps.filter.outputs.gateway }}
37+
steps:
38+
- uses: actions/checkout@v4
39+
# Detect changes in trino/gatway files to conditionally run tests
40+
- name: Get changed related files
41+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
42+
id: filter
43+
with:
44+
filters: |
45+
trino:
46+
- 'charts/trino/**'
47+
- 'tests/trino/**'
48+
- '.helmignore'
49+
- '.github/**'
50+
- '.gitignore'
51+
gateway:
52+
- 'charts/gateway/**'
53+
- 'tests/gateway/**'
54+
- '.helmignore'
55+
- '.github/**'
56+
- '.gitignore'
57+
3158
test:
3259
runs-on: ubuntu-latest
3360
name: test trino ${{ matrix.label }}
61+
needs: [changes]
62+
if: ${{needs.changes.outputs.trino-changed == 'true'}}
3463
strategy:
3564
fail-fast: false
3665
matrix:
@@ -60,6 +89,8 @@ jobs:
6089
test-gateway:
6190
runs-on: ubuntu-latest
6291
name: test gateway ${{ matrix.label }}
92+
needs: [changes]
93+
if: ${{needs.changes.outputs.gateway-changed == 'true'}}
6394
strategy:
6495
fail-fast: false
6596
matrix:
@@ -93,7 +124,7 @@ jobs:
93124
sync-readme:
94125
needs: [lint, test, test-gateway, docs]
95126
runs-on: ubuntu-latest
96-
if: github.event_name != 'pull_request'
127+
if: ${{ always() && !failure() && github.event_name != 'pull_request'}}
97128
steps:
98129
- name: Checkout main
99130
uses: actions/checkout@v4
@@ -122,7 +153,7 @@ jobs:
122153
release:
123154
needs: [lint, test, test-gateway, docs, sync-readme]
124155
runs-on: ubuntu-latest
125-
if: github.event_name != 'pull_request'
156+
if: ${{ always() && !failure() && github.event_name != 'pull_request'}}
126157
steps:
127158
- uses: actions/checkout@v4
128159
with:

0 commit comments

Comments
 (0)