Skip to content

Commit 9e80a24

Browse files
authored
ci: separate out storage emulator from cxx20 builds (googleapis#16167)
1 parent adba263 commit 9e80a24

7 files changed

Lines changed: 102 additions & 6 deletions

File tree

ci/cloudbuild/builds/clang-cxx20.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@ io::run cmake --build cmake-out
4040
mapfile -t ctest_args < <(ctest::common_args)
4141
io::run env -C cmake-out ctest "${ctest_args[@]}" -LE "integration-test"
4242

43-
integration::ctest_with_emulators "cmake-out"
43+
if [[ "${INTEGRATION_LIBRARIES:-}" == "storage" ]]; then
44+
integration::ctest_storage_with_emulators "cmake-out"
45+
elif [[ "${INTEGRATION_LIBRARIES:-}" == "all_bar_storage" ]]; then
46+
integration::ctest_with_emulators "cmake-out" "storage"
47+
else
48+
integration::ctest_with_emulators "cmake-out"
49+
fi

ci/cloudbuild/builds/cxx20.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@ io::run cmake --build cmake-out
4040
mapfile -t ctest_args < <(ctest::common_args)
4141
io::run env -C cmake-out ctest "${ctest_args[@]}" -LE "integration-test"
4242

43-
integration::ctest_with_emulators "cmake-out"
43+
if [[ "${INTEGRATION_LIBRARIES:-}" == "storage" ]]; then
44+
integration::ctest_storage_with_emulators "cmake-out"
45+
elif [[ "${INTEGRATION_LIBRARIES:-}" == "all_bar_storage" ]]; then
46+
integration::ctest_with_emulators "cmake-out" "storage"
47+
else
48+
integration::ctest_with_emulators "cmake-out"
49+
fi

ci/cloudbuild/builds/lib/integration.sh

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ function integration::bazel_with_emulators() {
428428
# integration::ctest_with_emulators "cmake-out"
429429
#
430430
function integration::ctest_with_emulators() {
431-
readonly EMULATOR_SCRIPT="run_integration_tests_emulator_cmake.sh"
431+
local -r EMULATOR_SCRIPT="run_integration_tests_emulator_cmake.sh"
432432
if [[ $# == 0 ]]; then
433433
io::log_red "error: build output directory required"
434434
return 1
@@ -446,9 +446,11 @@ function integration::ctest_with_emulators() {
446446
"google/cloud/pubsub/ci/${EMULATOR_SCRIPT}" \
447447
"${cmake_out}" "${ctest_args[@]}" -L integration-test-emulator
448448

449-
io::log_h2 "Running Storage integration tests (with emulator)"
450-
"${PROJECT_ROOT}/google/cloud/storage/ci/${EMULATOR_SCRIPT}" \
451-
"${cmake_out}" "${ctest_args[@]}" -L integration-test-emulator
449+
if ! [[ "${skip_args[*]}" =~ "storage" ]]; then
450+
io::log_h2 "Running Storage integration tests (with emulator)"
451+
"${PROJECT_ROOT}/google/cloud/storage/ci/${EMULATOR_SCRIPT}" \
452+
"${cmake_out}" "${ctest_args[@]}" -L integration-test-emulator
453+
fi
452454

453455
if ! [[ "${skip_args[*]}" =~ "spanner" ]]; then
454456
io::log_h2 "Running Spanner integration tests (with emulator)"
@@ -464,3 +466,24 @@ function integration::ctest_with_emulators() {
464466
"google/cloud/internal/ci/${EMULATOR_SCRIPT}" \
465467
"${cmake_out}" "${ctest_args[@]}" -L integration-test-emulator
466468
}
469+
470+
# Runs Storage integration tests with CTest using emulators.
471+
function integration::ctest_storage_with_emulators() {
472+
local -r EMULATOR_SCRIPT="run_integration_tests_emulator_cmake.sh"
473+
if [[ $# == 0 ]]; then
474+
io::log_red "error: build output directory required"
475+
return 1
476+
fi
477+
478+
local cmake_out="$1"
479+
480+
local -a ctest_args
481+
mapfile -t ctest_args < <(ctest::common_args)
482+
# Integration tests are inherently flaky. Make up to three attempts to get the
483+
# test passing.
484+
ctest_args+=(--repeat until-pass:3)
485+
486+
io::log_h2 "Running Storage integration tests (with emulator)"
487+
"${PROJECT_ROOT}/google/cloud/storage/ci/${EMULATOR_SCRIPT}" \
488+
"${cmake_out}" "${ctest_args[@]}" -L integration-test-emulator
489+
}

ci/cloudbuild/triggers/cxx20-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ name: cxx20-ci
2323
substitutions:
2424
_BUILD_NAME: cxx20
2525
_DISTRO: fedora-latest-cxx20
26+
_INTEGRATION_LIBRARIES: all_bar_storage
2627
_TRIGGER_TYPE: ci
2728
tags:
2829
- ci

ci/cloudbuild/triggers/cxx20-pr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ name: cxx20-pr
2424
substitutions:
2525
_BUILD_NAME: cxx20
2626
_DISTRO: fedora-latest-cxx20
27+
_INTEGRATION_LIBRARIES: all_bar_storage
2728
_TRIGGER_TYPE: pr
2829
tags:
2930
- pr
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2026 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+
# https://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+
filename: ci/cloudbuild/cloudbuild.yaml
16+
github:
17+
name: google-cloud-cpp
18+
owner: googleapis
19+
push:
20+
branch: main
21+
includeBuildLogs: INCLUDE_BUILD_LOGS_WITH_STATUS
22+
name: cxx20-storage-ci
23+
substitutions:
24+
_BUILD_NAME: cxx20
25+
_DISTRO: fedora-latest-cxx20
26+
_INTEGRATION_LIBRARIES: storage
27+
_TRIGGER_TYPE: ci
28+
tags:
29+
- ci
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2026 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+
# https://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+
filename: ci/cloudbuild/cloudbuild.yaml
16+
github:
17+
name: google-cloud-cpp
18+
owner: googleapis
19+
pullRequest:
20+
branch: main
21+
commentControl: COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY
22+
includeBuildLogs: INCLUDE_BUILD_LOGS_WITH_STATUS
23+
name: cxx20-storage-pr
24+
substitutions:
25+
_BUILD_NAME: cxx20
26+
_DISTRO: fedora-latest-cxx20
27+
_INTEGRATION_LIBRARIES: storage
28+
_TRIGGER_TYPE: pr
29+
tags:
30+
- pr

0 commit comments

Comments
 (0)