Skip to content

chore(ci): continuous matrix integration [3.3] #2683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 14, 2021
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
5 changes: 5 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,17 @@ functions:
NODE_LTS_NAME='${NODE_LTS_NAME}' ATLAS_REPL='${atlas_repl}' ATLAS_SHRD='${atlas_shrd}'
ATLAS_FREE='${atlas_free}' ATLAS_TLS11='${atlas_tls11}' ATLAS_TLS12='${atlas_tls12}' bash
${PROJECT_DIRECTORY}/.evergreen/run-atlas-tests.sh
upload test results:
- command: attach.xunit_results
params:
file: src/xunit.xml
pre:
- func: fetch source
- func: prepare resources
- func: fix absolute paths
- func: make files executable
post:
- func: upload test results
- func: cleanup
tasks:
- name: test-latest-server
Expand Down
5 changes: 5 additions & 0 deletions .evergreen/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ functions:
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
NODE_LTS_NAME='${NODE_LTS_NAME}' ATLAS_REPL='${atlas_repl}' ATLAS_SHRD='${atlas_shrd}' ATLAS_FREE='${atlas_free}' ATLAS_TLS11='${atlas_tls11}' ATLAS_TLS12='${atlas_tls12}' bash ${PROJECT_DIRECTORY}/.evergreen/run-atlas-tests.sh

"upload test results":
- command: attach.xunit_results
params:
file: src/xunit.xml
pre:
- func: "fetch source"
- func: "prepare resources"
Expand All @@ -173,4 +177,5 @@ pre:
- func: "make files executable"

post:
- func: "upload test results"
- func: "cleanup"
84 changes: 76 additions & 8 deletions .evergreen/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,103 @@
# set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail

NVM_WINDOWS_URL="https://github.com/coreybutler/nvm-windows/releases/download/1.1.7/nvm-noinstall.zip"
NVM_URL="https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh"

NODE_LTS_NAME=${NODE_LTS_NAME:-carbon}
MSVS_VERSION=${MSVS_VERSION:-2017}
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
NPM_CACHE_DIR="${NODE_ARTIFACTS_PATH}/npm"
NPM_TMP_DIR="${NODE_ARTIFACTS_PATH}/tmp"

# this needs to be explicitly exported for the nvm install below
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
export XDG_CONFIG_HOME=${NODE_ARTIFACTS_PATH}

# create node artifacts path if needed
mkdir -p ${NODE_ARTIFACTS_PATH}
mkdir -p ${NPM_CACHE_DIR}
mkdir -p "${NPM_TMP_DIR}"

# install Node.js
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
[ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"
nvm install --lts=${NODE_LTS_NAME}
case $NODE_LTS_NAME in
"argon")
VERSION=4
;;
"boron")
VERSION=6
;;
"carbon")
VERSION=8
;;
"dubnium")
VERSION=10
;;
"erbium")
VERSION=12
;;
"fermium")
VERSION=14
;;
*)
echo "Unsupported Node LTS version $1"
exit 1
;;
esac
NODE_VERSION=$(curl --retry 8 --retry-delay 5 --max-time 50 -s -o- \
https://nodejs.org/download/release/latest-v${VERSION}.x/SHASUMS256.txt \
| head -n 1 | awk '{print $2};' | cut -d- -f2)
export NODE_VERSION=${NODE_VERSION:1}

# output node version to expansions file for use in subsequent scripts
cat <<EOT > deps-expansion.yml
NODE_VERSION: "$NODE_VERSION"
EOT

# install Node.js on Windows
if [[ "$OS" == "Windows_NT" ]]; then
# Delete pre-existing node to avoid version conflicts
rm -rf "/cygdrive/c/Program Files/nodejs"

export NVM_HOME=`cygpath -w "$NVM_DIR"`
export NVM_SYMLINK=`cygpath -w "$NODE_ARTIFACTS_PATH/bin"`
export NVM_ARTIFACTS_PATH=`cygpath -w "$NODE_ARTIFACTS_PATH/bin"`
export PATH=`cygpath $NVM_SYMLINK`:`cygpath $NVM_HOME`:$PATH

curl -L $NVM_WINDOWS_URL -o nvm.zip
unzip -d $NVM_DIR nvm.zip
rm nvm.zip

chmod 777 $NVM_DIR
chmod -R a+rx $NVM_DIR

cat <<EOT > $NVM_DIR/settings.txt
root: $NVM_HOME
path: $NVM_SYMLINK
EOT
nvm install $NODE_VERSION
nvm use $NODE_VERSION
which node || echo "node not found, PATH=$PATH"
which npm || echo "npm not found, PATH=$PATH"
npm config set msvs_version ${MSVS_VERSION}
npm config set scripts-prepend-node-path true

# install Node.js on Linux/MacOS
else
curl -o- $NVM_URL | bash
[ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"
nvm install --no-progress $NODE_VERSION

# setup npm cache in a local directory
cat <<EOT > .npmrc
# setup npm cache in a local directory
cat <<EOT > .npmrc
devdir=${NPM_CACHE_DIR}/.node-gyp
init-module=${NPM_CACHE_DIR}/.npm-init.js
cache=${NPM_CACHE_DIR}
tmp=${NPM_TMP_DIR}
registry=https://registry.npmjs.org
EOT
fi

# NOTE: registry was overridden to not use artifactory, remove the `registry` line when
# BUILD-6774 is resolved.

# install node dependencies
npm install
npm install --unsafe-perm
44 changes: 39 additions & 5 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,51 @@ set -o errexit # Exit the script with error if any of the commands fail
# UNIFIED Set to enable the Unified SDAM topology for the node driver
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
# MARCH Machine Architecture. Defaults to lowercase uname -m
# TEST_NPM_SCRIPT Script to npm run. Defaults to "test-nolint"
# SKIP_DEPS Skip installing dependencies
# NO_EXIT Exit early from tests that leak resources

AUTH=${AUTH:-noauth}
SSL=${SSL:-nossl}
UNIFIED=${UNIFIED:-}
MONGODB_URI=${MONGODB_URI:-}
TEST_NPM_SCRIPT=${TEST_NPM_SCRIPT:-test-nolint}
if [[ -z "${NO_EXIT}" ]]; then
TEST_NPM_SCRIPT="$TEST_NPM_SCRIPT -- --exit"
fi

# ssl setup
SSL=${SSL:-nossl}
if [ "$SSL" != "nossl" ]; then
export SSL_KEY_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
export SSL_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
fi

# run tests
echo "Running $AUTH tests over $SSL, connecting to $MONGODB_URI"

export PATH="/opt/mongodbtoolchain/v2/bin:$PATH"
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} npm test

if [[ -z "${SKIP_DEPS}" ]]; then
source "${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh"
else
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
if [[ "$OS" == "Windows_NT" ]]; then
export NVM_HOME=`cygpath -m -a "$NVM_DIR"`
export NVM_SYMLINK=`cygpath -m -a "$NODE_ARTIFACTS_PATH/bin"`
export NVM_ARTIFACTS_PATH=`cygpath -m -a "$NODE_ARTIFACTS_PATH/bin"`
export PATH=`cygpath $NVM_SYMLINK`:`cygpath $NVM_HOME`:$PATH
else
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
fi
fi

# only run FLE tets on hosts we explicitly choose to test on
if [[ -z "${CLIENT_ENCRYPTION}" ]]; then
unset AWS_ACCESS_KEY_ID;
unset AWS_SECRET_ACCESS_KEY;
else
npm install mongodb-client-encryption
fi

MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} npm run ${TEST_NPM_SCRIPT}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ manual_tests/
docs/build
docs/Makefile

# xunit test output for CI
xunit.xml

# Directory for dbs
db

Expand Down
5 changes: 5 additions & 0 deletions COMPATIBILITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Server Version: 5.0
- BSON field 'listCollections.collation' is an unknown field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this is a new documentation file required by the Continuous Matrix Testing design. It lists any server compatibility issues this version of the driver has, by server version. The corresponding failing tests should be skipped after they've been documented here, so that the continuous testing matrix can be green.

Server Version: 4.4
- $where no longer supports deprecated BSON type CodeWScope
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The official [MongoDB](https://www.mongodb.com/) driver for Node.js. Provides a
| what | where |
|---------------|------------------------------------------------|
| documentation | http://mongodb.github.io/node-mongodb-native |
| api-doc | http://mongodb.github.io/node-mongodb-native/3.1/api |
| api-doc | http://mongodb.github.io/node-mongodb-native/3.3/api |
| source | https://github.com/mongodb/node-mongodb-native |
| mongodb | http://www.mongodb.org |

Expand Down
Loading