Skip to content

Commit 005b765

Browse files
Merge branch 'main' into generate-libraries-main
2 parents 24ba165 + 3ea90ef commit 005b765

1,314 files changed

Lines changed: 10414 additions & 1741 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/release-note-generation/split_release_note.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def detect_modules(root_directory: Path):
6969
tree = ET.parse(module_pom_xml)
7070
root = tree.getroot()
7171
version = root.find('mvn:version', POM_NAMESPACES).text
72+
api_name = None
7273
if owlbot_yaml_path.exists():
7374
# If OwlBot configuration file exists (most cases), it's the better
7475
# source to get the OwlBot-generated pull request title prefix than
@@ -78,21 +79,21 @@ def detect_modules(root_directory: Path):
7879
match = re.search(r'api-name: (.+)', owlbot_yaml_content)
7980
if match:
8081
api_name = match.group(1)
81-
modules.append(LibraryModule(module_path, api_name,
82-
version,
83-
changelog))
82+
83+
if not api_name:
84+
# Fallback to repo-metadata.json (e.g. for vertexai or Spanner transitional state)
85+
if repo_metadata_path.exists():
86+
with open(repo_metadata_path, 'r') as file:
87+
repo_metadata = json.load(file)
88+
api_name = repo_metadata.get('api_shortname')
89+
90+
if api_name:
91+
modules.append(LibraryModule(module_path, api_name,
92+
version,
93+
changelog))
8494
else:
85-
# vertexai (handwritten) does not have OwlBot yaml file
86-
with open(repo_metadata_path, 'r') as file:
87-
repo_metadata = json.load(file)
88-
api_name = repo_metadata['api_shortname']
89-
if api_name:
90-
modules.append(LibraryModule(repo_metadata_path.parent, api_name,
91-
version,
92-
changelog))
93-
else:
94-
raise Exception(f'repo_metadata_path {repo_metadata_path} does'
95-
f' not have api_shortname field')
95+
raise Exception(f'Could not determine api-name for {repo_metadata_path}')
96+
9697

9798
return modules
9899

@@ -133,7 +134,7 @@ def group_changes_by_api(main_changes: [str]):
133134
elif section == BUG_FIXES_SECTION:
134135
api_to_changelog[api_name].bug_fixes.append(note)
135136
elif section == DEPENDENCIES_SECTION:
136-
api_to_changelog[api_name].dependencies.append(note)
137+
api_to_changelog[api_name].dependency_upgrades.append(note)
137138
return api_to_changelog
138139

139140

.github/release-note-generation/unit_test.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import unittest
2+
import tempfile
3+
import json
4+
from pathlib import Path
25

36
# Unit tests for split_release_note.py
47

5-
from split_release_note import LibraryModule, create_changelog_entry, group_changes_by_api, ChangesOnApi
6-
from pathlib import Path
8+
from split_release_note import LibraryModule, create_changelog_entry, group_changes_by_api, ChangesOnApi, detect_modules
79

810
dummy_module = LibraryModule(
911
Path('release-note-generation/test/java-analyics-admin'),
@@ -81,6 +83,31 @@ def test_group_changes_by_api(self):
8183
['No change']),
8284
['No change'])
8385

86+
def test_detect_modules_fallback(self):
87+
with tempfile.TemporaryDirectory() as tmpdirname:
88+
tmp_path = Path(tmpdirname)
89+
module_path = tmp_path / "java-spanner"
90+
module_path.mkdir()
91+
92+
# Create minimal pom.xml
93+
pom_path = module_path / "pom.xml"
94+
with open(pom_path, "w") as f:
95+
f.write('<project xmlns:mvn="http://maven.apache.org/POM/4.0.0"><mvn:version>1.0.0</mvn:version></project>')
96+
97+
# Create .repo-metadata.json with api_shortname
98+
metadata_path = module_path / ".repo-metadata.json"
99+
with open(metadata_path, "w") as f:
100+
json.dump({"api_shortname": "spanner"}, f)
101+
102+
# Create CHANGELOG.md
103+
changelog_path = module_path / "CHANGELOG.md"
104+
changelog_path.touch()
105+
106+
modules = detect_modules(tmp_path)
107+
self.assertEqual(len(modules), 1)
108+
self.assertEqual(modules[0].api_name, "spanner")
109+
self.assertEqual(modules[0].version, "1.0.0")
110+
84111

85112
if __name__ == "__main__":
86113
unittest.main()

.github/workflows/ci.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,28 @@ jobs:
246246
JOB_TYPE: test
247247
JOB_NAME: units-8-runtime-${{matrix.java}}
248248
working-directory: ${{matrix.package}}
249+
split-clirr:
250+
runs-on: ubuntu-latest
251+
needs: changes
252+
strategy:
253+
matrix:
254+
package: ${{ fromJSON(needs.changes.outputs.packages) }}
255+
steps:
256+
- name: Get current week within the year
257+
id: date
258+
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
259+
- uses: actions/checkout@v4
260+
- uses: actions/setup-java@v4
261+
with:
262+
distribution: temurin
263+
java-version: 11
264+
- run: .kokoro/build.sh
265+
env:
266+
BUILD_SUBDIR: ${{matrix.package}}
267+
JOB_TYPE: clirr
268+
JOB_NAME: clirr-${{matrix.package}}
249269
required:
250-
needs: [ changes, split-units ]
270+
needs: [ changes, split-units, split-clirr ]
251271
name: conditional-required-check
252272
if: ${{ always() }} # Always run even if any "needs" jobs fail
253273
runs-on: ubuntu-22.04

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,24 @@ jobs:
5555
BUILD_SUBDIR: google-auth-library-java
5656
JOB_TYPE: test
5757
SUREFIRE_JVM_OPT: "-P '!slf4j2x,slf4j2x-test'"
58+
clirr:
59+
needs: filter
60+
if: ${{ needs.filter.outputs.library == 'true' }}
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v3
64+
- uses: actions/setup-java@v3
65+
with:
66+
distribution: temurin
67+
java-version: 11
68+
- run: java -version
69+
- run: .kokoro/build.sh
70+
env:
71+
JOB_TYPE: clirr
72+
BUILD_SUBDIR: google-auth-library-java
73+
5874
required:
59-
needs: [ units-logging ]
75+
needs: [ units-logging, clirr ]
6076
name: conditional-required-check
6177
if: ${{ always() }} # Always run even if any "needs" jobs fail
6278
runs-on: ubuntu-22.04

.github/workflows/hermetic_library_generation.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ jobs:
4747
head_ref: ${{ github.head_ref }}
4848
token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
4949
force_regenerate_all: ${{ github.event.pull_request.head.ref == 'generate-libraries-main' }}
50+
showcase_mode: true
5051
image_tag: ${{ env.GENERATOR_VERSION }}

.github/workflows/sdk-platform-java-ci.yaml

Lines changed: 16 additions & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ jobs:
5353
GOOGLE_SDK_JAVA_LOGGING: true
5454
working-directory: sdk-platform-java
5555

56+
clirr:
57+
needs: filter
58+
if: ${{ needs.filter.outputs.library == 'true' }}
59+
runs-on: ubuntu-22.04
60+
steps:
61+
- uses: actions/checkout@v3
62+
- uses: actions/setup-java@v3
63+
with:
64+
distribution: temurin
65+
java-version: 11
66+
- run: java -version
67+
- run: .kokoro/build.sh
68+
env:
69+
JOB_TYPE: clirr
70+
BUILD_SUBDIR: sdk-platform-java
71+
5672
sdk-platform-java-8:
5773
needs: filter
5874
if: ${{ needs.filter.outputs.library == 'true' }}
@@ -284,202 +300,6 @@ jobs:
284300
echo "All class files are compatible with Java 8."
285301
working-directory: sdk-platform-java
286302

287-
build-java8-showcase:
288-
needs: filter
289-
if: ${{ needs.filter.outputs.library == 'true' }}
290-
name: "build(8) for showcase"
291-
runs-on: ubuntu-22.04
292-
steps:
293-
- uses: actions/checkout@v4
294-
- uses: actions/setup-java@v4
295-
with:
296-
java-version: 11
297-
distribution: temurin
298-
cache: maven
299-
- name: Install all modules using Java 11
300-
shell: bash
301-
run: .kokoro/build.sh
302-
env:
303-
BUILD_SUBDIR: sdk-platform-java
304-
JOB_TYPE: install
305-
- uses: actions/setup-java@v3
306-
with:
307-
java-version: 8
308-
distribution: temurin
309-
- run: java -version
310-
- name: Parse showcase version
311-
working-directory: sdk-platform-java/java-showcase/gapic-showcase
312-
run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV"
313-
- name: Install showcase server
314-
run: |
315-
sudo mkdir -p /usr/src/showcase
316-
sudo chown -R ${USER} /usr/src/
317-
curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz
318-
cd /usr/src/showcase/
319-
tar -xf showcase-*
320-
./gapic-showcase run &
321-
cd -
322-
- name: Showcase integration tests
323-
working-directory: sdk-platform-java/java-showcase
324-
run: |
325-
mvn verify \
326-
-P enable-integration-tests \
327-
--batch-mode \
328-
--no-transfer-progress
329-
# The `slf4j1_logback` profile brings logging dependency and compiles logging tests, require env var to be set
330-
- name: Showcase integration tests - Logging SLF4J 1.x
331-
working-directory: sdk-platform-java/java-showcase
332-
run: |
333-
mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,slf4j1_logback' \
334-
--batch-mode \
335-
--no-transfer-progress
336-
# Set the Env Var for this step only
337-
env:
338-
GOOGLE_SDK_JAVA_LOGGING: true
339-
# The `disabledLogging` profile tests logging disabled when logging dependency present,
340-
# do not set env var for this step
341-
- name: Showcase integration tests - Logging disabed
342-
working-directory: sdk-platform-java/java-showcase
343-
run: |
344-
mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,disabledLogging' \
345-
--batch-mode \
346-
--no-transfer-progress
347-
- name: Showcase integration tests - Protobuf gen code 3.25.8
348-
working-directory: sdk-platform-java/java-showcase-3.25.8
349-
run: |
350-
mvn verify \
351-
-P enable-integration-tests \
352-
--batch-mode \
353-
--no-transfer-progress
354-
- name: Showcase integration tests - Protobuf gen code 3.21.0
355-
working-directory: sdk-platform-java/java-showcase-3.21.0
356-
run: |
357-
mvn verify \
358-
-P enable-integration-tests \
359-
--batch-mode \
360-
--no-transfer-progress
361-
showcase:
362-
needs: filter
363-
if: ${{ needs.filter.outputs.library == 'true' }}
364-
runs-on: ubuntu-22.04
365-
strategy:
366-
matrix:
367-
java: [ 11, 17, 21, 25 ]
368-
steps:
369-
- uses: actions/checkout@v4
370-
- uses: actions/setup-java@v4
371-
with:
372-
java-version: ${{ matrix.java }}
373-
distribution: temurin
374-
- run: mvn -version
375-
- name: Install Maven modules
376-
shell: bash
377-
run: .kokoro/build.sh
378-
env:
379-
BUILD_SUBDIR: sdk-platform-java
380-
JOB_TYPE: test
381-
- name: Showcase golden tests
382-
working-directory: sdk-platform-java/java-showcase
383-
run: |
384-
mvn test \
385-
-P enable-golden-tests \
386-
--batch-mode \
387-
--no-transfer-progress
388-
- name: Parse showcase version
389-
working-directory: sdk-platform-java/java-showcase/gapic-showcase
390-
run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV"
391-
- name: Install showcase server
392-
run: |
393-
sudo mkdir -p /usr/src/showcase
394-
sudo chown -R ${USER} /usr/src/
395-
curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz
396-
cd /usr/src/showcase/
397-
tar -xf showcase-*
398-
./gapic-showcase run &
399-
cd -
400-
- name: Showcase integration tests
401-
working-directory: sdk-platform-java/java-showcase
402-
run: |
403-
mvn verify \
404-
-P enable-integration-tests \
405-
--batch-mode \
406-
--no-transfer-progress
407-
# The `slf4j2_logback` profile brings logging dependency and compiles logging tests, require env var to be set
408-
- name: Showcase integration tests - Logging SLF4J 2.x
409-
working-directory: sdk-platform-java/java-showcase
410-
run: |
411-
mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,slf4j2_logback' \
412-
--batch-mode \
413-
--no-transfer-progress
414-
# Set the Env Var for this step only
415-
env:
416-
GOOGLE_SDK_JAVA_LOGGING: true
417-
# The `slf4j1_logback` profile brings logging dependency and compiles logging tests, require env var to be set
418-
- name: Showcase integration tests - Logging SLF4J 1.x
419-
working-directory: sdk-platform-java/java-showcase
420-
run: |
421-
mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,slf4j1_logback' \
422-
--batch-mode \
423-
--no-transfer-progress
424-
# Set the Env Var for this step only
425-
env:
426-
GOOGLE_SDK_JAVA_LOGGING: true
427-
# The `disabledLogging` profile tests logging disabled when logging dependency present,
428-
# do not set env var for this step
429-
- name: Showcase integration tests - Logging disabed
430-
working-directory: sdk-platform-java/java-showcase
431-
run: |
432-
mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,disabledLogging' \
433-
--batch-mode \
434-
--no-transfer-progress
435-
- name: Showcase integration tests - Protobuf 3 compatibility with third party library Tensorflow
436-
working-directory: sdk-platform-java/java-showcase
437-
run: |
438-
mvn clean verify -P 'enable-integration-tests,protobuf3,showcase' \
439-
--batch-mode \
440-
--no-transfer-progress
441-
442-
showcase-clirr:
443-
needs: filter
444-
if: ${{ (needs.filter.outputs.library == 'true') && github.base_ref != '' }} # Only execute on pull_request trigger event
445-
runs-on: ubuntu-22.04
446-
steps:
447-
- name: Checkout @ target branch
448-
uses: actions/checkout@v4
449-
with:
450-
ref: ${{ github.base_ref }}
451-
- uses: actions/setup-java@v4
452-
with:
453-
java-version: 17
454-
distribution: temurin
455-
cache: maven
456-
- name: Install Maven modules
457-
shell: bash
458-
run: .kokoro/build.sh
459-
env:
460-
BUILD_SUBDIR: sdk-platform-java
461-
JOB_TYPE: install
462-
- name: Install showcase to local maven repository
463-
run: |
464-
mvn install -B -ntp -T 1C -DskipTests
465-
SHOWCASE_CLIENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
466-
echo "SHOWCASE_CLIENT_VERSION=$SHOWCASE_CLIENT_VERSION" >> "$GITHUB_ENV"
467-
working-directory: sdk-platform-java/java-showcase
468-
- name: Checkout sdk-platform-java @ PR merge commit
469-
uses: actions/checkout@v3
470-
- name: Install sdk-platform-java @ PR merge commit
471-
shell: bash
472-
run: .kokoro/build.sh
473-
env:
474-
JOB_TYPE: install
475-
BUILD_SUBDIR: sdk-platform-java
476-
# Showcase golden test ensures that src changes are already reflected in the PR.
477-
- name: Clirr check
478-
working-directory: sdk-platform-java/java-showcase
479-
run: |
480-
mvn versions:set -B -ntp -DnewVersion=local
481-
mvn clirr:check -B -ntp -DcomparisonVersion=$SHOWCASE_CLIENT_VERSION
482-
483303
gapic-generator-java-bom:
484304
needs: filter
485305
if: ${{ needs.filter.outputs.library == 'true' }}

0 commit comments

Comments
 (0)