Skip to content

Commit 14f7146

Browse files
authored
chore: fix generation diff CI (#10535)
* fix: fix generation diff CI * change env * setup docker env * change directory mapping * change directory mapping * fix gapic-bom ci * change step name
1 parent ada32d1 commit 14f7146

File tree

1 file changed

+49
-18
lines changed

1 file changed

+49
-18
lines changed

.github/workflows/generated_files_sync.yaml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,71 @@ on:
1919
- main
2020
pull_request:
2121
name: generation diff
22+
env:
23+
library_generation_image_tag: latest
24+
repo_volumes: "-v repo-google-cloud-java:/workspace/google-cloud-java"
2225
jobs:
2326
root-pom:
2427
# root pom.xml does not have diff from generated one
2528
runs-on: ubuntu-latest
2629
steps:
27-
- uses: actions/checkout@v3
28-
- name: Generate root pom.xml file
30+
- uses: actions/checkout@v4
31+
- name: setup docker environment
32+
shell: bash
2933
run: |
30-
bash generation/generate_root_pom.sh
31-
- name: Apply versions from versions.txt files
34+
# we create a volume pointing to `pwd` (google-cloud-java) that will
35+
# be referenced by the container and its children
36+
if [[ $(docker volume inspect repo-google-cloud-java) != '[]' ]]; then
37+
docker volume rm repo-google-cloud-java
38+
fi
39+
docker volume create --name "repo-google-cloud-java" --opt "type=none" --opt "device=$(pwd)" --opt "o=bind"
40+
- name: Generate root pom.xml file
41+
shell: bash
3242
run: |
33-
bash generation/apply_current_versions.sh
43+
docker run --rm \
44+
${repo_volumes} \
45+
-v /tmp:/tmp \
46+
-v /var/run/docker.sock:/var/run/docker.sock \
47+
-e "RUNNING_IN_DOCKER=true" \
48+
-e "REPO_BINDING_VOLUMES=${repo_volumes}" \
49+
gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \
50+
python /src/cli/generate_monorepo_root_pom.py generate --repository-path=/workspace/google-cloud-java
3451
- name: Fail if there's any difference
3552
run: git --no-pager diff --exit-code
3653

3754
gapic-bom:
3855
# gapic-libraries-bom does not have diff from generated one
3956
runs-on: ubuntu-latest
4057
steps:
41-
- uses: actions/checkout@v3
42-
- name: Generate gapic-libraries-bom/pom.xml
58+
- uses: actions/checkout@v4
59+
- name: setup docker environment
60+
shell: bash
4361
run: |
44-
bash generation/generate_gapic_bom.sh
45-
- name: Apply versions from versions.txt files
62+
# we create a volume pointing to `pwd` (google-cloud-java) that will
63+
# be referenced by the container and its children
64+
if [[ $(docker volume inspect repo-google-cloud-java) != '[]' ]]; then
65+
docker volume rm repo-google-cloud-java
66+
fi
67+
docker volume create --name "repo-google-cloud-java" --opt "type=none" --opt "device=$(pwd)" --opt "o=bind"
68+
- name: Generate gapic-libraries-bom/pom.xml
69+
shell: bash
4670
run: |
47-
bash generation/apply_current_versions.sh
48-
- name: Fail if there's any difference (To fix, run generation/apply_current_versions.sh)
71+
docker run --rm \
72+
${repo_volumes} \
73+
-v /tmp:/tmp \
74+
-v /var/run/docker.sock:/var/run/docker.sock \
75+
-e "RUNNING_IN_DOCKER=true" \
76+
-e "REPO_BINDING_VOLUMES=${repo_volumes}" \
77+
gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \
78+
python /src/cli/generate_monorepo_gapic_bom.py generate --repository-path=/workspace/google-cloud-java --versions-file=/workspace/google-cloud-java/versions.txt
79+
- name: Fail if there's any difference
4980
run: git --no-pager diff --exit-code
5081

5182
owlbot-py:
5283
# applying templated owlbot.py config doesn't create a diff
5384
runs-on: ubuntu-latest
5485
steps:
55-
- uses: actions/checkout@v3
86+
- uses: actions/checkout@v4
5687
- name: Generate owlbot.py files
5788
run: |
5889
bash generation/update_owlbot_postprocessor_config.sh
@@ -63,7 +94,7 @@ jobs:
6394
# Each module's .Owlbot.yaml config is configured according to set_owlbot_config.sh
6495
runs-on: ubuntu-latest
6596
steps:
66-
- uses: actions/checkout@v3
97+
- uses: actions/checkout@v4
6798
- name: Check if .Owlbot.yaml files are correctly configured
6899
run: |
69100
bash generation/set_owlbot_config.sh
@@ -74,7 +105,7 @@ jobs:
74105
# Generated files should not match .gitignore
75106
runs-on: ubuntu-latest
76107
steps:
77-
- uses: actions/checkout@v3
108+
- uses: actions/checkout@v4
78109
- name: checking any files matching gitignore
79110
# By default, GitHub Actions's bash has '-e' option to fail immediately
80111
# upon non-zero exit code. Not using it here to catch the exit code 1.
@@ -97,7 +128,7 @@ jobs:
97128
# Parent handles config for child modules
98129
runs-on: ubuntu-latest
99130
steps:
100-
- uses: actions/checkout@v3
131+
- uses: actions/checkout@v4
101132
- name: Apply consolidate_config.sh
102133
run: |
103134
bash generation/consolidate_config.sh
@@ -108,7 +139,7 @@ jobs:
108139
# Ensure generate-readme.py runs fine
109140
runs-on: ubuntu-latest
110141
steps:
111-
- uses: actions/checkout@v2
142+
- uses: actions/checkout@v4
112143
- uses: actions/setup-python@v4
113144
# These parameters should match ones in readme.yaml
114145
with:
@@ -120,7 +151,7 @@ jobs:
120151
group_id_check_for_maps_libraries:
121152
runs-on: ubuntu-latest
122153
steps:
123-
- uses: actions/checkout@v3
154+
- uses: actions/checkout@v4
124155
- name: Install Maps modules
125156
run: |
126157
IncludedNonCloudModules=$(find java-maps-* -name 'pom.xml' \
@@ -148,7 +179,7 @@ jobs:
148179
package_name_check:
149180
runs-on: ubuntu-latest
150181
steps:
151-
- uses: actions/checkout@v3
182+
- uses: actions/checkout@v4
152183
- name: Ensure no new invalid package name in Java files
153184
shell: bash
154185
run: |

0 commit comments

Comments
 (0)