Skip to content

Commit 8cb5caf

Browse files
authored
chore(ci): continuous matrix integration [3.3]
1 parent 684cfd6 commit 8cb5caf

25 files changed

+673
-87
lines changed

.evergreen/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,17 @@ functions:
132132
NODE_LTS_NAME='${NODE_LTS_NAME}' ATLAS_REPL='${atlas_repl}' ATLAS_SHRD='${atlas_shrd}'
133133
ATLAS_FREE='${atlas_free}' ATLAS_TLS11='${atlas_tls11}' ATLAS_TLS12='${atlas_tls12}' bash
134134
${PROJECT_DIRECTORY}/.evergreen/run-atlas-tests.sh
135+
upload test results:
136+
- command: attach.xunit_results
137+
params:
138+
file: src/xunit.xml
135139
pre:
136140
- func: fetch source
137141
- func: prepare resources
138142
- func: fix absolute paths
139143
- func: make files executable
140144
post:
145+
- func: upload test results
141146
- func: cleanup
142147
tasks:
143148
- name: test-latest-server

.evergreen/config.yml.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ functions:
165165
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
166166
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
167167

168+
"upload test results":
169+
- command: attach.xunit_results
170+
params:
171+
file: src/xunit.xml
168172
pre:
169173
- func: "fetch source"
170174
- func: "prepare resources"
@@ -173,4 +177,5 @@ pre:
173177
- func: "make files executable"
174178

175179
post:
180+
- func: "upload test results"
176181
- func: "cleanup"

.evergreen/install-dependencies.sh

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,103 @@
22
# set -o xtrace # Write all commands first to stderr
33
set -o errexit # Exit the script with error if any of the commands fail
44

5+
NVM_WINDOWS_URL="https://github.com/coreybutler/nvm-windows/releases/download/1.1.7/nvm-noinstall.zip"
6+
NVM_URL="https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh"
7+
58
NODE_LTS_NAME=${NODE_LTS_NAME:-carbon}
9+
MSVS_VERSION=${MSVS_VERSION:-2017}
610
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
711
NPM_CACHE_DIR="${NODE_ARTIFACTS_PATH}/npm"
812
NPM_TMP_DIR="${NODE_ARTIFACTS_PATH}/tmp"
913

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

1318
# create node artifacts path if needed
1419
mkdir -p ${NODE_ARTIFACTS_PATH}
1520
mkdir -p ${NPM_CACHE_DIR}
1621
mkdir -p "${NPM_TMP_DIR}"
1722

18-
# install Node.js
19-
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
20-
[ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"
21-
nvm install --lts=${NODE_LTS_NAME}
23+
case $NODE_LTS_NAME in
24+
"argon")
25+
VERSION=4
26+
;;
27+
"boron")
28+
VERSION=6
29+
;;
30+
"carbon")
31+
VERSION=8
32+
;;
33+
"dubnium")
34+
VERSION=10
35+
;;
36+
"erbium")
37+
VERSION=12
38+
;;
39+
"fermium")
40+
VERSION=14
41+
;;
42+
*)
43+
echo "Unsupported Node LTS version $1"
44+
exit 1
45+
;;
46+
esac
47+
NODE_VERSION=$(curl --retry 8 --retry-delay 5 --max-time 50 -s -o- \
48+
https://nodejs.org/download/release/latest-v${VERSION}.x/SHASUMS256.txt \
49+
| head -n 1 | awk '{print $2};' | cut -d- -f2)
50+
export NODE_VERSION=${NODE_VERSION:1}
51+
52+
# output node version to expansions file for use in subsequent scripts
53+
cat <<EOT > deps-expansion.yml
54+
NODE_VERSION: "$NODE_VERSION"
55+
EOT
56+
57+
# install Node.js on Windows
58+
if [[ "$OS" == "Windows_NT" ]]; then
59+
# Delete pre-existing node to avoid version conflicts
60+
rm -rf "/cygdrive/c/Program Files/nodejs"
61+
62+
export NVM_HOME=`cygpath -w "$NVM_DIR"`
63+
export NVM_SYMLINK=`cygpath -w "$NODE_ARTIFACTS_PATH/bin"`
64+
export NVM_ARTIFACTS_PATH=`cygpath -w "$NODE_ARTIFACTS_PATH/bin"`
65+
export PATH=`cygpath $NVM_SYMLINK`:`cygpath $NVM_HOME`:$PATH
66+
67+
curl -L $NVM_WINDOWS_URL -o nvm.zip
68+
unzip -d $NVM_DIR nvm.zip
69+
rm nvm.zip
70+
71+
chmod 777 $NVM_DIR
72+
chmod -R a+rx $NVM_DIR
73+
74+
cat <<EOT > $NVM_DIR/settings.txt
75+
root: $NVM_HOME
76+
path: $NVM_SYMLINK
77+
EOT
78+
nvm install $NODE_VERSION
79+
nvm use $NODE_VERSION
80+
which node || echo "node not found, PATH=$PATH"
81+
which npm || echo "npm not found, PATH=$PATH"
82+
npm config set msvs_version ${MSVS_VERSION}
83+
npm config set scripts-prepend-node-path true
84+
85+
# install Node.js on Linux/MacOS
86+
else
87+
curl -o- $NVM_URL | bash
88+
[ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"
89+
nvm install --no-progress $NODE_VERSION
2290

23-
# setup npm cache in a local directory
24-
cat <<EOT > .npmrc
91+
# setup npm cache in a local directory
92+
cat <<EOT > .npmrc
2593
devdir=${NPM_CACHE_DIR}/.node-gyp
2694
init-module=${NPM_CACHE_DIR}/.npm-init.js
2795
cache=${NPM_CACHE_DIR}
2896
tmp=${NPM_TMP_DIR}
2997
registry=https://registry.npmjs.org
3098
EOT
99+
fi
31100

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

35-
# install node dependencies
36-
npm install
104+
npm install --unsafe-perm

.evergreen/run-tests.sh

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,51 @@ set -o errexit # Exit the script with error if any of the commands fail
88
# UNIFIED Set to enable the Unified SDAM topology for the node driver
99
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
1010
# MARCH Machine Architecture. Defaults to lowercase uname -m
11+
# TEST_NPM_SCRIPT Script to npm run. Defaults to "test-nolint"
12+
# SKIP_DEPS Skip installing dependencies
13+
# NO_EXIT Exit early from tests that leak resources
1114

1215
AUTH=${AUTH:-noauth}
13-
SSL=${SSL:-nossl}
1416
UNIFIED=${UNIFIED:-}
1517
MONGODB_URI=${MONGODB_URI:-}
18+
TEST_NPM_SCRIPT=${TEST_NPM_SCRIPT:-test-nolint}
19+
if [[ -z "${NO_EXIT}" ]]; then
20+
TEST_NPM_SCRIPT="$TEST_NPM_SCRIPT -- --exit"
21+
fi
22+
23+
# ssl setup
24+
SSL=${SSL:-nossl}
25+
if [ "$SSL" != "nossl" ]; then
26+
export SSL_KEY_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
27+
export SSL_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
28+
fi
1629

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

2033
export PATH="/opt/mongodbtoolchain/v2/bin:$PATH"
21-
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
22-
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
23-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
24-
MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} npm test
34+
35+
if [[ -z "${SKIP_DEPS}" ]]; then
36+
source "${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh"
37+
else
38+
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
39+
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
40+
if [[ "$OS" == "Windows_NT" ]]; then
41+
export NVM_HOME=`cygpath -m -a "$NVM_DIR"`
42+
export NVM_SYMLINK=`cygpath -m -a "$NODE_ARTIFACTS_PATH/bin"`
43+
export NVM_ARTIFACTS_PATH=`cygpath -m -a "$NODE_ARTIFACTS_PATH/bin"`
44+
export PATH=`cygpath $NVM_SYMLINK`:`cygpath $NVM_HOME`:$PATH
45+
else
46+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
47+
fi
48+
fi
49+
50+
# only run FLE tets on hosts we explicitly choose to test on
51+
if [[ -z "${CLIENT_ENCRYPTION}" ]]; then
52+
unset AWS_ACCESS_KEY_ID;
53+
unset AWS_SECRET_ACCESS_KEY;
54+
else
55+
npm install mongodb-client-encryption
56+
fi
57+
58+
MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} npm run ${TEST_NPM_SCRIPT}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ manual_tests/
2929
docs/build
3030
docs/Makefile
3131

32+
# xunit test output for CI
33+
xunit.xml
34+
3235
# Directory for dbs
3336
db
3437

COMPATIBILITY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Server Version: 5.0
2+
- BSON field 'listCollections.collation' is an unknown field.
3+
4+
Server Version: 4.4
5+
- $where no longer supports deprecated BSON type CodeWScope

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The official [MongoDB](https://www.mongodb.com/) driver for Node.js. Provides a
1515
| what | where |
1616
|---------------|------------------------------------------------|
1717
| documentation | http://mongodb.github.io/node-mongodb-native |
18-
| api-doc | http://mongodb.github.io/node-mongodb-native/3.1/api |
18+
| api-doc | http://mongodb.github.io/node-mongodb-native/3.3/api |
1919
| source | https://github.com/mongodb/node-mongodb-native |
2020
| mongodb | http://www.mongodb.org |
2121

0 commit comments

Comments
 (0)