Skip to content

Commit e2d547f

Browse files
authored
Run Rust CI only if rust directory is modified (#1529)
Avoid running CI checks unnecessarily. Need to validate if this causes any issue with "required check". Hopefully not, as this is a pattern used in other OTel repos too. Later to be expanded to Go also.
1 parent b3ee4b0 commit e2d547f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/rust-ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,22 @@ concurrency:
2020
cancel-in-progress: true
2121

2222
jobs:
23+
check-changes:
24+
runs-on: ubuntu-latest
25+
outputs:
26+
rust: ${{ steps.filter.outputs.rust }}
27+
steps:
28+
- uses: dorny/paths-filter@v2
29+
id: filter
30+
with:
31+
filters: |
32+
rust:
33+
- 'rust/**'
34+
- '.github/workflows/rust-ci.yml'
35+
2336
test_and_coverage:
37+
needs: check-changes
38+
if: needs.check-changes.outputs.rust == 'true'
2439
strategy:
2540
fail-fast: false
2641
matrix:
@@ -56,6 +71,8 @@ jobs:
5671
fail_ci_if_error: true
5772

5873
fmt:
74+
needs: check-changes
75+
if: needs.check-changes.outputs.rust == 'true'
5976
strategy:
6077
fail-fast: false
6178
matrix:
@@ -80,6 +97,8 @@ jobs:
8097
working-directory: ./rust/${{ matrix.folder }}
8198

8299
clippy:
100+
needs: check-changes
101+
if: needs.check-changes.outputs.rust == 'true'
83102
strategy:
84103
fail-fast: false
85104
matrix:
@@ -105,6 +124,8 @@ jobs:
105124
working-directory: ./rust/${{ matrix.folder }}
106125

107126
deny:
127+
needs: check-changes
128+
if: needs.check-changes.outputs.rust == 'true'
108129
strategy:
109130
fail-fast: false
110131
matrix:
@@ -149,6 +170,8 @@ jobs:
149170
manifest-path: ./rust/${{ matrix.folder }}/Cargo.toml
150171

151172
docs:
173+
needs: check-changes
174+
if: needs.check-changes.outputs.rust == 'true'
152175
strategy:
153176
fail-fast: false
154177
matrix:
@@ -172,6 +195,8 @@ jobs:
172195
working-directory: ./rust/${{ matrix.folder }}
173196

174197
structure_check:
198+
needs: check-changes
199+
if: needs.check-changes.outputs.rust == 'true'
175200
strategy:
176201
fail-fast: false
177202
matrix:

0 commit comments

Comments
 (0)