Skip to content

Commit d53cb53

Browse files
authored
chore: downstream check for all libraries in single job (#322)
* [DO_NOT_MERGE]chore: downstream check for all libraries in single job * chore: move to java-core directory * chore: fix api-common version * chore: change publish command * chore: make java version 11 * chore: make java version 8 * chore: clone core with https * chore: test more libraries * chore: check all libraries * chore: check all libraries * chore: trigger job with label * chore: trigger on pull request with label * chore: trigger on pull request target with label * chore: run on pull-request * chore: run on pull-request labeled * chore: run on pull-request labeled * chore: only run on pull request label * chore: generalize script * chore: add correct parameters * chore: minor fixes * chore: add retry * fix typo * remove timeout * Update downstream.yaml * chore: fix typo * chore: debug * chore: debug 2 * chore: debug 3 * chore: try cloning in separate directories * chore: fix folder path * chore: remove retry * chore: try all librraies * chore: fix maven build command * Update downstream-client-library-check.sh * Update downstream-client-library-check.sh * Update downstream.yaml * Update downstream-client-library-check.sh
1 parent 441c1b4 commit d53cb53

File tree

2 files changed

+234
-0
lines changed

2 files changed

+234
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
on:
2+
pull_request:
3+
types: [ labeled ]
4+
branches:
5+
- main
6+
name: downstream
7+
jobs:
8+
dependencies:
9+
if: ${{ github.event.label.name == 'downstream-check:run' }}
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
java: [8]
15+
repo:
16+
# This list needs to be updated manually until an automated solution is in place.
17+
- accessapproval
18+
- accesscontextmanager
19+
- aiplatform
20+
- analytics-admin
21+
- analytics-data
22+
- api-gateway
23+
- apigee-connect
24+
- appengine-admin
25+
- area120-tables
26+
- artifact-registry
27+
- asset
28+
- assured-workloads
29+
- automl
30+
- bigquery
31+
- bigqueryconnection
32+
- bigquerydatatransfer
33+
- bigquerymigration
34+
- bigqueryreservation
35+
- bigtable
36+
- billing
37+
- billingbudgets
38+
- binary-authorization
39+
- channel
40+
- cloudbuild
41+
- compute
42+
- contact-center-insights
43+
- container
44+
- containeranalysis
45+
- data-fusion
46+
- datacatalog
47+
- dataflow
48+
- datalabeling
49+
- dataproc
50+
- dataproc-metastore
51+
- datastore
52+
- datastream
53+
- debugger-client
54+
- deploy
55+
- dialogflow
56+
- dialogflow-cx
57+
- dlp
58+
- dms
59+
- dns
60+
- document-ai
61+
- domains
62+
- errorreporting
63+
- essential-contacts
64+
- eventarc
65+
- filestore
66+
- firestore
67+
- functions
68+
- game-servers
69+
- gke-connect-gateway
70+
- gkehub
71+
- gsuite-addons
72+
- iam-admin
73+
- iamcredentials
74+
- iot
75+
- kms
76+
- language
77+
- life-sciences
78+
- logging
79+
- logging-logback
80+
- managed-identities
81+
- mediatranslation
82+
- memcache
83+
- monitoring
84+
- monitoring-dashboards
85+
- network-management
86+
- network-security
87+
- networkconnectivity
88+
- notebooks
89+
- orchestration-airflow
90+
- orgpolicy
91+
- os-config
92+
- os-login
93+
- phishingprotection
94+
- policy-troubleshooter
95+
- private-catalog
96+
- profiler
97+
- pubsublite
98+
- recaptchaenterprise
99+
- recommendations-ai
100+
- recommender
101+
- redis
102+
- resource-settings
103+
- resourcemanager
104+
- retail
105+
- scheduler
106+
- secretmanager
107+
- security-private-ca
108+
- securitycenter
109+
- securitycenter-settings
110+
- service-control
111+
- service-management
112+
- service-usage
113+
- servicedirectory
114+
- shell
115+
- spanner
116+
- spanner-jdbc
117+
- speech
118+
- storage
119+
- storage-nio
120+
- storage-transfer
121+
- talent
122+
- tasks
123+
- texttospeech
124+
- tpu
125+
- trace
126+
- translate
127+
- video-intelligence
128+
- video-transcoder
129+
- vision
130+
- vpcaccess
131+
- webrisk
132+
- websecurityscanner
133+
- workflow-executions
134+
- workflows
135+
steps:
136+
- uses: actions/checkout@v2
137+
- uses: actions/setup-java@v1
138+
with:
139+
java-version: ${{matrix.java}}
140+
- run: java -version
141+
- run: sudo apt-get install libxml2-utils
142+
- run: .kokoro/downstream-client-library-check.sh api-common ${{matrix.repo}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
# Copyright 2020 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+
# Presubmit to ensure the dependencies of the Google Libraries BOM, with the modification of change
17+
# in the PR, pick up the highest versions among transitive dependencies.
18+
# https://maven.apache.org/enforcer/enforcer-rules/requireUpperBoundDeps.html
19+
set -eo pipefail
20+
# Display commands being run.
21+
set -x
22+
23+
CORE_LIBRARY_ARTIFACT=$1
24+
CLIENT_LIBRARY=$2
25+
## Get the directory of the build script
26+
scriptDir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
27+
## cd to the parent directory, i.e. the root of the git repo
28+
cd "${scriptDir}"/..
29+
30+
CORE_VERSION=$( ./gradlew -q properties | grep '^version: ' | cut -d' ' -f2 )
31+
echo "$CORE_VERSION"
32+
33+
# Publish api-common to local maven to make it available for downstream libraries
34+
./gradlew publishToMavenLocal
35+
36+
# Round 1
37+
# Check this java core library against HEAD of java-shared dependencies
38+
39+
git clone "https://github.com/googleapis/java-shared-dependencies.git" --depth=1
40+
pushd java-shared-dependencies/first-party-dependencies
41+
42+
# replace version
43+
xmllint --shell pom.xml << EOF
44+
setns x=http://maven.apache.org/POM/4.0.0
45+
cd .//x:artifactId[text()="${CORE_LIBRARY_ARTIFACT}"]
46+
cd ../x:version
47+
set ${CORE_VERSION}
48+
save pom.xml
49+
EOF
50+
51+
cd ..
52+
mvn verify install -B -V -ntp -fae \
53+
-DskipTests=true \
54+
-Dmaven.javadoc.skip=true \
55+
-Dgcloud.download.skip=true \
56+
-Denforcer.skip=true
57+
58+
SHARED_DEPS_VERSION_POM=pom.xml
59+
# Namespace (xmlns) prevents xmllint from specifying tag names in XPath
60+
SHARED_DEPS_VERSION=$(sed -e 's/xmlns=".*"//' ${SHARED_DEPS_VERSION_POM} | xmllint --xpath '/project/version/text()' -)
61+
62+
if [ -z "${SHARED_DEPS_VERSION}" ]; then
63+
echo "Version is not found in ${SHARED_DEPS_VERSION_POM}"
64+
exit 1
65+
fi
66+
67+
# Round 2
68+
# Check this BOM against java client libraries
69+
git clone "https://github.com/googleapis/java-${CLIENT_LIBRARY}.git" --depth=1
70+
pushd java-"${CLIENT_LIBRARY}"
71+
72+
if [[ $CLIENT_LIBRARY == "bigtable" ]]; then
73+
pushd google-cloud-bigtable-deps-bom
74+
fi
75+
76+
# replace version
77+
xmllint --shell pom.xml << EOF
78+
setns x=http://maven.apache.org/POM/4.0.0
79+
cd .//x:artifactId[text()="google-cloud-shared-dependencies"]
80+
cd ../x:version
81+
set ${SHARED_DEPS_VERSION}
82+
save pom.xml
83+
EOF
84+
85+
if [[ $CLIENT_LIBRARY == "bigtable" ]]; then
86+
popd
87+
fi
88+
89+
mvn verify install -B -V -ntp -fae \
90+
-Dmaven.javadoc.skip=true \
91+
-Dgcloud.download.skip=true \
92+
-Denforcer.skip=true

0 commit comments

Comments
 (0)