2020 pull_request :
2121name : ci
2222jobs :
23- filter :
23+ # detect whether or note we should run "bulk" (non-handwritten) unit tests
24+ bulk-filter :
2425 runs-on : ubuntu-latest
2526 permissions :
2627 pull-requests : read
28+ # Set job outputs to values from filter step
2729 outputs :
28- runnable : ${{ fromJSON(steps.filter.outputs.all_count) > fromJSON(steps.filter.outputs.workflows_count) }}
30+ src : ${{ steps.filter.outputs.src }}
31+ ci : ${{ steps.filter.outputs.ci }}
32+ # runnable is true if there are changes outside the .github/workflows directory OR if ci.yaml itself (or kokoro scripts) is modified.
33+ runnable : ${{ fromJSON(steps.filter.outputs.all_count) > fromJSON(steps.filter.outputs.workflows_count) || fromJSON(steps.filter.outputs.ci_count) > 0 }}
2934 steps :
3035 - uses : actions/checkout@v6
3136 # Use this action, rather than a file filter so that we can make this
3237 # mandatory.
3338 # See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-including-branches
3439 # for more details.
35- - uses : dorny/paths-filter@v4
40+ - uses : dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
3641 id : filter
3742 with :
3843 filters : |
3944 all:
4045 - '**'
4146 workflows:
4247 - '.github/workflows/**'
43- # detect whether or note we should run "bulk" (non-handwritten) unit tests
44- bulk-filter :
45- needs : filter
46- if : ${{ needs.filter.outputs.runnable == 'true' }}
47- runs-on : ubuntu-latest
48- permissions :
49- pull-requests : read
50- # Set job outputs to values from filter step
51- outputs :
52- src : ${{ steps.filter.outputs.src }}
53- ci : ${{ steps.filter.outputs.ci }}
54- steps :
55- - uses : actions/checkout@v4
56- - uses : dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
57- id : filter
58- with :
59- filters : |
6048 src:
6149 - '!(google-auth-library-java|grpc-gcp-java|java-bigquery|java-bigquery-jdbc|java-bigquerystorage|java-bigtable|java-datastore|java-firestore|java-logging|java-logging-logback|java-pubsub|java-spanner|java-storage)/**/*.java'
6250 - '!(google-auth-library-java|grpc-gcp-java|java-bigquery|java-bigquery-jdbc|java-bigquerystorage|java-bigtable|java-datastore|java-firestore|java-logging|java-logging-logback|java-pubsub|java-spanner|java-storage)/**/pom.xml'
6856 units :
6957 runs-on : ubuntu-latest
7058 needs : bulk-filter
59+ if : ${{ needs.bulk-filter.outputs.runnable == 'true' }}
7160 strategy :
7261 fail-fast : false
7362 matrix :
9584 units-8-runtime :
9685 runs-on : ubuntu-latest
9786 needs : bulk-filter
87+ if : ${{ needs.bulk-filter.outputs.runnable == 'true' }}
9888 name : " units (8)"
9989 steps :
10090 - name : Get current week within the year
@@ -128,15 +118,15 @@ jobs:
128118 JOB_NAME : units-8-runtime-${{matrix.java}}
129119 # detect which libraries have changed
130120 changes :
131- needs : filter
132- if : ${{ needs.filter.outputs.runnable == 'true' }}
121+ needs : bulk- filter
122+ if : ${{ needs.bulk- filter.outputs.runnable == 'true' }}
133123 runs-on : ubuntu-latest
134124 permissions :
135125 pull-requests : read
136126 outputs :
137127 packages : ${{ steps.filter.outputs.changes }}
138128 steps :
139- - uses : actions/checkout@v4
129+ - uses : actions/checkout@v6
140130 - uses : dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
141131 id : filter
142132 with :
@@ -326,7 +316,7 @@ jobs:
326316 env :
327317 BUILD_SUBDIR : ${{matrix.package}}
328318 required :
329- needs : [ filter, changes, split-units, split-clirr, split-dependencies ]
319+ needs : [ bulk- filter, changes, split-units, split-clirr, split-dependencies ]
330320 name : conditional-required-check
331321 if : ${{ always() }} # Always run even if any "needs" jobs fail
332322 runs-on : ubuntu-22.04
@@ -337,8 +327,8 @@ jobs:
337327 - name : Success otherwise
338328 run : echo "Success!"
339329 windows :
340- needs : filter
341- if : ${{ needs.filter.outputs.runnable == 'true' }}
330+ needs : bulk- filter
331+ if : ${{ needs.bulk- filter.outputs.runnable == 'true' }}
342332 runs-on : windows-latest
343333 steps :
344334 - name : Support longpaths
@@ -355,8 +345,8 @@ jobs:
355345 JOB_TYPE : test
356346 JOB_NAME : windows-units
357347 lint :
358- needs : filter
359- if : ${{ needs.filter.outputs.runnable == 'true' }}
348+ needs : bulk- filter
349+ if : ${{ needs.bulk- filter.outputs.runnable == 'true' }}
360350 runs-on : ubuntu-latest
361351 steps :
362352 - uses : actions/checkout@v4
@@ -373,8 +363,8 @@ jobs:
373363 HEAD_SHA : ${{ github.event.pull_request.head.sha || github.sha }}
374364 BASE_SHA : ${{ github.event.pull_request.base.sha || github.event.before }}
375365 enforcer :
376- needs : filter
377- if : ${{ needs.filter.outputs.runnable == 'true' }}
366+ needs : bulk- filter
367+ if : ${{ needs.bulk- filter.outputs.runnable == 'true' }}
378368 runs-on : ubuntu-latest
379369 steps :
380370 - name : Get current week within the year
@@ -394,8 +384,8 @@ jobs:
394384 - run : java -version
395385 - run : mvn -B -ntp enforcer:enforce@enforce -T 1C
396386 gapic-libraries-bom :
397- needs : filter
398- if : ${{ needs.filter.outputs.runnable == 'true' }}
387+ needs : bulk- filter
388+ if : ${{ needs.bulk- filter.outputs.runnable == 'true' }}
399389 runs-on : ubuntu-latest
400390 steps :
401391 - uses : actions/checkout@v4
@@ -413,8 +403,8 @@ jobs:
413403 with :
414404 bom-path : gapic-libraries-bom/pom.xml
415405 generation-config-check :
416- needs : filter
417- if : ${{ needs.filter.outputs.runnable == 'true' }}
406+ needs : bulk- filter
407+ if : ${{ needs.bulk- filter.outputs.runnable == 'true' }}
418408 runs-on : ubuntu-latest
419409 steps :
420410 - uses : actions/checkout@v4
0 commit comments