Skip to content

Commit 3e1b136

Browse files
feat: set up repo for samples (#196)
1 parent 87e036e commit 3e1b136

File tree

8 files changed

+244
-0
lines changed

8 files changed

+244
-0
lines changed

.kokoro/continuous/java11-samples.cfg

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Download secrets from Cloud Storage.
18+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples"
19+
20+
# Configure the docker image for kokoro-trampoline.
21+
env_vars: {
22+
key: "TRAMPOLINE_IMAGE"
23+
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
24+
}
25+
26+
# Tell trampoline which tests to run.
27+
env_vars: {
28+
key: "TRAMPOLINE_BUILD_FILE"
29+
value: "github/java-pubsub/.kokoro/run_samples_tests.sh"
30+
}

.kokoro/continuous/jave8-samples.cfg

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Download secrets from Cloud Storage.
18+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples"
19+
20+
# Configure the docker image for kokoro-trampoline.
21+
env_vars: {
22+
key: "TRAMPOLINE_IMAGE"
23+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
24+
}
25+
26+
# Tell trampoline which tests to run.
27+
env_vars: {
28+
key: "TRAMPOLINE_BUILD_FILE"
29+
value: "github/java-pubsub/.kokoro/run_samples_tests.sh"
30+
}
31+
© 2020 GitHub, Inc.

.kokoro/nightly/java11-samples.cfg

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Download secrets from Cloud Storage.
18+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples"
19+
20+
# Configure the docker image for kokoro-trampoline.
21+
env_vars: {
22+
key: "TRAMPOLINE_IMAGE"
23+
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
24+
}
25+
26+
# Tell trampoline which tests to run.
27+
env_vars: {
28+
key: "TRAMPOLINE_BUILD_FILE"
29+
value: "github/java-pubsub/.kokoro/run_samples_tests.sh"
30+
}

.kokoro/nightly/jave8-samples.cfg

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Download secrets from Cloud Storage.
18+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples"
19+
20+
# Configure the docker image for kokoro-trampoline.
21+
env_vars: {
22+
key: "TRAMPOLINE_IMAGE"
23+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
24+
}
25+
26+
# Tell trampoline which tests to run.
27+
env_vars: {
28+
key: "TRAMPOLINE_BUILD_FILE"
29+
value: "github/java-pubsub/.kokoro/run_samples_tests.sh"
30+
}
31+
© 2020 GitHub, Inc.

.kokoro/presubmit/java11-samples.cfg

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Download secrets from Cloud Storage.
18+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples"
19+
20+
# Configure the docker image for kokoro-trampoline.
21+
env_vars: {
22+
key: "TRAMPOLINE_IMAGE"
23+
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
24+
}
25+
26+
# Tell trampoline which tests to run.
27+
env_vars: {
28+
key: "TRAMPOLINE_BUILD_FILE"
29+
value: "github/java-pubsub/.kokoro/run_samples_tests.sh"
30+
}

.kokoro/presubmit/jave8-samples.cfg

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Download secrets from Cloud Storage.
18+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples"
19+
20+
# Configure the docker image for kokoro-trampoline.
21+
env_vars: {
22+
key: "TRAMPOLINE_IMAGE"
23+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
24+
}
25+
26+
# Tell trampoline which tests to run.
27+
env_vars: {
28+
key: "TRAMPOLINE_BUILD_FILE"
29+
value: "github/java-pubsub/.kokoro/run_samples_tests.sh"
30+
}
31+
© 2020 GitHub, Inc.

.kokoro/run_samples_tests.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
# Copyright 2020 Google Inc.
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+
# `-e` enables the script to automatically fail when a command fails
17+
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
18+
set -eo pipefail
19+
20+
echo "********** MAVEN INFO ***********"
21+
mvn -v
22+
23+
# Get the directory of the build script
24+
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
25+
## cd to the parent directory, i.e. the root of the git repo
26+
cd ${scriptDir}/..
27+
28+
# include common functions
29+
source ${scriptDir}/common.sh
30+
31+
# Attempt to install 3 times with exponential backoff (starting with 10 seconds)
32+
retry_with_backoff 3 10 \
33+
mvn install -B -V \
34+
-DskipTests=true \
35+
-Dclirr.skip=true \
36+
-Denforcer.skip=true \
37+
-Dmaven.javadoc.skip=true \
38+
-Dgcloud.download.skip=true \
39+
-T 1C
40+
41+
# Activate service account
42+
gcloud auth activate-service-account \
43+
--key-file="$GOOGLE_APPLICATION_CREDENTIALS" \
44+
--project="$GOOGLE_CLOUD_PROJECT"
45+
46+
# Move into the samples directory
47+
cd samples/
48+
49+
echo -e "\n******************** RUNNING SAMPLE TESTS ********************"
50+
51+
mvn --fail-at-end clean verify

pom.xml

+10
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@
234234
<module>google-cloud-pubsub-bom</module>
235235
</modules>
236236

237+
<!-- // The samples CI build is configured to run with `-Penable-samples` (.kokoro/build.sh L78) -->
238+
<profiles>
239+
<profile>
240+
<id>enable-samples</id>
241+
<modules>
242+
<module>samples</module>
243+
</modules>
244+
</profile>
245+
</profiles>
246+
237247
<reporting>
238248
<plugins>
239249
<plugin>

0 commit comments

Comments
 (0)