Skip to content

Commit 52f3f64

Browse files
authored
RUST-481 Add Windows to CI (#209)
1 parent 66e06d5 commit 52f3f64

File tree

5 files changed

+40
-5
lines changed

5 files changed

+40
-5
lines changed

.evergreen/config.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ functions:
200200
mv $i.new $i
201201
done
202202
203+
# Copy client certificate because symlinks do not work on Windows.
204+
cp ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem
205+
203206
"make files executable":
204207
- command: shell.exec
205208
params:
@@ -430,6 +433,9 @@ axes:
430433
run_on: macos-1014
431434
variables:
432435
SINGLE_THREAD: true
436+
- id: windows-64-vs2017-small
437+
display_name: "Windows (VS 2017)"
438+
run_on: windows-64-vs2017-small
433439

434440
buildvariants:
435441
-
@@ -446,7 +452,9 @@ buildvariants:
446452
- ".3.6"
447453
- matrix_name: "atlas-connect"
448454
matrix_spec:
449-
os: "*"
455+
os:
456+
- ubuntu-16.04
457+
- macos-10.14
450458
async-runtime: "*"
451459
display_name: "Atlas Connectivity ${os} with ${async-runtime}"
452460
tasks:

.evergreen/install-dependencies.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
#!/bin/sh
22

3+
# Make sure to use msvc toolchain rather than gnu, which is the default for cygwin
4+
if [ "Windows_NT" == "$OS" ]; then
5+
export DEFAULT_HOST_OPTIONS='--default-host x86_64-pc-windows-msvc'
6+
fi
7+
38
rm -rf ~/.rustup
4-
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
9+
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path $DEFAULT_HOST_OPTIONS
10+
11+
# rustup installs into C:\Users\$USER instead of C:\home\$USER, so we symlink both .rustup and .cargo
12+
if [ "Windows_NT" == "$OS" ]; then
13+
ln -s /cygdrive/c/Users/$USER/.rustup/ ~/.rustup
14+
ln -s /cygdrive/c/Users/$USER/.cargo/ ~/.cargo
15+
fi
16+
17+
# This file is not created by default on Windows
18+
echo 'export PATH=$PATH:~/.cargo/bin' >> ~/.cargo/env
519

620
echo "export CARGO_NET_GIT_FETCH_WITH_CLI=true" >> ~/.cargo/env
721
. ~/.cargo/env

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This repository contains the officially supported MongoDB Rust driver, a client
1515
- [Inserting documents into a collection](#inserting-documents-into-a-collection)
1616
- [Finding documents in a collection](#finding-documents-in-a-collection)
1717
- [Using the sync API](#using-the-sync-api)
18+
- [Platforms](#platforms)
1819
- [Atlas note](#atlas-note)
1920
- [Windows DNS note](#windows-dns-note)
2021
- [Bug Reporting / Feature Requests](#bug-reporting--feature-requests)
@@ -180,6 +181,10 @@ for result in cursor {
180181
}
181182
```
182183

184+
## Platforms
185+
186+
The driver tests against Linux, MacOS, and Windows in CI.
187+
183188
## Atlas note
184189

185190
Currently, the driver has issues connecting to Atlas tiers above M2 unless the server version is at least 4.2. We're working on fixing this, but in the meantime, a workaround is to upgrade your cluster to 4.2. The driver has no known issues with either M0 or M2 instances.

src/client/options/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use rustls::{
2424
};
2525
use serde::Deserialize;
2626
use strsim::jaro_winkler;
27-
use trust_dns_resolver::config::ResolverConfig;
27+
pub use trust_dns_resolver::config::ResolverConfig;
2828
use typed_builder::TypedBuilder;
2929
use webpki_roots::TLS_SERVER_ROOTS;
3030

src/test/spec/initial_dns_seedlist_discovery.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use serde::Deserialize;
22

3-
use crate::{options::ClientOptions, test::run_spec_test};
3+
use crate::{
4+
options::{ClientOptions, ResolverConfig},
5+
test::run_spec_test,
6+
};
47

58
#[derive(Debug, Deserialize)]
69
struct TestFile {
@@ -37,7 +40,12 @@ async fn run() {
3740
return;
3841
}
3942

40-
let result = ClientOptions::parse(&test_file.uri).await;
43+
let result = if cfg!(target_os = "windows") {
44+
ClientOptions::parse_with_resolver_config(&test_file.uri, ResolverConfig::cloudflare())
45+
.await
46+
} else {
47+
ClientOptions::parse(&test_file.uri).await
48+
};
4149

4250
if let Some(true) = test_file.error {
4351
assert!(matches!(result, Err(_)), test_file.comment.unwrap());

0 commit comments

Comments
 (0)