Skip to content

Commit

Permalink
test: presubmit against Lite samples (#713)
Browse files Browse the repository at this point in the history
  • Loading branch information
anguillanneuf committed Jun 14, 2021
1 parent 833baed commit cf8e83d
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/sync-repo-settings.yaml
Expand Up @@ -17,6 +17,7 @@ branchProtectionRules:
- units (8)
- units (11)
- 'Kokoro - Test: Integration'
- 'Kokoro - Against Pub/Sub Lite samples'
- cla/google
- pattern: 1.111.0-sp
isAdminEnforced: true
Expand All @@ -33,6 +34,7 @@ branchProtectionRules:
- units (8)
- units (11)
- 'Kokoro - Test: Integration'
- 'Kokoro - Against Pub/Sub Lite samples'
- cla/google
permissionRules:
- team: yoshi-admins
Expand Down
35 changes: 35 additions & 0 deletions .kokoro/build.sh
Expand Up @@ -77,6 +77,41 @@ samples)
SAMPLES_DIR=samples/snapshot
fi

if [[ -f ${SAMPLES_DIR}/pom.xml ]]
then
for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do
[[ -f "$FILE" ]] || continue
source "$FILE"
done

pushd ${SAMPLES_DIR}
mvn -B \
-Penable-samples \
-ntp \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-fae \
verify
RETURN_CODE=$?
popd
else
echo "no sample pom.xml found - skipping sample tests"
fi
;;
presubmit-against-pubsublite-samples)
## cd to the directory one level above the root of the repo
cd ${scriptDir}/../..
git clone https://github.com/googleapis/java-pubsublite.git
pushd java-pubsublite/

SAMPLES_DIR=samples
# Only run ITs in in snippets/ on presubmit PRs.
if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]]
then
SAMPLES_DIR=samples/snippets
fi

if [[ -f ${SAMPLES_DIR}/pom.xml ]]
then
for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do
Expand Down
38 changes: 38 additions & 0 deletions .kokoro/presubmit/presubmit-against-pubsublite-samples.cfg
@@ -0,0 +1,38 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
}

env_vars: {
key: "JOB_TYPE"
value: "presubmit-against-pubsublite-samples"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "java-docs-samples-testing"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "java-docs-samples-testing"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT_NUMBER"
value: "779844219229"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-docs-samples-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-docs-samples-service-account"
}
2 changes: 2 additions & 0 deletions synth.py
Expand Up @@ -524,4 +524,6 @@

java.common_templates(excludes=[
".github/workflows/samples.yaml",
".kokoro/build.sh",
".github/sync-repo-settings.yaml",
])

0 comments on commit cf8e83d

Please sign in to comment.