Skip to content

Commit 1f74b23

Browse files
committed
Merge branch 'main' into update_retrysettings_javadoc
2 parents 5df40ae + f1ee04d commit 1f74b23

File tree

279 files changed

+11166
-1924
lines changed

Some content is hidden

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

279 files changed

+11166
-1924
lines changed

.github/release-please.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ releaseType: java-yoshi
22
bumpMinorPreMajor: true
33
handleGHRelease: true
44
primaryBranch: main
5+
manifest: true
56
extraFiles: ["WORKSPACE"]

.github/workflows/ci.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
- main
55
pull_request:
66
name: ci
7-
env:
8-
SHOWCASE_VERSION: 0.28.2
97
jobs:
108
build:
119
runs-on: ubuntu-22.04
@@ -190,12 +188,14 @@ jobs:
190188
-P enable-golden-tests \
191189
--batch-mode \
192190
--no-transfer-progress
193-
191+
- name: Parse showcase version
192+
working-directory: showcase/gapic-showcase
193+
run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV"
194194
- name: Install showcase server
195195
run: |
196196
sudo mkdir -p /usr/src/showcase
197197
sudo chown -R ${USER} /usr/src/
198-
curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz
198+
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
199199
cd /usr/src/showcase/
200200
tar -xf showcase-*
201201
./gapic-showcase run &
@@ -222,11 +222,14 @@ jobs:
222222
- run: native-image --version
223223
- name: Install sdk-platform-java
224224
run: mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
225+
- name: Parse showcase version
226+
working-directory: showcase/gapic-showcase
227+
run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV"
225228
- name: Install showcase server
226229
run: |
227230
sudo mkdir -p /usr/src/showcase
228231
sudo chown -R ${USER} /usr/src/
229-
curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz
232+
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
230233
cd /usr/src/showcase/
231234
tar -xf showcase-*
232235
./gapic-showcase run &
@@ -267,7 +270,7 @@ jobs:
267270
mvn clirr:check -B -ntp -Dclirr.skip=false -DcomparisonVersion=$SHOWCASE_CLIENT_VERSION
268271
269272
gapic-generator-java-bom:
270-
runs-on: ubuntu-latest
273+
runs-on: ubuntu-22.04
271274
steps:
272275
- uses: actions/checkout@v3
273276
- uses: actions/setup-java@v3
@@ -279,6 +282,7 @@ jobs:
279282
run: |
280283
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
281284
- name: Validate gapic-generator-java-bom
282-
uses: googleapis/java-cloud-bom/tests/validate-bom@v26.13.0
285+
uses: googleapis/java-cloud-bom/tests/validate-bom@41d86dba28c2e724126568b4414ceae6a48e2a49
283286
with:
284287
bom-path: gapic-generator-java-bom/pom.xml
288+

.github/workflows/downstream.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
# Changes to these directories do not directly affect the downstream libraries
7+
paths-ignore:
8+
- gapic-generator-java/**
9+
- library_generation/**
10+
- showcase/**
11+
- test/**
12+
13+
name: Downstream Check
14+
jobs:
15+
downstream-compatibility:
16+
runs-on: ubuntu-22.04
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
repo:
21+
- google-cloud-java
22+
- java-bigtable
23+
- java-bigquery
24+
- java-bigquerystorage
25+
- java-datastore
26+
- java-firestore
27+
- java-logging
28+
- java-logging-logback
29+
- java-pubsub
30+
- java-pubsublite
31+
- java-spanner-jdbc
32+
- java-spanner
33+
- java-storage
34+
- java-storage-nio
35+
steps:
36+
- uses: actions/checkout@v3
37+
- uses: actions/setup-java@v3
38+
with:
39+
java-version: 17
40+
distribution: temurin
41+
- run: mvn -version
42+
- name: Install xmllint
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get -y install libxml2-utils
46+
- name: Test helper scripts
47+
run: ./.kokoro/presubmit/common_test.sh
48+
- name: Perform downstream compatibility testing
49+
run: REPOS_UNDER_TEST="${{ matrix.repo }}" ./.kokoro/presubmit/downstream-compatibility.sh

.github/workflows/sonar.yaml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
name: SonarCloud Build
2-
env:
3-
SHOWCASE_VERSION: 0.28.2
42
on:
53
push:
64
branches:
@@ -15,10 +13,10 @@ jobs:
1513
- uses: actions/checkout@v3
1614
with:
1715
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
18-
- name: Set up JDK 11
16+
- name: Set up JDK 17
1917
uses: actions/setup-java@v3
2018
with:
21-
java-version: 11
19+
java-version: 17
2220
distribution: temurin
2321
- name: Cache SonarCloud packages
2422
uses: actions/cache@v3
@@ -32,11 +30,19 @@ jobs:
3230
path: ~/.m2
3331
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3432
restore-keys: ${{ runner.os }}-m2
33+
- name: Install modules to local maven
34+
run: |
35+
mvn install -T 1C -DskipTests -ntp -B
36+
cd showcase
37+
mvn install -T 1C -DskipTests -ntp -B
38+
- name: Parse showcase version
39+
working-directory: showcase/gapic-showcase
40+
run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV"
3541
- name: Install showcase server
3642
run: |
3743
sudo mkdir -p /usr/src/showcase
3844
sudo chown -R ${USER} /usr/src/
39-
curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz
45+
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
4046
cd /usr/src/showcase/
4147
tar -xf showcase-*
4248
./gapic-showcase run &
@@ -68,15 +74,3 @@ jobs:
6874
-Dsonar.organization=googleapis \
6975
-Dsonar.host.url=https://sonarcloud.io \
7076
-Dsonar.projectName=java_showcase_integration_tests
71-
- name: Build and analyze Showcase Unit Tests Coverage
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
74-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
75-
run: |
76-
mvn -B clean test -Dcheckstyle.skip \
77-
-DenableShowcaseTestCoverage \
78-
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
79-
-Dsonar.projectKey=googleapis_gapic-generator-java_unit_tests \
80-
-Dsonar.organization=googleapis \
81-
-Dsonar.host.url=https://sonarcloud.io \
82-
-Dsonar.projectName=java_showcase_unit_tests
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
paths:
7+
- library_generation/**
8+
9+
workflow_dispatch:
10+
name: verify_library_generation
11+
jobs:
12+
integration_tests:
13+
strategy:
14+
matrix:
15+
java: [ 8 ]
16+
os: [ ubuntu-22.04, macos-12 ]
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/setup-java@v3
21+
with:
22+
java-version: ${{ matrix.java }}
23+
distribution: temurin
24+
cache: maven
25+
- name: Run integration tests
26+
run: |
27+
set -x
28+
library_generation/test/generate_library_integration_test.sh \
29+
--googleapis_gen_url https://cloud-java-bot:${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}@github.com/googleapis/googleapis-gen.git
30+
unit_tests:
31+
strategy:
32+
matrix:
33+
java: [ 8 ]
34+
os: [ ubuntu-22.04, macos-12 ]
35+
runs-on: ${{ matrix.os }}
36+
steps:
37+
- uses: actions/checkout@v3
38+
- name: Run unit tests
39+
run: |
40+
set -x
41+
library_generation/test/generate_library_unit_tests.sh
42+
lint:
43+
runs-on: ubuntu-22.04
44+
steps:
45+
- uses: actions/checkout@v3
46+
- name: Run ShellCheck
47+
uses: ludeeus/[email protected]
48+
with:
49+
scandir: 'library_generation'
50+
format: tty
51+
severity: error

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ target/
1515
# Vscode Settings
1616
.vscode/settings.json
1717

18-
*.iml
18+
*.iml
19+
20+
# library generation
21+
output/
22+
library_generation/output/
23+
showcase/scripts/output/

.kokoro/presubmit/common.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
# Copyright 2023 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# In the given directory ($1),
17+
# update the pom.xml's dependency on the given artifact ($2) to the given version ($3)
18+
# ex: update_dependency google-cloud-java/google-cloud-jar-parent google-cloud-shared-dependencies 1.2.3
19+
function update_pom_dependency {
20+
pushd "$1" || exit 1
21+
xmllint --shell pom.xml &>/dev/null <<EOF
22+
setns x=http://maven.apache.org/POM/4.0.0
23+
cd .//x:artifactId[text()="$2"]
24+
cd ../x:version
25+
set $3
26+
save pom.xml
27+
EOF
28+
popd || exit 1
29+
}
30+
31+
# Find all pom.xml files that declare a specific version for the given artifact ($1)
32+
function find_all_poms_with_versioned_dependency {
33+
poms=($(find . -name pom.xml))
34+
for pom in "${poms[@]}"; do
35+
if xmllint --xpath "//*[local-name()='artifactId' and text()='$1']/following-sibling::*[local-name()='version']" "$pom" &>/dev/null; then
36+
found+=("$pom")
37+
fi
38+
done
39+
POMS=(${found[@]})
40+
unset found
41+
export POMS
42+
}
43+
44+
# In the given directory ($1),
45+
# find and update all pom.xmls' dependencies on the given artifact ($2) to the given version ($3)
46+
# ex: update_all_poms_dependency google-cloud-java google-cloud-shared-dependencies 1.2.3
47+
function update_all_poms_dependency {
48+
pushd "$1" || exit 1
49+
find_all_poms_with_versioned_dependency "$2"
50+
for pom in $POMS; do
51+
update_pom_dependency "$(dirname "$pom")" "$2" "$3"
52+
done
53+
git diff
54+
popd || exit 1
55+
}
56+
57+
# Parse the version of the pom.xml file in the given directory ($1)
58+
# ex: VERSION=$(parse_pom_version java-shared-dependencies)
59+
function parse_pom_version {
60+
# Namespace (xmlns) prevents xmllint from specifying tag names in XPath
61+
result=$(sed -e 's/xmlns=".*"//' "$1/pom.xml" | xmllint --xpath '/project/version/text()' -)
62+
63+
if [ -z "${result}" ]; then
64+
echo "Version is not found in $1"
65+
exit 1
66+
fi
67+
echo "$result"
68+
}
69+
70+
# ex: find_last_release_version java-bigtable
71+
# ex: find_last_release_version java-storage 2.22.x
72+
function find_last_release_version {
73+
branch=${2-"main"} # Default to using main branch
74+
curl -s -o "versions_$1.txt" "https://raw.githubusercontent.com/googleapis/$1/$branch/versions.txt"
75+
76+
# First check to see if there's an entry for the overall repo. Used for google-cloud-java.
77+
primary_artifact=$(grep -E "^$1" "versions_$1.txt" | head -n 1)
78+
if [ -z "$primary_artifact" ]; then
79+
# Otherwise, use the first google-cloud-* artifact's version.
80+
primary_artifact=$(grep -E "^google-cloud-" "versions_$1.txt" | head -n 1)
81+
fi
82+
if [ -z "$primary_artifact" ]; then
83+
echo "Unable to identify primary artifact for $1"
84+
exit 1
85+
fi
86+
87+
parts=($(echo "$primary_artifact" | tr ":" "\n"))
88+
echo "${parts[1]}"
89+
}

0 commit comments

Comments
 (0)