Skip to content

Commit 6269611

Browse files
authored
chore: downstream check for all libraries in single job (#1960)
1 parent 9505853 commit 6269611

File tree

2 files changed

+257
-0
lines changed

2 files changed

+257
-0
lines changed

.github/workflows/downstream.yaml

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
- accessapproval
17+
- accesscontextmanager
18+
- aiplatform
19+
- analytics-admin
20+
- analytics-data
21+
- api-gateway
22+
- apigee-connect
23+
- appengine-admin
24+
- area120-tables
25+
- artifact-registry
26+
- asset
27+
- assured-workloads
28+
- automl
29+
- bigquery
30+
- bigqueryconnection
31+
- bigquerydatatransfer
32+
- bigquerymigration
33+
- bigqueryreservation
34+
- bigtable
35+
- billing
36+
- billingbudgets
37+
- binary-authorization
38+
- channel
39+
- cloudbuild
40+
- compute
41+
- contact-center-insights
42+
- container
43+
- containeranalysis
44+
- data-fusion
45+
- datacatalog
46+
- dataflow
47+
- datalabeling
48+
- dataproc
49+
- dataproc-metastore
50+
- datastore
51+
- datastream
52+
- debugger-client
53+
- deploy
54+
- dialogflow
55+
- dialogflow-cx
56+
- dlp
57+
- dms
58+
- dns
59+
- document-ai
60+
- domains
61+
- errorreporting
62+
- essential-contacts
63+
- eventarc
64+
- filestore
65+
- firestore
66+
- functions
67+
- game-servers
68+
- gke-connect-gateway
69+
- gkehub
70+
- gsuite-addons
71+
- iam-admin
72+
- iamcredentials
73+
- iot
74+
- kms
75+
- language
76+
- life-sciences
77+
- logging
78+
- logging-logback
79+
- managed-identities
80+
- mediatranslation
81+
- memcache
82+
- monitoring
83+
- monitoring-dashboards
84+
- network-management
85+
- network-security
86+
- networkconnectivity
87+
- notebooks
88+
- orchestration-airflow
89+
- orgpolicy
90+
- os-config
91+
- os-login
92+
- phishingprotection
93+
- policy-troubleshooter
94+
- private-catalog
95+
- profiler
96+
- pubsublite
97+
- recaptchaenterprise
98+
- recommendations-ai
99+
- recommender
100+
- redis
101+
- resource-settings
102+
- resourcemanager
103+
- retail
104+
- scheduler
105+
- secretmanager
106+
- security-private-ca
107+
- securitycenter
108+
- securitycenter-settings
109+
- service-control
110+
- service-management
111+
- service-usage
112+
- servicedirectory
113+
- shell
114+
- spanner
115+
- spanner-jdbc
116+
- speech
117+
- storage
118+
- storage-nio
119+
- storage-transfer
120+
- talent
121+
- tasks
122+
- texttospeech
123+
- tpu
124+
- trace
125+
- translate
126+
- video-intelligence
127+
- video-transcoder
128+
- vision
129+
- vpcaccess
130+
- webrisk
131+
- websecurityscanner
132+
- workflow-executions
133+
- workflows
134+
steps:
135+
- uses: actions/checkout@v2
136+
- uses: actions/setup-java@v1
137+
with:
138+
java-version: ${{matrix.java}}
139+
- run: java -version
140+
- run: sudo apt-get install libxml2-utils
141+
- run: .kokoro/downstream-client-library-check.sh google-api-client-bom ${{matrix.repo}}
+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/bin/bash
2+
# Copyright 2022 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+
set -eo pipefail
17+
# Display commands being run.
18+
set -x
19+
20+
21+
CORE_LIBRARY_ARTIFACT=$1
22+
CLIENT_LIBRARY=$2
23+
## Get the directory of the build script
24+
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
25+
26+
# Building this library locally requires a one time set up of google-play-services-basement
27+
mkdir /tmp/foo && cd /tmp/foo
28+
wget https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-basement/8.3.0/play-services-basement-8.3.0.aar
29+
unzip play-services-basement-8.3.0.aar
30+
mvn install:install-file \
31+
-Dfile=classes.jar \
32+
-DgroupId=com.google.android.google-play-services \
33+
-DartifactId=google-play-services \
34+
-Dversion=1 \
35+
-Dpackaging=jar
36+
37+
## cd to the parent directory, i.e. the root of the git repo
38+
cd ${scriptDir}/..
39+
40+
# Make java core library artifacts available for 'mvn validate' at the bottom
41+
mvn verify install -B -V -ntp -fae \
42+
-DskipTests=true \
43+
-Dmaven.javadoc.skip=true \
44+
-Dgcloud.download.skip=true \
45+
-Denforcer.skip=true
46+
47+
# Read the current version of this java core library in the POM. Example version: '0.116.1-alpha-SNAPSHOT'
48+
CORE_VERSION_POM=pom.xml
49+
# Namespace (xmlns) prevents xmllint from specifying tag names in XPath
50+
CORE_VERSION=`sed -e 's/xmlns=".*"//' ${CORE_VERSION_POM} | xmllint --xpath '/project/version/text()' -`
51+
52+
if [ -z "${CORE_VERSION}" ]; then
53+
echo "Version is not found in ${CORE_VERSION_POM}"
54+
exit 1
55+
fi
56+
echo "Version: ${CORE_VERSION}"
57+
58+
# Round 1
59+
# Check this java core library against HEAD of java-shared dependencies
60+
61+
git clone "https://github.com/googleapis/java-shared-dependencies.git" --depth=1
62+
pushd java-shared-dependencies/first-party-dependencies
63+
64+
# replace version
65+
xmllint --shell <(cat pom.xml) << EOF
66+
setns x=http://maven.apache.org/POM/4.0.0
67+
cd .//x:artifactId[text()="${CORE_LIBRARY_ARTIFACT}"]
68+
cd ../x:version
69+
set ${CORE_VERSION}
70+
save pom.xml
71+
EOF
72+
73+
# run dependencies script
74+
cd ..
75+
mvn verify install -B -V -ntp -fae \
76+
-DskipTests=true \
77+
-Dmaven.javadoc.skip=true \
78+
-Dgcloud.download.skip=true \
79+
-Denforcer.skip=true
80+
81+
SHARED_DEPS_VERSION_POM=pom.xml
82+
# Namespace (xmlns) prevents xmllint from specifying tag names in XPath
83+
SHARED_DEPS_VERSION=`sed -e 's/xmlns=".*"//' ${SHARED_DEPS_VERSION_POM} | xmllint --xpath '/project/version/text()' -`
84+
85+
if [ -z "${SHARED_DEPS_VERSION}" ]; then
86+
echo "Version is not found in ${SHARED_DEPS_VERSION_POM}"
87+
exit 1
88+
fi
89+
90+
# Round 2
91+
92+
# Check this BOM against java client libraries
93+
git clone "https://github.com/googleapis/java-${CLIENT_LIBRARY}.git" --depth=1
94+
pushd java-${CLIENT_LIBRARY}
95+
96+
if [[ $CLIENT_LIBRARY == "bigtable" ]]; then
97+
pushd google-cloud-bigtable-deps-bom
98+
fi
99+
100+
# replace version
101+
xmllint --shell <(cat pom.xml) << EOF
102+
setns x=http://maven.apache.org/POM/4.0.0
103+
cd .//x:artifactId[text()="google-cloud-shared-dependencies"]
104+
cd ../x:version
105+
set ${SHARED_DEPS_VERSION}
106+
save pom.xml
107+
EOF
108+
109+
if [[ $CLIENT_LIBRARY == "bigtable" ]]; then
110+
popd
111+
fi
112+
113+
mvn verify install -B -V -ntp -fae \
114+
-Dmaven.javadoc.skip=true \
115+
-Dgcloud.download.skip=true \
116+
-Denforcer.skip=true

0 commit comments

Comments
 (0)