Skip to content

Commit cf8e83d

Browse files
test: presubmit against Lite samples (#713)
1 parent 833baed commit cf8e83d

4 files changed

Lines changed: 77 additions & 0 deletions

File tree

β€Ž.github/sync-repo-settings.yamlβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ branchProtectionRules:
1717
- units (8)
1818
- units (11)
1919
- 'Kokoro - Test: Integration'
20+
- 'Kokoro - Against Pub/Sub Lite samples'
2021
- cla/google
2122
- pattern: 1.111.0-sp
2223
isAdminEnforced: true
@@ -33,6 +34,7 @@ branchProtectionRules:
3334
- units (8)
3435
- units (11)
3536
- 'Kokoro - Test: Integration'
37+
- 'Kokoro - Against Pub/Sub Lite samples'
3638
- cla/google
3739
permissionRules:
3840
- team: yoshi-admins

β€Ž.kokoro/build.shβ€Ž

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,41 @@ samples)
7777
SAMPLES_DIR=samples/snapshot
7878
fi
7979

80+
if [[ -f ${SAMPLES_DIR}/pom.xml ]]
81+
then
82+
for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do
83+
[[ -f "$FILE" ]] || continue
84+
source "$FILE"
85+
done
86+
87+
pushd ${SAMPLES_DIR}
88+
mvn -B \
89+
-Penable-samples \
90+
-ntp \
91+
-DtrimStackTrace=false \
92+
-Dclirr.skip=true \
93+
-Denforcer.skip=true \
94+
-fae \
95+
verify
96+
RETURN_CODE=$?
97+
popd
98+
else
99+
echo "no sample pom.xml found - skipping sample tests"
100+
fi
101+
;;
102+
presubmit-against-pubsublite-samples)
103+
## cd to the directory one level above the root of the repo
104+
cd ${scriptDir}/../..
105+
git clone https://github.com/googleapis/java-pubsublite.git
106+
pushd java-pubsublite/
107+
108+
SAMPLES_DIR=samples
109+
# Only run ITs in in snippets/ on presubmit PRs.
110+
if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]]
111+
then
112+
SAMPLES_DIR=samples/snippets
113+
fi
114+
80115
if [[ -f ${SAMPLES_DIR}/pom.xml ]]
81116
then
82117
for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Configure the docker image for kokoro-trampoline.
4+
env_vars: {
5+
key: "TRAMPOLINE_IMAGE"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
7+
}
8+
9+
env_vars: {
10+
key: "JOB_TYPE"
11+
value: "presubmit-against-pubsublite-samples"
12+
}
13+
14+
# TODO: remove this after we've migrated all tests and scripts
15+
env_vars: {
16+
key: "GCLOUD_PROJECT"
17+
value: "java-docs-samples-testing"
18+
}
19+
20+
env_vars: {
21+
key: "GOOGLE_CLOUD_PROJECT"
22+
value: "java-docs-samples-testing"
23+
}
24+
25+
env_vars: {
26+
key: "GOOGLE_CLOUD_PROJECT_NUMBER"
27+
value: "779844219229"
28+
}
29+
30+
env_vars: {
31+
key: "GOOGLE_APPLICATION_CREDENTIALS"
32+
value: "secret_manager/java-docs-samples-service-account"
33+
}
34+
35+
env_vars: {
36+
key: "SECRET_MANAGER_KEYS"
37+
value: "java-docs-samples-service-account"
38+
}

β€Žsynth.pyβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,4 +524,6 @@
524524

525525
java.common_templates(excludes=[
526526
".github/workflows/samples.yaml",
527+
".kokoro/build.sh",
528+
".github/sync-repo-settings.yaml",
527529
])

0 commit comments

Comments
 (0)