Skip to content

Commit 2f9fe86

Browse files
RUST-1539 Restructure and refine contents of Evergreen configuration (#939)
1 parent d89e6f4 commit 2f9fe86

32 files changed

+2070
-2164
lines changed

.evergreen/cargo-test.sh

+16-22
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,26 @@ TEST_OPTIONS=()
55
FEATURE_FLAGS=()
66
CARGO_RESULT=0
77

8-
use_async_runtime() {
9-
if [ "${ASYNC_RUNTIME}" = "async-std" ]; then
10-
FEATURE_FLAGS+=("async-std-runtime")
11-
CARGO_OPTIONS+=("--no-default-features")
12-
elif [ "${ASYNC_RUNTIME}" != "tokio" ]; then
13-
echo "invalid async runtime: ${ASYNC_RUNTIME}" >&2
14-
exit 1
15-
fi
8+
join_by() {
9+
local IFS="$1"
10+
shift
11+
echo "$*"
1612
}
1713

18-
join_by() { local IFS="$1"; shift; echo "$*"; }
19-
2014
cargo_test_options() {
21-
local FILTERED=()
22-
for FEAT in "${FEATURE_FLAGS[@]}"; do
23-
[[ "${FEAT}" != "" ]] && FILTERED+=("${FEAT}")
24-
done
25-
local FEATURE_OPTION=""
26-
if (( ${#FILTERED[@]} != 0 )); then
27-
FEATURE_OPTION="--features $(join_by , "${FILTERED[@]}")"
28-
fi
29-
echo $1 ${CARGO_OPTIONS[@]} ${FEATURE_OPTION} -- ${TEST_OPTIONS[@]}
15+
local FILTERED=()
16+
for FEAT in "${FEATURE_FLAGS[@]}"; do
17+
[[ "${FEAT}" != "" ]] && FILTERED+=("${FEAT}")
18+
done
19+
local FEATURE_OPTION=""
20+
if ((${#FILTERED[@]} != 0)); then
21+
FEATURE_OPTION="--features $(join_by , "${FILTERED[@]}")"
22+
fi
23+
echo $1 ${CARGO_OPTIONS[@]} ${FEATURE_OPTION} -- ${TEST_OPTIONS[@]}
3024
}
3125

3226
cargo_test() {
33-
RUST_BACKTRACE=1 cargo nextest run --profile ci $(cargo_test_options $1)
34-
(( CARGO_RESULT = ${CARGO_RESULT} || $? ))
35-
mv target/nextest/ci/junit.xml $2
27+
RUST_BACKTRACE=1 cargo nextest run --profile ci $(cargo_test_options $1)
28+
((CARGO_RESULT = ${CARGO_RESULT} || $?))
29+
mv target/nextest/ci/junit.xml $2
3630
}

.evergreen/check-cargo-deny.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ set -o xtrace
66
source ./.evergreen/env.sh
77

88
cargo install --locked cargo-deny
9-
cargo deny --all-features check
9+
cargo deny --all-features check

.evergreen/check-clippy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ CLIPPY_VERSION=1.71.0
1111
rustup install $CLIPPY_VERSION
1212

1313
for ((i = 0; i < ${#FEATURE_COMBINATIONS[@]}; i++)); do
14-
cargo +$CLIPPY_VERSION clippy --all-targets ${FEATURE_COMBINATIONS[$i]} -p mongodb -- -D warnings
14+
cargo +$CLIPPY_VERSION clippy --all-targets ${FEATURE_COMBINATIONS[$i]} -p mongodb -- -D warnings
1515
done

.evergreen/check-rustdoc.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source ./.evergreen/env.sh
77
# docs.rs builds the driver on a read-only file system. to create a more realistic environment, we first
88
# build the driver to ensure we have all the deps already in src, and then limit the permissions on that directory
99
# and rebuild the docs.
10-
# this is to help us avoid introducing problems like those described here
10+
# this is to help us avoid introducing problems like those described here
1111
# https://docs.rs/about/builds#read-only-directories where we or a dependency modify source code during the
1212
# build process.
1313

.evergreen/compile-only.sh

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ set -o errexit
44
set -o xtrace
55

66
source ./.evergreen/env.sh
7-
rustup update $RUST_VERSION
87

9-
# pin dependencies who have bumped their MSRVs to > ours in recent releases.
10-
if [ "$MSRV" = "true" ]; then
11-
cp .evergreen/MSRV-Cargo.lock Cargo.lock
8+
# Install the MSRV and pin dependencies who have bumped their MSRVs to > ours in recent releases.
9+
if [ "$RUST_VERSION" != "" ]; then
10+
rustup toolchain install $RUST_VERSION
11+
TOOLCHAIN="+${RUST_VERSION}"
12+
cp .evergreen/MSRV-Cargo.lock Cargo.lock
1213
fi
1314

1415
source ./.evergreen/feature-combinations.sh
1516

16-
# build with all available features to ensure all optional dependencies are brought in too.
17+
# Test compilation with all feature combinations.
1718
for ((i = 0; i < ${#FEATURE_COMBINATIONS[@]}; i++)); do
18-
rustup run $RUST_VERSION cargo build ${FEATURE_COMBINATIONS[$i]}
19+
cargo $TOOLCHAIN build ${FEATURE_COMBINATIONS[$i]}
1920
done

0 commit comments

Comments
 (0)