Skip to content

Commit 3c1f0db

Browse files
authored
CSHARP-4189: Upgraded build scripts and Cake to support Apple M1 including fixing failing tests. (#873)
1 parent 45c67f5 commit 3c1f0db

File tree

63 files changed

+307
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+307
-198
lines changed

build.cake

Lines changed: 135 additions & 108 deletions
Large diffs are not rendered by default.

build.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
2-
CAKE_VERSION=1.3.0
3-
DOTNET_VERSION=5.0.401
2+
CAKE_VERSION=2.2.0
3+
DOTNET_VERSION=6.0.400

build.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,19 @@ if [ "$DOTNET_VERSION" != "$DOTNET_INSTALLED_VERSION" ]; then
3333
mkdir "$SCRIPT_DIR/.dotnet"
3434
fi
3535
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://dot.net/v1/dotnet-install.sh
36-
# N.B. We explicitly install .NET Core 2.1 and 3.1 because .NET 5.0 SDK can build those TFMs
36+
# N.B. We explicitly install .NET Core 2.1 and 3.1 because .NET 6.0 SDK can build those TFMs
3737
# but will silently upgrade to a more recent runtime to execute tests if the desired runtime
3838
# isn't available. For example, `dotnet run --framework netcoreapp3.0` will silently run
39-
# on .NET 5.0 if .NET Core 3.0 and 3.1 aren't installed.
39+
# on .NET 6.0 if .NET Core 3.0 and 3.1 aren't installed.
4040
# This solution is admittedly hacky as .NET Core 2.1 and 3.1 won't be installed if
4141
# $DOTNET_VERSION matches $DOTNET_INSTALLED_VERSION, but it minimizes the changes required
4242
# to install required dependencies on Evergreen.
43-
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 2.1 --install-dir .dotnet --no-path
44-
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 3.1 --install-dir .dotnet --no-path
43+
# Since ARM64 support was first added in .NET 6.0, the following commands will install:
44+
# | CPU | 2.1 | 3.1 | Latest |
45+
# | x64 | x64 | x64 | x64 |
46+
# | arm64 | x64 | x64 | arm64 |
47+
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 2.1 --architecture x64 --install-dir .dotnet --no-path
48+
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 3.1 --architecture x64 --install-dir .dotnet --no-path
4549
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --install-dir .dotnet --no-path
4650
export PATH="$SCRIPT_DIR/.dotnet":$PATH
4751
export DOTNET_ROOT="$SCRIPT_DIR/.dotnet"

evergreen/evergreen.yml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ stepback: true
1313
command_type: system
1414

1515
# Protect ourself against rogue test case, or curl gone wild, that runs forever
16-
# 60 minutes: 20 minutes is a normal test run + up to 10 minutes for test setup + 15 minutes for longer macOS tests + 15 minutes for longer macOS 1015 tests
16+
# 60 minutes: 20 minutes is a normal test run + up to 10 minutes for test setup + 15 minutes for longer macOS tests + 15 minutes for longer macOS 1100 tests
1717
exec_timeout_secs: 3600
1818

1919
# What to do when evergreen hits the timeout (`post:` tasks are run automatically)
@@ -930,7 +930,7 @@ tasks:
930930
vars:
931931
FRAMEWORK: netstandard20
932932
- func: stop-load-balancer
933-
933+
934934
- name: test-load-balancer-netstandard21
935935
commands:
936936
- func: bootstrap-mongo-orchestration
@@ -1429,11 +1429,16 @@ axes:
14291429
variables:
14301430
OS: "ubuntu-1804"
14311431
run_on: ubuntu1804-test
1432-
- id: "macos-1015"
1433-
display_name: "macOS 10.15"
1432+
- id: "macos-1100"
1433+
display_name: "macOS 11.00"
1434+
variables:
1435+
OS: "macos-1100"
1436+
run_on: macos-1100
1437+
- id: "macos-1100-arm64"
1438+
display_name: "macOS 11.00 M1"
14341439
variables:
1435-
OS: "macos-1015"
1436-
run_on: macos-1015
1440+
OS: "macos-1100-arm64"
1441+
run_on: macos-1100-arm64
14371442

14381443
- id: topology
14391444
display_name: Topology
@@ -1505,10 +1510,10 @@ buildvariants:
15051510
- ubuntu1804-test
15061511
tasks:
15071512
- name: compile
1508-
- name: macos1015-compile
1509-
display_name: "macOS 10.15 compile"
1513+
- name: macos1100-compile
1514+
display_name: "macOS 11.00 compile"
15101515
run_on:
1511-
- macos-1015
1516+
- macos-1100
15121517
tasks:
15131518
- name: compile
15141519

@@ -1557,7 +1562,7 @@ buildvariants:
15571562
- name: test-netstandard21
15581563

15591564
- matrix_name: "tests-snappy-compression-macOS"
1560-
matrix_spec: { compressor : "snappy", auth: "noauth", ssl: "nossl", version: ["5.0", "6.0", "rapid", "latest"], topology: "standalone", os: "macos-1015" }
1565+
matrix_spec: { compressor : "snappy", auth: "noauth", ssl: "nossl", version: ["5.0", "6.0", "rapid", "latest"], topology: "standalone", os: ["macos-1100", "macos-1100-arm64"] }
15611566
display_name: "${version} ${compressor} ${topology} ${auth} ${ssl} ${os} "
15621567
tags: ["tests-variant"]
15631568
tasks:
@@ -1581,7 +1586,7 @@ buildvariants:
15811586
- name: test-netstandard21
15821587

15831588
- matrix_name: "tests-zstandard-compression-macOS"
1584-
matrix_spec: { compressor : "zstandard", auth: "noauth", ssl: "nossl", version: ["5.0", "6.0", "rapid", "latest"], topology: "standalone", os: "macos-1015" }
1589+
matrix_spec: { compressor : "zstandard", auth: "noauth", ssl: "nossl", version: ["5.0", "6.0", "rapid", "latest"], topology: "standalone", os: ["macos-1100", "macos-1100-arm64"] }
15851590
display_name: "${version} ${compressor} ${topology} ${auth} ${ssl} ${os} "
15861591
tags: ["tests-variant"]
15871592
tasks:
@@ -1605,14 +1610,14 @@ buildvariants:
16051610
- name: test-netstandard21
16061611

16071612
- matrix_name: "secure-tests-macOS"
1608-
matrix_spec: { version: ["5.0", "6.0", "rapid", "latest"], topology: "replicaset", auth: "auth", ssl: "ssl", os: "macos-1015" }
1613+
matrix_spec: { version: ["5.0", "6.0", "rapid", "latest"], topology: "replicaset", auth: "auth", ssl: "ssl", os: ["macos-1100", "macos-1100-arm64"] }
16091614
display_name: "${version} ${topology} ${auth} ${ssl} ${os}"
16101615
tags: ["tests-variant"]
16111616
tasks:
16121617
- name: test-netstandard21
16131618

16141619
- matrix_name: "unsecure-tests-macOS"
1615-
matrix_spec: { version: ["5.0", "6.0", "rapid", "latest"], topology: "replicaset", auth: "noauth", ssl: "nossl", os: "macos-1015" }
1620+
matrix_spec: { version: ["5.0", "6.0", "rapid", "latest"], topology: "replicaset", auth: "noauth", ssl: "nossl", os: ["macos-1100", "macos-1100-arm64"] }
16161621
display_name: "${version} ${topology} ${auth} ${ssl} ${os}"
16171622
tags: ["tests-variant"]
16181623
tasks:
@@ -1733,7 +1738,7 @@ buildvariants:
17331738
- name: test-csfle-with-mocked-kms-tls-netstandard21
17341739

17351740
- matrix_name: "csfle-with-mocked-kms-tests-macOS"
1736-
matrix_spec: { os: "macos-1015", ssl: "nossl", version: [ "5.0", "6.0", "rapid", "latest" ], topology: ["standalone"] }
1741+
matrix_spec: { os: [ "macos-1100", "macos-1100-arm64" ], ssl: "nossl", version: [ "5.0", "6.0", "rapid", "latest" ], topology: ["standalone"] }
17371742
display_name: "CSFLE Mocked KMS ${version} ${os}"
17381743
tasks:
17391744
- name: test-csfle-with-mocked-kms-tls-netstandard21
@@ -1754,7 +1759,8 @@ buildvariants:
17541759
- name: test-csfle-with-mongocryptd-netstandard21
17551760

17561761
- matrix_name: "csfle-with-mongocryptd-macOS"
1757-
matrix_spec: { os: "macos-1015", ssl: "nossl", version: [ "4.2", "4.4", "5.0", "6.0", "latest" ], topology: ["replicaset"] }
1762+
matrix_spec: { os: ["macos-1100", "macos-1100-arm64"], ssl: "nossl", version: [ "4.2", "4.4", "5.0", "6.0", "latest" ], topology: ["replicaset"] }
17581763
display_name: "CSFLE with mongocryptd ${version} ${os}"
17591764
tasks:
1760-
- name: test-csfle-with-mongocryptd-netstandard21
1765+
- name: test-csfle-with-mongocryptd-netstandard21
1766+

tests/AstrolabeWorkloadExecutor/AstrolabeWorkloadExecutor.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
<PropertyGroup>
77
<OutputType>Exe</OutputType>
8-
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net472</TargetFrameworks>
9-
<TargetFrameworks Condition="'$(IsWindows)'!='true'">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
8+
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net6.0;net472</TargetFrameworks>
9+
<TargetFrameworks Condition="'$(IsWindows)'!='true'">netcoreapp2.1;netcoreapp3.1;net6.0</TargetFrameworks>
1010
<LangVersion>9</LangVersion>
1111
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1212
<WarningsAsErrors />

tests/AtlasConnectivity.Tests/AtlasConnectivity.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
</PropertyGroup>
55

66
<PropertyGroup>
7-
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net472</TargetFrameworks>
8-
<TargetFrameworks Condition="'$(IsWindows)'!='true'">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
7+
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net6.0;net472</TargetFrameworks>
8+
<TargetFrameworks Condition="'$(IsWindows)'!='true'">netcoreapp2.1;netcoreapp3.1;net6.0</TargetFrameworks>
99
<LangVersion>9</LangVersion>
1010
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1111
<WarningsAsErrors />

tests/MongoDB.Bson.Tests/Exceptions/BsonExceptionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ public void Serialization_should_work()
3131
var formatter = new BinaryFormatter();
3232
using (var stream = new MemoryStream())
3333
{
34+
#pragma warning disable SYSLIB0011 // BinaryFormatter serialization is obsolete
3435
formatter.Serialize(stream, subject);
3536
stream.Position = 0;
3637
var rehydrated = (BsonException)formatter.Deserialize(stream);
38+
#pragma warning restore SYSLIB0011 // BinaryFormatter serialization is obsolete
3739

3840
rehydrated.Message.Should().Be(subject.Message);
3941
rehydrated.InnerException.Message.Should().Be(subject.InnerException.Message);

tests/MongoDB.Bson.Tests/Exceptions/BsonInternalExceptionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ public void Serialization_should_work()
3131
var formatter = new BinaryFormatter();
3232
using (var stream = new MemoryStream())
3333
{
34+
#pragma warning disable SYSLIB0011 // BinaryFormatter serialization is obsolete
3435
formatter.Serialize(stream, subject);
3536
stream.Position = 0;
3637
var rehydrated = (BsonInternalException)formatter.Deserialize(stream);
38+
#pragma warning restore SYSLIB0011 // BinaryFormatter serialization is obsolete
3739

3840
rehydrated.Message.Should().Be(subject.Message);
3941
rehydrated.InnerException.Message.Should().Be(subject.InnerException.Message);

tests/MongoDB.Bson.Tests/Exceptions/BsonSerializationExceptionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ public void Serialization_should_work()
3131
var formatter = new BinaryFormatter();
3232
using (var stream = new MemoryStream())
3333
{
34+
#pragma warning disable SYSLIB0011 // BinaryFormatter serialization is obsolete
3435
formatter.Serialize(stream, subject);
3536
stream.Position = 0;
3637
var rehydrated = (BsonSerializationException)formatter.Deserialize(stream);
38+
#pragma warning restore SYSLIB0011 // BinaryFormatter serialization is obsolete
3739

3840
rehydrated.Message.Should().Be(subject.Message);
3941
rehydrated.InnerException.Message.Should().Be(subject.InnerException.Message);

tests/MongoDB.Bson.Tests/Exceptions/DuplicateBsonMemberMapAttributeExceptionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ public void Serialization_should_work()
3131
var formatter = new BinaryFormatter();
3232
using (var stream = new MemoryStream())
3333
{
34+
#pragma warning disable SYSLIB0011 // BinaryFormatter serialization is obsolete
3435
formatter.Serialize(stream, subject);
3536
stream.Position = 0;
3637
var rehydrated = (DuplicateBsonMemberMapAttributeException)formatter.Deserialize(stream);
38+
#pragma warning restore SYSLIB0011 // BinaryFormatter serialization is obsolete
3739

3840
rehydrated.Message.Should().Be(subject.Message);
3941
rehydrated.InnerException.Message.Should().Be(subject.InnerException.Message);

0 commit comments

Comments
 (0)