Skip to content

Commit 3b73a2a

Browse files
authored
CXX-2683 Replace codecov-bash with new Codecov uploader (#958)
* CXX-2683 Replace old codecov-bash with new uploader * Remove printing contents of MONGOC_PREFIX directory * Remove VERBOSE output when running GNU Make * Reduce verbosity of MSBuild output to minimal * Remove standard output when building libmongocrypt and libmongoc * Remove standard output when updating CA certificates * Defer standard output to failure for examples * Ensure replset member on port 27017 is primary
1 parent 54112b0 commit 3b73a2a

File tree

12 files changed

+129
-45
lines changed

12 files changed

+129
-45
lines changed

.evergreen/build_example_projects.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@ cd examples/projects
1616
for project in bsoncxx mongocxx; do
1717
(
1818
cd $project
19-
( cd cmake/$DIR && ./build.sh )
20-
( cd cmake-deprecated/$DIR && ./build.sh )
19+
20+
if ! ( cd cmake/$DIR && ./build.sh >|output.txt 2>&1); then
21+
cat output.txt 1>&2
22+
exit 1
23+
fi
24+
25+
if ! ( cd cmake-deprecated/$DIR && ./build.sh >|output.txt 2>&1); then
26+
cat output.txt 1>&2
27+
exit 1
28+
fi
29+
2130
if [ "Windows_NT" != "$OS" ]; then
22-
( cd pkg-config/$DIR && ./build.sh )
31+
if ! ( cd pkg-config/$DIR && ./build.sh >|output.txt 2>&1); then
32+
cat output.txt 1>&2
33+
exit 1
34+
fi
2335
fi
2436
)
2537
done

.evergreen/compile.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ case "$OS" in
3939

4040
cygwin*)
4141
GENERATOR=${GENERATOR:-"Visual Studio 14 2015 Win64"}
42-
CMAKE_BUILD_OPTS="/maxcpucount:$CONCURRENCY"
42+
CMAKE_BUILD_OPTS="/verbosity:minimal /maxcpucount:$CONCURRENCY"
4343
CMAKE_EXAMPLES_TARGET=examples/examples
4444
;;
4545

@@ -52,10 +52,10 @@ esac
5252
. .evergreen/find_cmake.sh
5353

5454
cd build
55-
"$CMAKE" -G "$GENERATOR" "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" -DCMAKE_VERBOSE_MAKEFILE=ON -DMONGOCXX_ENABLE_SLOW_TESTS=ON -DENABLE_UNINSTALL=ON "$@" ..
55+
"$CMAKE" -G "$GENERATOR" "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" -DMONGOCXX_ENABLE_SLOW_TESTS=ON -DENABLE_UNINSTALL=ON "$@" ..
5656
"$CMAKE" --build . --config $BUILD_TYPE -- $CMAKE_BUILD_OPTS
57-
"$CMAKE" --build . --config $BUILD_TYPE --target install
58-
"$CMAKE" --build . --config $BUILD_TYPE --target $CMAKE_EXAMPLES_TARGET
57+
"$CMAKE" --build . --config $BUILD_TYPE --target install -- $CMAKE_BUILD_OPTS
58+
"$CMAKE" --build . --config $BUILD_TYPE --target $CMAKE_EXAMPLES_TARGET -- $CMAKE_BUILD_OPTS
5959

6060
if [ "$_RUN_DISTCHECK" ]; then
6161
DISTCHECK_BUILD_OPTS="-j$CONCURRENCY" "$CMAKE" --build . --config $BUILD_TYPE --target distcheck

.evergreen/install_c_driver.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ fi
3131

3232
echo "libmongoc version: ${mongoc_version}"
3333

34-
echo "Installing C Driver into ${mongoc_dir}..."
35-
3634
# Download tarball from GitHub and extract into ${mongoc_dir}.
3735
rm -rf "${mongoc_dir}"
3836
mkdir "${mongoc_dir}"
@@ -72,7 +70,11 @@ cmake_binary="$(find_cmake_latest)"
7270
command -v "${cmake_binary:?}"
7371

7472
# Install libmongocrypt.
75-
"${mongoc_dir}/.evergreen/scripts/compile-libmongocrypt.sh" "${cmake_binary}" "${mongoc_idir}" "${mongoc_install_idir}"
73+
{
74+
echo "Installing libmongocrypt into ${mongoc_dir}..." 1>&2
75+
"${mongoc_dir}/.evergreen/scripts/compile-libmongocrypt.sh" "${cmake_binary}" "${mongoc_idir}" "${mongoc_install_idir}"
76+
echo "Installing libmongocrypt into ${mongoc_dir}... done." 1>&2
77+
} >/dev/null
7678

7779
if [[ "${OSTYPE}" == darwin* ]]; then
7880
# MacOS does not have nproc.
@@ -127,7 +129,9 @@ else
127129
fi
128130

129131
# Install libmongoc.
130-
"${cmake_binary}" -S "${mongoc_idir}" -B "${mongoc_idir}" -G "${cmake_generator}" "${configure_flags[@]}"
131-
"${cmake_binary}" --build "${mongoc_idir}" --config Debug --target install -- "${compile_flags[@]}"
132-
133-
echo "Installing C Driver into ${mongoc_dir}... done."
132+
{
133+
echo "Installing C Driver into ${mongoc_dir}..." 1>&2
134+
"${cmake_binary}" -S "${mongoc_idir}" -B "${mongoc_idir}" -G "${cmake_generator}" "${configure_flags[@]}"
135+
"${cmake_binary}" --build "${mongoc_idir}" --config Debug --target install -- "${compile_flags[@]}"
136+
echo "Installing C Driver into ${mongoc_dir}... done." 1>&2
137+
} >/dev/null

.mci.yml

Lines changed: 83 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,48 @@ functions:
191191
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config
192192
./.evergreen/run-orchestration.sh
193193
194+
# Ensure server on port 27017 is the primary server.
195+
if [[ "$TOPOLOGY" == replica_set ]]; then
196+
# Replset members should be on the following ports.
197+
declare hosts="localhost:27017,localhost:27018,localhost:27019"
198+
199+
# Authentication may be required.
200+
declare creds
201+
if [[ -n "$AUTH" ]]; then
202+
creds="bob:pwd123@"
203+
else
204+
creds=""
205+
fi
206+
207+
declare uri
208+
printf -v uri "mongodb://%s%s" "$creds" "$hosts"
209+
210+
# Raise the priority of the member on port 27017. Others should have priority 1.
211+
declare script
212+
printf -v script "%s\n%s\n%s\n" \
213+
"let c = rs.conf()" \
214+
"c.members.find((m) => m.host.includes('27017')).priority = 10" \
215+
"rs.reconfig(c)"
216+
217+
mongosh --quiet "$uri" --eval "$script"
218+
219+
# Wait up to a minute for member on port 27017 to become primary.
220+
wait_for_primary() {
221+
for _ in $(seq 60); do
222+
if mongosh --quiet "$uri" --eval "quit(rs.hello().primary.includes('27017') ? 0 : 1)"; then
223+
return 0
224+
else
225+
sleep 1
226+
fi
227+
done
228+
echo "Could not set replset member on port 27017 as primary"
229+
return 1
230+
}
231+
echo "Waiting for replset member 27017 to become primary..."
232+
wait_for_primary
233+
echo "Waiting for replset member 27017 to become primary... done."
234+
fi
235+
194236
# Copy mongocryptd up so other functions can find it later, since we can't share PATHs
195237
if [ -f $MONGODB_BINARIES/mongocryptd ]; then
196238
cp $MONGODB_BINARIES/mongocryptd ../mongocryptd
@@ -221,11 +263,13 @@ functions:
221263
222264
"install_c_driver":
223265
- command: expansions.update
266+
type: setup
224267
params:
225268
updates:
226269
- key: mongoc_version_default
227270
value: *mongoc_version_default
228271
- command: shell.exec
272+
type: setup
229273
params:
230274
shell: bash
231275
add_expansions_to_env: true
@@ -325,7 +369,6 @@ functions:
325369
326370
MONGOC_PREFIX="$(pwd)/../mongoc"
327371
echo "MONGOC_PREFIX=$MONGOC_PREFIX"
328-
ls -l $MONGOC_PREFIX
329372
330373
if [ "Windows_NT" == "$OS" ]; then
331374
MONGOC_PREFIX=$(cygpath -m "$MONGOC_PREFIX")
@@ -490,7 +533,7 @@ functions:
490533
fi
491534
;;
492535
esac
493-
}
536+
} >/dev/null
494537
register_ca_cert
495538
echo "Registering CA certificate for KMS TLS tests... done."
496539
@@ -517,12 +560,18 @@ functions:
517560
fi
518561
519562
if [ "Windows_NT" == "$OS" ]; then
520-
CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} RUN_TESTS.vcxproj
563+
CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal RUN_TESTS.vcxproj
521564
# Only run examples if MONGODB_API_VERSION is unset. We do not append
522565
# API version to example clients, so examples will fail when requireApiVersion
523566
# is true.
524567
if [[ -z "$MONGODB_API_VERSION" ]]; then
525-
CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} examples/run-examples.vcxproj
568+
echo "Running examples..."
569+
if ! CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} /verbosity:minimal examples/run-examples.vcxproj >|output.txt 2>&1; then
570+
# Only emit output on failure.
571+
cat output.txt 1>&2
572+
exit 1
573+
fi
574+
echo "Running examples... done."
526575
fi
527576
else
528577
# ENABLE_SLOW_TESTS is required to run the slow tests that are disabled by default. The slow tests should not be run if explicitly disabled.
@@ -566,24 +615,29 @@ functions:
566615
# is true.
567616
if [[ -z "$MONGODB_API_VERSION" ]]; then
568617
for test in $EXAMPLES; do
618+
echo "Running $test"
569619
case "$test" in
570620
*encryption*)
571-
echo "Skipping client side encryption example"
621+
echo " - Skipping client side encryption example"
572622
;;
573623
*change_stream*)
574-
echo "TODO CXX-1201, enable for servers that support change streams"
624+
echo " - TODO CXX-1201, enable for servers that support change streams"
575625
;;
576626
*client_session*)
577-
echo "TODO CXX-1201, enable for servers that support change streams"
627+
echo " - TODO CXX-1201, enable for servers that support change streams"
578628
;;
579629
*with_transaction*)
580-
echo "TODO CXX-1201, enable for servers that support transactions"
630+
echo " - TODO CXX-1201, enable for servers that support transactions"
581631
;;
582632
*causal_consistency*)
583-
echo "TODO CXX-1201, enable for servers that support transactions"
633+
echo " - TODO CXX-1201, enable for servers that support transactions"
584634
;;
585635
*)
586-
${test_params} $test
636+
if ! ${test_params} $test >|output.txt 2>&1; then
637+
# Only emit output on failure.
638+
cat output.txt 1>&2
639+
exit 1
640+
fi
587641
;;
588642
esac
589643
done
@@ -625,7 +679,9 @@ functions:
625679
# API version to example clients, so example projects will fail when requireApiVersion
626680
# is true.
627681
if [[ -z "$MONGODB_API_VERSION" ]]; then
682+
echo "Building example projects..."
628683
.evergreen/build_example_projects.sh
684+
echo "Building example projects... done."
629685
fi
630686
unset MONGODB_API_VERSION
631687
@@ -710,13 +766,25 @@ functions:
710766
shell: bash
711767
working_dir: "mongo-cxx-driver"
712768
script: |
713-
# redacted code coverage token
714-
export CODECOV_TOKEN="${codecov_token}"
715-
716769
set -o errexit
717770
set -o pipefail
718771
719-
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
772+
# Nothing to do if code coverage was not enabled.
773+
if [[ -z "${code_coverage_cmake_flags}" ]]; then
774+
exit 0
775+
fi
776+
777+
# Note: coverage is currently only enabled on the ubuntu-1804 distro.
778+
# This script does not support MacOS, Windows, or non-x86_64 distros.
779+
# Update accordingly if code coverage is expanded to other distros.
780+
curl -Os https://uploader.codecov.io/latest/linux/codecov
781+
chmod +x codecov
782+
783+
# -Z: Exit with a non-zero value if error.
784+
# -g: Run with gcov support.
785+
# -t: Codecov upload token.
786+
# perl: filter verbose "Found" list and "Processing" messages.
787+
./codecov -Zgt "${codecov_token}" | perl -lne 'print if not m|(^.*\.gcov(\.\.\.)?$)|'
720788
721789
#######################################
722790
# Post Task #
@@ -899,7 +967,7 @@ tasks:
899967
rsync -aq --exclude='examples/add_subdirectory' $(readlink -f ../..) .
900968
[ -d build ] || mkdir build
901969
cd build
902-
$CMAKE -DCMAKE_VERBOSE_MAKEFILE=ON ..
970+
$CMAKE ..
903971
$CMAKE --build . -- -j 8
904972
./hello_mongocxx
905973

examples/projects/bsoncxx/cmake-deprecated/shared/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ rm -rf build/*
1010
cd build
1111
if [ -z "$MSVC" ]; then
1212
"$CMAKE" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
13-
make run VERBOSE=1
13+
"$CMAKE" --build . --target run
1414
else
1515
if [ "$CXX_STANDARD" = "17" ]; then
1616
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
1717
else
1818
# Boost is needed for pre-17 Windows polyfill.
1919
"$CMAKE" -G "Visual Studio 14 2015 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" -DBOOST_ROOT=c:/local/boost_1_60_0 ..
2020
fi
21-
"$CMAKE" --build . --target run --config "${BUILD_TYPE}"
21+
"$CMAKE" --build . --target run --config "${BUILD_TYPE}" -- /verbosity:minimal
2222
fi

examples/projects/bsoncxx/cmake-deprecated/static/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ rm -rf build/*
1010
cd build
1111
if [ -z "$MSVC" ]; then
1212
"$CMAKE" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
13-
make run VERBOSE=1
13+
"$CMAKE" --build . --target run
1414
else
1515
if [ "$CXX_STANDARD" = "17" ]; then
1616
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
1717
else
1818
# Boost is needed for pre-17 Windows polyfill.
1919
"$CMAKE" -G "Visual Studio 14 2015 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" -DBOOST_ROOT=c:/local/boost_1_60_0 ..
2020
fi
21-
"$CMAKE" --build . --target run --config "${BUILD_TYPE}"
21+
"$CMAKE" --build . --target run --config "${BUILD_TYPE}" -- /verbosity:minimal
2222
fi

examples/projects/bsoncxx/cmake/shared/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ rm -rf build/*
1010
cd build
1111
if [ -z "$MSVC" ]; then
1212
"$CMAKE" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
13-
make run VERBOSE=1
13+
"$CMAKE" --build . --target run
1414
else
1515
if [ "$CXX_STANDARD" = "17" ]; then
1616
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
1717
else
1818
# Boost is needed for pre-17 Windows polyfill.
1919
"$CMAKE" -G "Visual Studio 14 2015 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" -DBOOST_ROOT=c:/local/boost_1_60_0 ..
2020
fi
21-
"$CMAKE" --build . --target run --config "${BUILD_TYPE}"
21+
"$CMAKE" --build . --target run --config "${BUILD_TYPE}" -- /verbosity:minimal
2222
fi

examples/projects/bsoncxx/cmake/static/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ rm -rf build/*
1010
cd build
1111
if [ -z "$MSVC" ]; then
1212
"$CMAKE" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
13-
make run VERBOSE=1
13+
"$CMAKE" --build . --target run
1414
else
1515
if [ "$CXX_STANDARD" = "17" ]; then
1616
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
1717
else
1818
# Boost is needed for pre-17 Windows polyfill.
1919
"$CMAKE" -G "Visual Studio 14 2015 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" -DBOOST_ROOT=c:/local/boost_1_60_0 ..
2020
fi
21-
"$CMAKE" --build . --target run --config "${BUILD_TYPE}"
21+
"$CMAKE" --build . --target run --config "${BUILD_TYPE}" -- /verbosity:minimal
2222
fi

examples/projects/mongocxx/cmake-deprecated/shared/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ rm -rf build/*
1010
cd build
1111
if [ -z "$MSVC" ]; then
1212
"$CMAKE" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
13-
make run VERBOSE=1
13+
"$CMAKE" --build . --target run
1414
else
1515
if [ "$CXX_STANDARD" = "17" ]; then
1616
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
1717
else
1818
# Boost is needed for pre-17 Windows polyfill.
1919
"$CMAKE" -G "Visual Studio 14 2015 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" -DBOOST_ROOT=c:/local/boost_1_60_0 ..
2020
fi
21-
"$CMAKE" --build . --target run --config "${BUILD_TYPE}"
21+
"$CMAKE" --build . --target run --config "${BUILD_TYPE}" -- /verbosity:minimal
2222
fi

examples/projects/mongocxx/cmake-deprecated/static/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ rm -rf build/*
1010
cd build
1111
if [ -z "$MSVC" ]; then
1212
"$CMAKE" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
13-
make run VERBOSE=1
13+
"$CMAKE" --build . --target run
1414
else
1515
if [ "$CXX_STANDARD" = "17" ]; then
1616
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
1717
else
1818
# Boost is needed for pre-17 Windows polyfill.
1919
"$CMAKE" -G "Visual Studio 14 2015 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" -DBOOST_ROOT=c:/local/boost_1_60_0 ..
2020
fi
21-
"$CMAKE" --build . --target run --config "${BUILD_TYPE}"
21+
"$CMAKE" --build . --target run --config "${BUILD_TYPE}" -- /verbosity:minimal
2222
fi

examples/projects/mongocxx/cmake/shared/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ rm -rf build/*
1010
cd build
1111
if [ -z "$MSVC" ]; then
1212
"$CMAKE" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
13-
make run VERBOSE=1
13+
"$CMAKE" --build . --target run
1414
else
1515
if [ "$CXX_STANDARD" = "17" ]; then
1616
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
1717
else
1818
# Boost is needed for pre-17 Windows polyfill.
1919
"$CMAKE" -G "Visual Studio 14 2015 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" -DBOOST_ROOT=c:/local/boost_1_60_0 ..
2020
fi
21-
"$CMAKE" --build . --target run --config "${BUILD_TYPE}"
21+
"$CMAKE" --build . --target run --config "${BUILD_TYPE}" -- /verbosity:minimal
2222
fi

examples/projects/mongocxx/cmake/static/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ rm -rf build/*
1010
cd build
1111
if [ -z "$MSVC" ]; then
1212
"$CMAKE" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
13-
make run VERBOSE=1
13+
"$CMAKE" --build . --target run
1414
else
1515
if [ "$CXX_STANDARD" = "17" ]; then
1616
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" ..
1717
else
1818
# Boost is needed for pre-17 Windows polyfill.
1919
"$CMAKE" -G "Visual Studio 14 2015 Win64" -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" -DBOOST_ROOT=c:/local/boost_1_60_0 ..
2020
fi
21-
"$CMAKE" --build . --target run --config "${BUILD_TYPE}"
21+
"$CMAKE" --build . --target run --config "${BUILD_TYPE}" -- /verbosity:minimal
2222
fi

0 commit comments

Comments
 (0)