Skip to content

Commit c86b4ea

Browse files
authored
ci: exclude internal/librariangen/** using dorny/paths-filter (#3961)
1 parent f22935d commit c86b4ea

File tree

4 files changed

+84
-5
lines changed

4 files changed

+84
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@ on:
55
pull_request:
66
name: ci
77
jobs:
8+
changes:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
should_run: ${{ steps.filter.outputs.should_run }}
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
15+
id: filter
16+
with:
17+
filters: |
18+
should_run:
19+
- '!internal/librariangen/**'
820
build:
21+
needs: changes
22+
if: needs.changes.outputs.should_run == 'true'
923
runs-on: ubuntu-22.04
1024
strategy:
1125
matrix:
@@ -59,6 +73,8 @@ jobs:
5973
./gradlew clean build publishToMavenLocal sourcesJar allJars
6074
popd
6175
build-java-21:
76+
needs: changes
77+
if: needs.changes.outputs.should_run == 'true'
6278
name: "build(21) except self-service clients"
6379
# Support for Java 21 is available for all use cases except self-service clients.
6480
runs-on: ubuntu-22.04
@@ -92,6 +108,8 @@ jobs:
92108
run: |
93109
bazelisk --batch test //test/integration/...
94110
build-java-25:
111+
needs: changes
112+
if: needs.changes.outputs.should_run == 'true'
95113
name: "build(25) except self-service clients"
96114
# Support for Java 25 is available for all use cases except self-service clients.
97115
runs-on: ubuntu-22.04
@@ -126,6 +144,8 @@ jobs:
126144
run: |
127145
bazelisk --batch test //test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false
128146
build-java8-except-gapic-generator-java:
147+
needs: changes
148+
if: needs.changes.outputs.should_run == 'true'
129149
name: "build(8) except for gapic-generator-java"
130150
runs-on: ubuntu-22.04
131151
steps:
@@ -172,6 +192,8 @@ jobs:
172192
GOOGLE_SDK_JAVA_LOGGING: true
173193

174194
build-java8-gapic-generator-java:
195+
needs: changes
196+
if: needs.changes.outputs.should_run == 'true'
175197
name: "build(8) for gapic-generator-java"
176198
runs-on: ubuntu-22.04
177199
steps:
@@ -219,6 +241,8 @@ jobs:
219241
popd
220242
221243
lint:
244+
needs: changes
245+
if: needs.changes.outputs.should_run == 'true'
222246
runs-on: ubuntu-22.04
223247
steps:
224248
- uses: actions/checkout@v4
@@ -233,6 +257,8 @@ jobs:
233257
run: mvn -B -ntp fmt:check
234258

235259
compatibility:
260+
needs: changes
261+
if: needs.changes.outputs.should_run == 'true'
236262
runs-on: ubuntu-22.04
237263
steps:
238264
- uses: actions/checkout@v4
@@ -248,6 +274,8 @@ jobs:
248274
run: mvn package clirr:check -DskipTests -Dfmt.skip
249275

250276
build-java8-showcase:
277+
needs: changes
278+
if: needs.changes.outputs.should_run == 'true'
251279
name: "build(8) for showcase"
252280
runs-on: ubuntu-22.04
253281
steps:
@@ -304,6 +332,8 @@ jobs:
304332
--batch-mode \
305333
--no-transfer-progress
306334
showcase:
335+
needs: changes
336+
if: needs.changes.outputs.should_run == 'true'
307337
runs-on: ubuntu-22.04
308338
strategy:
309339
matrix:
@@ -374,7 +404,8 @@ jobs:
374404
--no-transfer-progress
375405
376406
showcase-clirr:
377-
if: ${{ github.base_ref != '' }} # Only execute on pull_request trigger event
407+
needs: changes
408+
if: ${{ github.base_ref != '' && needs.changes.outputs.should_run == 'true' }}
378409
runs-on: ubuntu-22.04
379410
steps:
380411
- name: Checkout @ target branch
@@ -405,6 +436,8 @@ jobs:
405436
mvn clirr:check -B -ntp -Dclirr.skip=false -DcomparisonVersion=$SHOWCASE_CLIENT_VERSION
406437
407438
gapic-generator-java-bom:
439+
needs: changes
440+
if: needs.changes.outputs.should_run == 'true'
408441
runs-on: ubuntu-22.04
409442
steps:
410443
- uses: actions/checkout@v4
@@ -422,6 +455,8 @@ jobs:
422455
bom-path: gapic-generator-java-bom/pom.xml
423456

424457
unmanaged_dependency_check:
458+
needs: changes
459+
if: needs.changes.outputs.should_run == 'true'
425460
runs-on: ubuntu-22.04
426461
steps:
427462
- uses: actions/checkout@v4
@@ -445,6 +480,8 @@ jobs:
445480
bom-path: gapic-generator-java-bom/pom.xml
446481

447482
dependency_analyzer_unit_test:
483+
needs: changes
484+
if: needs.changes.outputs.should_run == 'true'
448485
runs-on: ubuntu-22.04
449486
steps:
450487
- uses: actions/checkout@v4
@@ -458,4 +495,4 @@ jobs:
458495
- name: Unit Tests
459496
run: |
460497
mvn test --batch-mode --no-transfer-progress
461-
working-directory: java-shared-dependencies/dependency-analyzer
498+
working-directory: java-shared-dependencies/dependency-analyzer

.github/workflows/dependency_compatibility_test.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,21 @@ on:
1515
default: ''
1616

1717
jobs:
18+
changes:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
should_run: ${{ steps.filter.outputs.should_run }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
25+
id: filter
26+
with:
27+
filters: |
28+
should_run:
29+
- '!internal/librariangen/**'
1830
dependency-compatibility-test:
31+
needs: changes
32+
if: needs.changes.outputs.should_run == 'true'
1933
runs-on: ubuntu-latest
2034
permissions:
2135
contents: read
@@ -73,4 +87,4 @@ jobs:
7387
else
7488
../.github/scripts/test_dependency_compatibility.sh -f ../dependencies.txt
7589
fi
76-
working-directory: java-showcase
90+
working-directory: java-showcase

.github/workflows/java_compatibility_check.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,21 @@ on:
1717
pull_request:
1818
name: Java 8 compatibility check
1919
jobs:
20+
changes:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
should_run: ${{ steps.filter.outputs.should_run }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
27+
id: filter
28+
with:
29+
filters: |
30+
should_run:
31+
- '!internal/librariangen/**'
2032
java8-compatibility-check:
33+
needs: changes
34+
if: needs.changes.outputs.should_run == 'true'
2135
runs-on: ubuntu-latest
2236
steps:
2337
- uses: actions/checkout@v4
@@ -43,4 +57,4 @@ jobs:
4357
exit 1
4458
fi
4559
done
46-
echo "All class files are compatible with Java 8."
60+
echo "All class files are compatible with Java 8."

.github/workflows/sonar.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened]
88
jobs:
9+
changes:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
should_run: ${{ steps.filter.outputs.should_run }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
16+
id: filter
17+
with:
18+
filters: |
19+
should_run:
20+
- '!internal/librariangen/**'
921
build:
22+
needs: changes
23+
if: needs.changes.outputs.should_run == 'true'
1024
name: Build
1125
runs-on: ubuntu-22.04
1226
steps:
@@ -76,4 +90,4 @@ jobs:
7690
-Dsonar.projectKey=googleapis_gapic-generator-java_integration_tests \
7791
-Dsonar.organization=googleapis \
7892
-Dsonar.host.url=https://sonarcloud.io \
79-
-Dsonar.projectName=java_showcase_integration_tests
93+
-Dsonar.projectName=java_showcase_integration_tests

0 commit comments

Comments
 (0)