Skip to content

Commit 57b2c01

Browse files
committed
ci: simplify hermetic build scripts ci workflow
1 parent 4e566af commit 57b2c01

1 file changed

Lines changed: 9 additions & 47 deletions

File tree

.github/workflows/sdk-platform-java-verify_library_generation.yaml renamed to .github/workflows/hermetic-build-scripts-ci.yaml

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
on:
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
75
jobs:
86
filter:
97
runs-on: ubuntu-latest
@@ -16,47 +14,11 @@ 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/**'
5719
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'
20+
needs: filter
21+
if: needs.filter.outputs.library == 'true'
6022
runs-on: ubuntu-22.04
6123
defaults:
6224
run:
@@ -86,8 +48,8 @@ jobs:
8648
set -x
8749
python -m unittest discover -s hermetic_build -p "*unit_tests.py"
8850
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'
51+
needs: filter
52+
if: needs.filter.outputs.library == 'true'
9153
runs-on: ubuntu-22.04
9254
defaults:
9355
run:
@@ -103,8 +65,8 @@ jobs:
10365
ignore_paths:
10466
.kokoro
10567
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'
68+
needs: filter
69+
if: needs.filter.outputs.library == 'true'
10870
runs-on: ubuntu-22.04
10971
defaults:
11072
run:

0 commit comments

Comments
 (0)