Skip to content

Commit 63cbf25

Browse files
authored
Merge branch 'main' into test-auth-change-ci
2 parents 4c6e4dc + bb47541 commit 63cbf25

111 files changed

Lines changed: 6391 additions & 1271 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
ci: ${{ steps.filter.outputs.ci }}
3232
steps:
3333
- uses: actions/checkout@v4
34-
- uses: dorny/paths-filter@v3
34+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
3535
id: filter
3636
with:
3737
# we want to run tests if source code is changed or the scripts
@@ -121,7 +121,7 @@ jobs:
121121
outputs:
122122
packages: ${{ steps.filter.outputs.changes }}
123123
steps:
124-
- uses: dorny/paths-filter@v4
124+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
125125
id: filter
126126
with:
127127
# For each library, run CI in split repos where there are changes in:
@@ -246,6 +246,17 @@ jobs:
246246
JOB_TYPE: test
247247
JOB_NAME: units-8-runtime-${{matrix.java}}
248248
working-directory: ${{matrix.package}}
249+
required:
250+
needs: [ changes, split-units ]
251+
name: conditional-required-check
252+
if: ${{ always() }} # Always run even if any "needs" jobs fail
253+
runs-on: ubuntu-22.04
254+
steps:
255+
- name: Fail if any previous failure
256+
if: ${{ needs.changes.outputs.packages != '[]' && contains(needs.*.result, 'failure') }}
257+
run: exit 1
258+
- name: Success otherwise
259+
run: echo "Success!"
249260
windows:
250261
runs-on: windows-latest
251262
steps:
@@ -321,41 +332,14 @@ jobs:
321332
- name: validate generation configuration
322333
shell: bash
323334
run: |
324-
docker run \
325-
--rm \
335+
bash generation/run_generator_docker.sh "${library_generation_image_tag}" "${{ github.base_ref || 'main' }}" \
336+
-e GENERATOR_VERSION="${library_generation_image_tag}" \
326337
--quiet \
327338
-u "$(id -u):$(id -g)" \
328339
-v "$(pwd):${workspace_name}" \
329340
--entrypoint python \
330-
gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \
341+
-- \
331342
/src/library_generation/cli/entry_point.py validate-generation-config
332343
env:
333344
library_generation_image_tag: 2.68.0
334345
workspace_name: /workspace
335-
336-
# TODO: Uncomment the needed Github Actions
337-
# dependencies:
338-
# runs-on: ubuntu-latest
339-
# strategy:
340-
# matrix:
341-
# java: [8, 11, 17]
342-
# steps:
343-
# - uses: actions/checkout@v3
344-
# - uses: actions/setup-java@v3
345-
# with:
346-
# distribution: zulu
347-
# java-version: ${{matrix.java}}
348-
# - run: java -version
349-
# - run: .kokoro/dependencies.sh
350-
# clirr:
351-
# runs-on: ubuntu-latest
352-
# steps:
353-
# - uses: actions/checkout@v3
354-
# - uses: actions/setup-java@v3
355-
# with:
356-
# distribution: zulu
357-
# java-version: 8
358-
# - run: java -version
359-
# - run: .kokoro/build.sh
360-
# env:
361-
# JOB_TYPE: clirr

.github/workflows/generated_files_sync.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ jobs:
2727
- name: Generate root pom.xml file
2828
shell: bash
2929
run: |
30-
docker run \
31-
--rm \
30+
bash generation/run_generator_docker.sh "${library_generation_image_tag}" "${{ github.base_ref }}" \
3231
--quiet \
3332
-u "$(id -u):$(id -g)" \
3433
-v "$(pwd):/workspace" \
3534
--entrypoint python \
36-
gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \
35+
-- \
3736
/src/library_generation/cli/generate_monorepo_root_pom.py \
3837
generate \
3938
--repository-path=/workspace
@@ -48,13 +47,12 @@ jobs:
4847
- name: Generate gapic-libraries-bom/pom.xml
4948
shell: bash
5049
run: |
51-
docker run \
52-
--rm \
50+
bash generation/run_generator_docker.sh "${library_generation_image_tag}" "${{ github.base_ref }}" \
5351
--quiet \
5452
-u "$(id -u):$(id -g)" \
5553
-v "$(pwd):/workspace" \
5654
--entrypoint python \
57-
gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \
55+
-- \
5856
/src/library_generation/cli/generate_monorepo_gapic_bom.py \
5957
generate \
6058
--repository-path=/workspace \

.github/workflows/google-auth-library-java-ci.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ jobs:
2828
library: ${{ steps.filter.outputs.library }}
2929
steps:
3030
- uses: actions/checkout@v4
31-
- uses: dorny/paths-filter@v3
31+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
3232
id: filter
3333
with:
3434
filters: |
3535
library:
3636
- 'google-auth-library-java/**'
37+
- '.github/workflows/google-auth-library-java-ci.yaml'
3738
units-logging:
3839
needs: filter
3940
if: ${{ needs.filter.outputs.library == 'true' }}
@@ -54,3 +55,14 @@ jobs:
5455
BUILD_SUBDIR: google-auth-library-java
5556
JOB_TYPE: test
5657
SUREFIRE_JVM_OPT: "-P '!slf4j2x,slf4j2x-test'"
58+
required:
59+
needs: [ units-logging ]
60+
name: conditional-required-check
61+
if: ${{ always() }} # Always run even if any "needs" jobs fail
62+
runs-on: ubuntu-22.04
63+
steps:
64+
- name: Fail if any previous failure
65+
if: ${{ contains(needs.*.result, 'failure') }}
66+
run: exit 1
67+
- name: Success otherwise
68+
run: echo "Success!"

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

Lines changed: 25 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,27 @@
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
108
outputs:
119
library: ${{ steps.filter.outputs.library }}
1210
steps:
1311
- uses: actions/checkout@v4
14-
- uses: dorny/paths-filter@v3
12+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
1513
id: filter
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
@@ -86,9 +50,10 @@ jobs:
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
@@ -131,3 +97,14 @@ jobs:
13197
# exclude generated golden files
13298
# exclude owlbot until further refaction
13399
black --check hermetic_build --exclude "(library_generation/tests/resources/goldens)"
100+
required:
101+
needs: [ library-generation-unit-tests, library-generation-lint-shell, library-generation-lint-python ]
102+
name: conditional-required-check
103+
if: ${{ always() }} # Always run even if any "needs" jobs fail
104+
runs-on: ubuntu-22.04
105+
steps:
106+
- name: Fail if any previous failure
107+
if: ${{ contains(needs.*.result, 'failure') }}
108+
run: exit 1
109+
- name: Success otherwise
110+
run: echo "Success!"

.github/workflows/hermetic_library_generation.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
env:
2121
REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
2222
GITHUB_REPOSITORY: ${{ github.repository }}
23+
# {x-version-update-start:gapic-generator-java:current}
24+
GENERATOR_VERSION: 2.71.0
25+
# {x-version-update-end}
2326
jobs:
2427
library_generation:
2528
runs-on: ubuntu-latest
@@ -44,4 +47,4 @@ jobs:
4447
head_ref: ${{ github.head_ref }}
4548
token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
4649
force_regenerate_all: ${{ github.event.pull_request.head.ref == 'generate-libraries-main' }}
47-
image_tag: 2.71.0 # {x-version-update:gapic-generator-java:current}
50+
image_tag: ${{ env.GENERATOR_VERSION }}

.github/workflows/java-bigquery-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
library: ${{ steps.filter.outputs.library }}
2727
steps:
2828
- uses: actions/checkout@v4
29-
- uses: dorny/paths-filter@v3
29+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
3030
id: filter
3131
with:
3232
filters: |

.github/workflows/java-spanner-integration-tests-against-emulator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
library: ${{ steps.filter.outputs.library }}
1212
steps:
1313
- uses: actions/checkout@v4
14-
- uses: dorny/paths-filter@v3
14+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
1515
id: filter
1616
with:
1717
filters: |

.github/workflows/java-spanner-jdbc-ci.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ jobs:
2828
library: ${{ steps.filter.outputs.library }}
2929
steps:
3030
- uses: actions/checkout@v4
31-
- uses: dorny/paths-filter@v3
31+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
3232
id: filter
3333
with:
3434
filters: |
3535
library:
3636
- 'java-spanner-jdbc/**'
37+
- '.github/workflows/java-spanner-jdbc-ci.yaml'
3738
units:
3839
needs: filter
3940
if: ${{ needs.filter.outputs.library == 'true' }}
@@ -141,3 +142,14 @@ jobs:
141142
JOB_TYPE: lint
142143
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
143144
BASE_SHA: ${{ github.event.pull_request.base.sha }}
145+
required:
146+
needs: [ units, units-java8, windows, dependencies, javadoc, lint ]
147+
name: conditional-required-check
148+
if: ${{ always() }} # Always run even if any "needs" jobs fail
149+
runs-on: ubuntu-22.04
150+
steps:
151+
- name: Fail if any previous failure
152+
if: ${{ contains(needs.*.result, 'failure') }}
153+
run: exit 1
154+
- name: Success otherwise
155+
run: echo "Success!"

.github/workflows/java-spanner-jdbc-integration-tests-against-emulator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
library: ${{ steps.filter.outputs.library }}
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: dorny/paths-filter@v3
16+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
1717
id: filter
1818
with:
1919
filters: |

.github/workflows/java-spanner-jdbc-quickperf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
library: ${{ steps.filter.outputs.library }}
2626
steps:
2727
- uses: actions/checkout@v4
28-
- uses: dorny/paths-filter@v3
28+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
2929
id: filter
3030
with:
3131
filters: |

0 commit comments

Comments
 (0)