11on :
22 pull_request :
33
4- name : sdk-platform-java verify_library_generation
5- env :
6- BUILD_SUBDIR : sdk-platform-java
4+ name : hermetic build scripts
75jobs :
86 filter :
97 runs-on : ubuntu-latest
@@ -16,48 +14,14 @@ jobs:
1614 with :
1715 filters : |
1816 library:
19- - 'sdk-platform-java/**'
20- should-run-library-generation-tests :
21- needs : filter
22- if : ${{ needs.filter.outputs.library == 'true' }}
23- runs-on : ubuntu-22.04
24- outputs :
25- should_run : ${{ steps.get_changed_directories.outputs.should_run }}
26- steps :
27- - uses : actions/checkout@v4
28- with :
29- fetch-depth : 0
30- - name : get changed directories in the pull request
31- id : get_changed_directories
32- shell : bash
33- run : |
34- set -ex
35- # PRs that come from a fork need to be handled differently
36- if [[ ${head_repo_name} == ${base_repo} ]]; then
37- git checkout ${base_ref}
38- git checkout ${head_ref}
39- changed_directories="$(git diff --name-only ${base_ref} ${head_ref})"
40- else
41- git remote add fork ${head_repo_url}
42- git fetch fork # create a mapping of the fork
43- git checkout -b "${head_ref}" fork/${head_ref}
44- changed_directories="$(git diff --name-only "fork/${head_ref}" "origin/${base_ref}")"
45- fi
46- if [[ ${changed_directories} =~ "sdk-platform-java/hermetic_build/" ]] || [[ ${changed_directories} =~ "sdk-platform-java/.cloudbuild/library_generation/" ]]; then
47- echo "should_run=true" >> $GITHUB_OUTPUT
48- else
49- echo "should_run=false" >> $GITHUB_OUTPUT
50- fi
51- env :
52- base_ref : ${{ github.event.pull_request.base.ref }}
53- head_ref : ${{ github.event.pull_request.head.ref }}
54- head_repo_url : ${{ github.event.pull_request.head.repo.html_url }}
55- head_repo_name : ${{ github.event.pull_request.head.repo.full_name }}
56- base_repo : ${{ github.repository }}
17+ - 'sdk-platform-java/hermetic_build/**'
18+ - 'sdk-platform-java/.cloudbuild/library_generation/**'
19+ - '.github/workflows/hermetic-build-scripts-ci.yaml'
5720 library-generation-unit-tests :
58- needs : [ filter, should-run-library-generation-tests]
59- if : needs.filter.outputs.library == 'true' && needs.should-run-library-generation-tests.outputs.should_run == 'true'
21+ needs : filter
22+ if : needs.filter.outputs.library == 'true'
6023 runs-on : ubuntu-22.04
24+ name : hermetic build units (python)
6125 defaults :
6226 run :
6327 working-directory : sdk-platform-java
8650 set -x
8751 python -m unittest discover -s hermetic_build -p "*unit_tests.py"
8852 library-generation-lint-shell :
89- needs : [ filter, should-run-library-generation-tests]
90- if : needs.filter.outputs.library == 'true' && needs.should-run-library-generation-tests.outputs.should_run == 'true'
53+ needs : filter
54+ if : needs.filter.outputs.library == 'true'
9155 runs-on : ubuntu-22.04
56+ name : hermetic build lint (shell)
9257 defaults :
9358 run :
9459 working-directory : sdk-platform-java
@@ -103,9 +68,10 @@ jobs:
10368 ignore_paths :
10469 .kokoro
10570 library-generation-lint-python :
106- needs : [ filter, should-run-library-generation-tests]
107- if : needs.filter.outputs.library == 'true' && needs.should-run-library-generation-tests.outputs.should_run == 'true'
71+ needs : filter
72+ if : needs.filter.outputs.library == 'true'
10873 runs-on : ubuntu-22.04
74+ name : hermetic build lint (python)
10975 defaults :
11076 run :
11177 working-directory : sdk-platform-java
0 commit comments