Skip to content

Commit

Permalink
RUST-1539 Restructure and refine contents of Evergreen configuration (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelatkinson authored Aug 30, 2023
1 parent d89e6f4 commit 2f9fe86
Show file tree
Hide file tree
Showing 32 changed files with 2,070 additions and 2,164 deletions.
38 changes: 16 additions & 22 deletions .evergreen/cargo-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,26 @@ TEST_OPTIONS=()
FEATURE_FLAGS=()
CARGO_RESULT=0

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

join_by() { local IFS="$1"; shift; echo "$*"; }

cargo_test_options() {
local FILTERED=()
for FEAT in "${FEATURE_FLAGS[@]}"; do
[[ "${FEAT}" != "" ]] && FILTERED+=("${FEAT}")
done
local FEATURE_OPTION=""
if (( ${#FILTERED[@]} != 0 )); then
FEATURE_OPTION="--features $(join_by , "${FILTERED[@]}")"
fi
echo $1 ${CARGO_OPTIONS[@]} ${FEATURE_OPTION} -- ${TEST_OPTIONS[@]}
local FILTERED=()
for FEAT in "${FEATURE_FLAGS[@]}"; do
[[ "${FEAT}" != "" ]] && FILTERED+=("${FEAT}")
done
local FEATURE_OPTION=""
if ((${#FILTERED[@]} != 0)); then
FEATURE_OPTION="--features $(join_by , "${FILTERED[@]}")"
fi
echo $1 ${CARGO_OPTIONS[@]} ${FEATURE_OPTION} -- ${TEST_OPTIONS[@]}
}

cargo_test() {
RUST_BACKTRACE=1 cargo nextest run --profile ci $(cargo_test_options $1)
(( CARGO_RESULT = ${CARGO_RESULT} || $? ))
mv target/nextest/ci/junit.xml $2
RUST_BACKTRACE=1 cargo nextest run --profile ci $(cargo_test_options $1)
((CARGO_RESULT = ${CARGO_RESULT} || $?))
mv target/nextest/ci/junit.xml $2
}
2 changes: 1 addition & 1 deletion .evergreen/check-cargo-deny.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ set -o xtrace
source ./.evergreen/env.sh

cargo install --locked cargo-deny
cargo deny --all-features check
cargo deny --all-features check
2 changes: 1 addition & 1 deletion .evergreen/check-clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ CLIPPY_VERSION=1.71.0
rustup install $CLIPPY_VERSION

for ((i = 0; i < ${#FEATURE_COMBINATIONS[@]}; i++)); do
cargo +$CLIPPY_VERSION clippy --all-targets ${FEATURE_COMBINATIONS[$i]} -p mongodb -- -D warnings
cargo +$CLIPPY_VERSION clippy --all-targets ${FEATURE_COMBINATIONS[$i]} -p mongodb -- -D warnings
done
2 changes: 1 addition & 1 deletion .evergreen/check-rustdoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source ./.evergreen/env.sh
# docs.rs builds the driver on a read-only file system. to create a more realistic environment, we first
# build the driver to ensure we have all the deps already in src, and then limit the permissions on that directory
# and rebuild the docs.
# this is to help us avoid introducing problems like those described here
# this is to help us avoid introducing problems like those described here
# https://docs.rs/about/builds#read-only-directories where we or a dependency modify source code during the
# build process.

Expand Down
13 changes: 7 additions & 6 deletions .evergreen/compile-only.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ set -o errexit
set -o xtrace

source ./.evergreen/env.sh
rustup update $RUST_VERSION

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

source ./.evergreen/feature-combinations.sh

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

0 comments on commit 2f9fe86

Please sign in to comment.