Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .evergreen/check-all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the configure-rust script uses bash-only syntax; I took the opportunity to standardize all of our scripts to use bash (even if they don't call configure-rust.sh) to try to avoid any problems around this in the future


set -o errexit

Expand Down
16 changes: 8 additions & 8 deletions .evergreen/check-clippy.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh
# Pin clippy to the lastest version. This should be updated when new versions of Rust are released.
rustup default 1.59.0
cargo clippy --all-targets -p mongodb -- -D warnings
# check clippy with compressors separately
cargo clippy --all-targets -p mongodb --features zstd-compression,snappy-compression,zlib-compression -- -D warnings
cargo clippy --all-targets --no-default-features --features async-std-runtime -p mongodb -- -D warnings
cargo clippy --all-targets --no-default-features --features sync -p mongodb -- -D warnings
cargo clippy --all-targets --features tokio-sync -p mongodb -- -D warnings

source ./.evergreen/feature-combinations.sh

for ((i = 0; i < ${#FEATURE_COMBINATIONS[@]}; i++)); do
cargo clippy --all-targets ${FEATURE_COMBINATIONS[$i]} -p mongodb -- -D warnings
done
30 changes: 24 additions & 6 deletions .evergreen/check-rustdoc.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
cargo +nightly rustdoc -- -D warnings --cfg docsrs
cargo +nightly rustdoc --no-default-features --features async-std-runtime -- -D warnings --cfg docsrs
cargo +nightly rustdoc --no-default-features --features sync -- -D warnings --cfg docsrs
cargo +nightly rustdoc --features tokio-sync -- -D warnings --cfg docsrs
source ./.evergreen/configure-rust.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
# https://docs.rs/about/builds#read-only-directories where we or a dependency modify source code during the
# build process.

source ./.evergreen/feature-combinations.sh

# build with all available features to ensure all optional dependencies are brought in too.
for ((i = 0; i < ${#FEATURE_COMBINATIONS[@]}; i++)); do
cargo +nightly build ${FEATURE_COMBINATIONS[$i]}
done
cargo clean

chmod -R 555 ${CARGO_HOME}/registry/src

for ((i = 0; i < ${#FEATURE_COMBINATIONS[@]}; i++)); do
cargo +nightly rustdoc ${FEATURE_COMBINATIONS[$i]} -- -D warnings --cfg docsrs
done

2 changes: 1 addition & 1 deletion .evergreen/check-rustfmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh
rustfmt +nightly --unstable-features --check src/**/*.rs
rustfmt +nightly --unstable-features --check src/*.rs
4 changes: 2 additions & 2 deletions .evergreen/compile-only-async-std.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

rustup run $RUST_VERSION cargo build --no-default-features --features async-std-runtime
rustup run $RUST_VERSION cargo build --no-default-features --features sync
4 changes: 2 additions & 2 deletions .evergreen/compile-only-tokio.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

# Enable snappy, zlib unconditionally
FEATURE_FLAGS=snappy-compression,zlib-compression
Expand Down
4 changes: 2 additions & 2 deletions .evergreen/compile-only.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh
rustup update $RUST_VERSION

if [ "$ASYNC_RUNTIME" = "tokio" ]; then
Expand Down
5 changes: 3 additions & 2 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ functions:
- command: shell.exec
type: test
params:
shell: bash
working_dir: "src"
script: |
${PREPARE_SHELL}
Expand All @@ -265,7 +266,7 @@ functions:

# compile mini test project
cd $PROJECT_DIRECTORY/.evergreen/aws-ecs-test
. ~/.cargo/env
. ${PROJECT_DIRECTORY}/.evergreen/configure-rust.sh
cargo build
cd -

Expand Down Expand Up @@ -431,6 +432,7 @@ functions:
export MONGO_ATLAS_TLS11_URI_SRV='${MONGO_ATLAS_TLS11_URI_SRV}'
export MONGO_ATLAS_TLS12_URI='${MONGO_ATLAS_TLS12_URI}'
export MONGO_ATLAS_TLS12_URI_SRV='${MONGO_ATLAS_TLS12_URI_SRV}'
export PROJECT_DIRECTORY='${PROJECT_DIRECTORY}'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed because configure-rust.sh uses it. for all of the other tasks we run $PREPARE_SHELL which already does this for us.

ASYNC_RUNTIME=${ASYNC_RUNTIME} .evergreen/run-atlas-tests.sh

"run ocsp test":
Expand Down Expand Up @@ -617,7 +619,6 @@ functions:
params:
script: |
${PREPARE_SHELL}
rm -rf ~/.rustup
rm -rf $DRIVERS_TOOLS || true

"fix absolute paths":
Expand Down
14 changes: 14 additions & 0 deletions .evergreen/configure-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

export RUSTUP_HOME="${PROJECT_DIRECTORY}/.rustup"
export PATH="${RUSTUP_HOME}/bin:$PATH"
export CARGO_HOME="${PROJECT_DIRECTORY}/.cargo"
export PATH="${CARGO_HOME}/bin:$PATH"

if [[ "Windows_NT" == "$OS" ]]; then
# rustup/cargo need the native Windows paths; $PROJECT_DIRECTORY is a cygwin path
export RUSTUP_HOME=$(cygpath ${RUSTUP_HOME} --windows)
export CARGO_HOME=$(cygpath ${CARGO_HOME} --windows)
fi

. ${CARGO_HOME}/env
4 changes: 1 addition & 3 deletions .evergreen/env.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash

export PATH="/opt/mongodbtoolchain/v2/bin:$PATH"

source ~/.cargo/env
source ./.evergreen/configure-rust.sh

NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
Expand Down
10 changes: 10 additions & 0 deletions .evergreen/feature-combinations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Array of feature combinations that, in total, provides complete coverage of the driver.
# This is useful for linting tasks where we want to get coverage of all features.
# Since some of our features are mutually exclusive we cannot just use --all-features.
export FEATURE_COMBINATIONS=(
'' # default features
'--no-default-features --features async-std-runtime,sync' # features that conflict w/ default features
'--features tokio-sync,zstd-compression,snappy-compression,zlib-compression,openssl-tls,aws-auth' # additive features
)
23 changes: 12 additions & 11 deletions .evergreen/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
#!/bin/bash

set -o xtrace
set -o errexit

export RUSTUP_HOME="${PROJECT_DIRECTORY}/.rustup"
export CARGO_HOME="${PROJECT_DIRECTORY}/.cargo"

# Make sure to use msvc toolchain rather than gnu, which is the default for cygwin
if [ "Windows_NT" == "$OS" ]; then
export DEFAULT_HOST_OPTIONS='--default-host x86_64-pc-windows-msvc'
# rustup/cargo need the native Windows paths; $PROJECT_DIRECTORY is a cygwin path
export RUSTUP_HOME=$(cygpath ${RUSTUP_HOME} --windows)
export CARGO_HOME=$(cygpath ${CARGO_HOME} --windows)
fi

rm -rf ~/.rustup
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path $DEFAULT_HOST_OPTIONS

# rustup installs into C:\Users\$USER instead of C:\home\$USER, so we symlink both .rustup and .cargo
if [ "Windows_NT" == "$OS" ]; then
ln -s /cygdrive/c/Users/$USER/.rustup/ ~/.rustup
ln -s /cygdrive/c/Users/$USER/.cargo/ ~/.cargo
fi

# This file is not created by default on Windows
echo 'export PATH=$PATH:~/.cargo/bin' >> ~/.cargo/env

echo "export CARGO_NET_GIT_FETCH_WITH_CLI=true" >> ~/.cargo/env
echo 'export PATH="$PATH:${CARGO_HOME}/bin"' >> ${CARGO_HOME}/env
echo "export CARGO_NET_GIT_FETCH_WITH_CLI=true" >> ${CARGO_HOME}/env

source ~/.cargo/env
source ${CARGO_HOME}/env

# Install nightly rustfmt
rustup toolchain install nightly -c rustfmt
Expand Down
4 changes: 3 additions & 1 deletion .evergreen/release-danger-do-not-run-manually.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢ ☠ ☢
# # Danger!
#
Expand All @@ -24,6 +26,6 @@ fi
git fetch origin tag $TAG --no-tags
git checkout $TAG

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

cargo publish --token $TOKEN
4 changes: 2 additions & 2 deletions .evergreen/run-async-std-atlas-tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh
RUST_BACKTRACE=1 cargo test atlas_connectivity --no-default-features --features async-std-runtime

2 changes: 1 addition & 1 deletion .evergreen/run-atlas-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -o errexit

Expand Down
2 changes: 1 addition & 1 deletion .evergreen/run-aws-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ set -x

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

RUST_BACKTRACE=1 cargo test --features aws-auth auth_aws::auth_aws
4 changes: 2 additions & 2 deletions .evergreen/run-bson-benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

cd benchmarks
cargo run \
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/run-compile-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

FEATURES=""

Expand Down
2 changes: 1 addition & 1 deletion .evergreen/run-connection-string-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -o errexit
set -o xtrace

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

RUST_BACKTRACE=1 cargo test --features aws-auth spec::auth
RUST_BACKTRACE=1 cargo test --features aws-auth uri_options
Expand Down
4 changes: 2 additions & 2 deletions .evergreen/run-driver-benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

FEATURES=""

Expand Down
2 changes: 1 addition & 1 deletion .evergreen/run-ocsp-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ CA_FILE=`echo "${DRIVERS_TOOLS}/.evergreen/ocsp/${OCSP_ALGORITHM}/ca.pem" | sed

export MONGODB_URI="${MONGODB_URI}tls=true&tlsCAFile=${CA_FILE}"

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

RUST_BACKTRACE=1 cargo test spec::ocsp
2 changes: 1 addition & 1 deletion .evergreen/run-plain-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
set -o errexit
set -o xtrace

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

RUST_BACKTRACE=1 MONGO_PLAIN_AUTH_TEST=1 cargo test plain
4 changes: 2 additions & 2 deletions .evergreen/run-tokio-atlas-tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh
RUST_BACKTRACE=1 cargo test atlas_connectivity

4 changes: 2 additions & 2 deletions manual/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
source ./.evergreen/configure-rust.sh

cd $(dirname $0)/deps
cargo build
Expand Down