Skip to content

Commit 3173036

Browse files
authored
SWIFT-1337, SWIFT-1629, SWIFT-1557, SWIFT-1566: Various maintenance-related changes (#773)
1 parent 4718960 commit 3173036

Some content is hidden

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

46 files changed

+348
-140
lines changed

.evergreen/config.yml

Lines changed: 157 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,9 @@ functions:
336336
script: |
337337
set -o xtrace
338338
set -o errexit
339-
340-
if [ "${SWIFT_MINOR_VERSION}" = "main-snapshot" ]; then
341-
export SWIFT_VERSION="${SWIFT_MINOR_VERSION}"
342-
else
343-
# otherwise, find the latest patch release for the specified version
344-
${PYTHON} -m virtualenv ./requests-env
345-
./requests-env/${VENV_BIN_DIR}/python3 -m pip install requests
346-
export SWIFT_VERSION="$(./requests-env/${VENV_BIN_DIR}/python3 .evergreen/get_latest_swift_patch.py ${SWIFT_MINOR_VERSION})"
347-
fi
339+
${PYTHON} -m virtualenv ./requests-env
340+
./requests-env/${VENV_BIN_DIR}/python3 -m pip install requests
341+
export SWIFT_VERSION="$(./requests-env/${VENV_BIN_DIR}/python3 .evergreen/get_latest_swift_patch.py ${SWIFT_MINOR_VERSION})"
348342
echo "SWIFT_VERSION: $SWIFT_VERSION" > swift-version.yml
349343
cat swift-version.yml
350344
- command: expansions.update
@@ -620,6 +614,72 @@ tasks:
620614
MONGODB_VERSION: "5.0"
621615
TOPOLOGY: "sharded_cluster"
622616
- func: "run tests"
617+
618+
- name: "test-5.0-load_balancer"
619+
tags: ["5.0", "load-balancer"]
620+
commands:
621+
- func: "prepare resources"
622+
- func: "fix absolute paths"
623+
- func: "bootstrap mongo-orchestration"
624+
vars:
625+
MONGODB_VERSION: "5.0"
626+
TOPOLOGY: "sharded_cluster"
627+
LOAD_BALANCER: "true"
628+
- func: start-load-balancer
629+
- func: "run-lb-tests"
630+
vars:
631+
TOPOLOGY: "load_balanced"
632+
- func: stop-load-balancer
633+
634+
- name: "test-6.0-standalone"
635+
tags: ["6.0", "standalone"]
636+
commands:
637+
- func: "prepare resources"
638+
- func: "fix absolute paths"
639+
- func: "bootstrap mongo-orchestration"
640+
vars:
641+
MONGODB_VERSION: "6.0"
642+
TOPOLOGY: "server"
643+
- func: "run tests"
644+
645+
- name: "test-6.0-replica_set"
646+
tags: ["6.0", "replica_set"]
647+
commands:
648+
- func: "prepare resources"
649+
- func: "fix absolute paths"
650+
- func: "bootstrap mongo-orchestration"
651+
vars:
652+
MONGODB_VERSION: "6.0"
653+
TOPOLOGY: "replica_set"
654+
- func: "run tests"
655+
656+
- name: "test-6.0-sharded_cluster"
657+
tags: ["6.0", "sharded_cluster"]
658+
exec_timeout_secs: 3600 # TODO SWIFT-1410: remove
659+
commands:
660+
- func: "prepare resources"
661+
- func: "fix absolute paths"
662+
- func: "bootstrap mongo-orchestration"
663+
vars:
664+
MONGODB_VERSION: "6.0"
665+
TOPOLOGY: "sharded_cluster"
666+
- func: "run tests"
667+
668+
- name: "test-6.0-load_balancer"
669+
tags: ["6.0", "load-balancer"]
670+
commands:
671+
- func: "prepare resources"
672+
- func: "fix absolute paths"
673+
- func: "bootstrap mongo-orchestration"
674+
vars:
675+
MONGODB_VERSION: "6.0"
676+
TOPOLOGY: "sharded_cluster"
677+
LOAD_BALANCER: "true"
678+
- func: start-load-balancer
679+
- func: "run-lb-tests"
680+
vars:
681+
TOPOLOGY: "load_balanced"
682+
- func: stop-load-balancer
623683

624684
- name: "test-latest-standalone"
625685
tags: ["latest", "standalone"]
@@ -671,6 +731,56 @@ tasks:
671731
TOPOLOGY: "load_balanced"
672732
- func: stop-load-balancer
673733

734+
- name: "test-rapid-standalone"
735+
tags: ["rapid", "standalone"]
736+
commands:
737+
- func: "prepare resources"
738+
- func: "fix absolute paths"
739+
- func: "bootstrap mongo-orchestration"
740+
vars:
741+
MONGODB_VERSION: "rapid"
742+
TOPOLOGY: "server"
743+
- func: "run tests"
744+
745+
- name: "test-rapid-replica_set"
746+
tags: ["rapid", "replica_set"]
747+
commands:
748+
- func: "prepare resources"
749+
- func: "fix absolute paths"
750+
- func: "bootstrap mongo-orchestration"
751+
vars:
752+
MONGODB_VERSION: "rapid"
753+
TOPOLOGY: "replica_set"
754+
- func: "run tests"
755+
756+
- name: "test-rapid-sharded_cluster"
757+
tags: ["rapid", "sharded_cluster"]
758+
exec_timeout_secs: 3600 # TODO SWIFT-1410: remove
759+
commands:
760+
- func: "prepare resources"
761+
- func: "fix absolute paths"
762+
- func: "bootstrap mongo-orchestration"
763+
vars:
764+
MONGODB_VERSION: "rapid"
765+
TOPOLOGY: "sharded_cluster"
766+
- func: "run tests"
767+
768+
- name: "test-rapid-load_balancer"
769+
tags: ["rapid", "load-balancer"]
770+
commands:
771+
- func: "prepare resources"
772+
- func: "fix absolute paths"
773+
- func: "bootstrap mongo-orchestration"
774+
vars:
775+
MONGODB_VERSION: "rapid"
776+
TOPOLOGY: "sharded_cluster"
777+
LOAD_BALANCER: "true"
778+
- func: start-load-balancer
779+
- func: "run-lb-tests"
780+
vars:
781+
TOPOLOGY: "load_balanced"
782+
- func: stop-load-balancer
783+
674784
- name: "test-atlas-connectivity"
675785
tags: ["atlas-connect"]
676786
commands:
@@ -1049,6 +1159,14 @@ axes:
10491159
display_name: "latest"
10501160
variables:
10511161
MONGODB_VERSION: "latest"
1162+
- id: "rapid"
1163+
display_name: "rapid"
1164+
variables:
1165+
MONGODB_VERSION: "rapid"
1166+
- id: "6.0"
1167+
display_name: "6.0"
1168+
variables:
1169+
MONGODB_VERSION: "6.0"
10521170
- id: "5.0"
10531171
display_name: "5.0"
10541172
variables:
@@ -1087,6 +1205,13 @@ axes:
10871205
PYTHON: "/opt/mongodbtoolchain/v3/bin/python3"
10881206
VENV_BIN_DIR: "bin"
10891207

1208+
- id: macos-10.14
1209+
display_name: "macOS 10.14"
1210+
run_on: macos-1014
1211+
variables:
1212+
PYTHON: "/opt/mongodbtoolchain/v3/bin/python3"
1213+
VENV_BIN_DIR: "bin"
1214+
10901215
- id: macos-11
10911216
display_name: "macOS 11"
10921217
run_on: macos-1100
@@ -1112,10 +1237,6 @@ axes:
11121237
- id: swift-version
11131238
display_name: "Swift"
11141239
values:
1115-
- id: "5.1"
1116-
display_name: "Swift 5.1"
1117-
variables:
1118-
SWIFT_MINOR_VERSION: "5.1"
11191240
- id: "5.2"
11201241
display_name: "Swift 5.2"
11211242
variables:
@@ -1250,27 +1371,32 @@ buildvariants:
12501371

12511372
- matrix_name: "min-version-compile"
12521373
matrix_spec:
1253-
# Ubuntu 20.04 does not have Swift 5.1 toolchains.
12541374
os-fully-featured:
1255-
- "macos-11"
1256-
- "ubuntu-18.04"
1257-
swift-version: "5.1"
1375+
- macos-10.14
1376+
- ubuntu-18.04
1377+
- ubuntu-20.04
1378+
swift-version: "5.2"
12581379
display_name: "Compile ${swift-version} ${os-fully-featured}"
12591380
tasks:
12601381
- "compile"
12611382

12621383
- matrix_name: "tests-all"
12631384
matrix_spec:
1264-
os-fully-featured: "*"
1385+
os-fully-featured:
1386+
- macos-11
1387+
- ubuntu-18.04
1388+
- ubuntu-20.04
12651389
swift-version:
12661390
- "5.5"
12671391
- "5.6"
12681392
- "5.7-dev"
12691393
ssl-auth: "*"
12701394
display_name: "${swift-version} ${os-fully-featured} ${ssl-auth}"
12711395
tasks:
1396+
- ".rapid !.load-balancer"
12721397
- ".latest !.load-balancer"
1273-
- ".5.0"
1398+
- ".6.0 !.load-balancer"
1399+
- ".5.0 !.load-balancer"
12741400
- ".4.4"
12751401
- ".4.2"
12761402
- ".4.0"
@@ -1302,7 +1428,10 @@ buildvariants:
13021428

13031429
- matrix_name: "atlas-connect"
13041430
matrix_spec:
1305-
os-fully-featured: "*"
1431+
os-fully-featured:
1432+
- macos-11
1433+
- ubuntu-18.04
1434+
- ubuntu-20.04
13061435
swift-version:
13071436
- "5.5"
13081437
- "5.6"
@@ -1340,6 +1469,8 @@ buildvariants:
13401469
- "ubuntu-20.04"
13411470
versions:
13421471
- latest
1472+
- rapid
1473+
- 6.0
13431474
- 5.0
13441475
- 4.4
13451476
swift-version: "5.6"
@@ -1363,6 +1494,8 @@ buildvariants:
13631494
swift-version: "5.6"
13641495
versions:
13651496
- latest
1497+
- rapid
1498+
- 6.0
13661499
- 5.0
13671500
- 4.4
13681501
display_name: "OCSP ${swift-version} ${os-fully-featured} ${versions}"
@@ -1382,6 +1515,9 @@ buildvariants:
13821515
tasks:
13831516
# Versioned API was introduced in MongoDB 4.7
13841517
- "test-latest-standalone"
1518+
- "test-rapid-standalone"
1519+
- "test-6.0-standalone"
1520+
- "test-5.0-standalone"
13851521

13861522
- matrix_name: "format-lint"
13871523
display_name: "Format and Lint"
@@ -1418,4 +1554,4 @@ buildvariants:
14181554
ssl-auth: "*"
14191555
check-leaks: "leaks"
14201556
tasks:
1421-
- ".5.0"
1557+
- ".6.0 !.load-balancer"

.evergreen/configure-swift.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,16 @@ export SWIFTENV_ROOT="${INSTALL_DIR}/swiftenv"
1616
export PATH="${SWIFTENV_ROOT}/bin:$PATH"
1717
eval "$(swiftenv init -)"
1818

19-
# dynamically determine latest available snapshot if needed
20-
if [ "$SWIFT_VERSION" = "main-snapshot" ]; then
21-
SWIFT_VERSION=$(swiftenv install --list-snapshots | tail -1)
22-
fi
23-
2419
if [ "$OS" == "darwin" ]; then
25-
# latest snapshots require a newer version of Xcode/Command Line Tools
26-
if [[ "$SWIFT_VERSION" == DEVELOPMENT-SNAPSHOT* ]]; then
27-
sudo xcode-select -s /Applications/Xcode13.1.app
20+
# 5.2 requires an older version of Xcode/Command Line Tools
21+
if [[ "$SWIFT_VERSION" == 5.2.* ]]; then
22+
sudo xcode-select -s /Applications/Xcode11.3.app
2823
else
29-
sudo xcode-select -s /Applications/Xcode12.app
24+
sudo xcode-select -s /Applications/Xcode13.2.1.app
3025
fi
3126

32-
# TODO SWIFT-1421: remove this once we have new Xcode on Evergreen to test with
27+
# required to use the toolchain's concurrency library rather than the one which ships with Xcode
28+
# and may not necessarily match the Swift version being used.
3329
export DYLD_LIBRARY_PATH=${SWIFTENV_ROOT}/versions/${SWIFT_VERSION}/usr/lib/swift/macosx/
3430
fi
3531

.evergreen/get_latest_swift_patch.py

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,43 @@
22
import requests
33
import sys
44

5-
# This script accepts a version number in the form "x.y" as an argument. It will query the Swift Github
6-
# repo for releases and find the latest x.y.z patch release if available, and print out the matching tag.
5+
# This script accepts a single argument which can be either:
6+
# 1) a version number in the form "x.y", or
7+
# 2) the string "snapshot"
8+
# If a version number is provided the script will query the Swift GitHub repo for releases and find the latest x.y.z patch
9+
# release if available, and print out the matching tag.
10+
# If "main-snapshot" is provided the script will find the latest development snapshot tagged on the Swift GitHub repo.
711

812
if len(sys.argv) != 2:
913
print("Expected 1 argument, but got: {}".format(sys.argv[1:]))
1014
exit(1)
1115

1216
version = sys.argv[1]
13-
components = version.split('.')
14-
if len(components) != 2:
15-
print("Expected version number in form x.y, got {}".format(version))
16-
exit(1)
1717

18-
major = components[0]
19-
minor = components[1]
18+
if version == "main-snapshot":
19+
tag_data = requests.get('https://api.github.com/repos/apple/swift/tags').json()
20+
latest_snapshot = next(filter(lambda tag: 'swift-DEVELOPMENT-SNAPSHOT' in tag['name'], tag_data))
21+
print(latest_snapshot['name'][6:]) # drop the preceding 'swift-' from the tag, because swiftenv does the same when installing it.
22+
else:
23+
components = version.split('.')
24+
if len(components) != 2:
25+
print("Expected version number in form x.y, got {}".format(version))
26+
exit(1)
27+
28+
major = components[0]
29+
minor = components[1]
2030

21-
version_regex = '^swift-({}\.{}(\.(\d+))?)-RELEASE$'.format(major, minor)
31+
version_regex = '^swift-({}\.{}(\.(\d+))?)-RELEASE$'.format(major, minor)
2232

23-
release_data = requests.get('https://api.github.com/repos/apple/swift/releases').json()
24-
tag_names = map(lambda release: release['tag_name'], release_data)
33+
release_data = requests.get('https://api.github.com/repos/apple/swift/releases').json()
34+
tag_names = map(lambda release: release['tag_name'], release_data)
2535

26-
# find tags matching the specified regexes
27-
matches = filter(lambda match: match is not None, map(lambda tag: re.match(version_regex, tag), tag_names))
36+
# find tags matching the specified regexes
37+
matches = filter(lambda match: match is not None, map(lambda tag: re.match(version_regex, tag), tag_names))
2838

29-
# sort matches by their patch versions. patch versions of 0 are omitted so substitute 0 when the group is None.
30-
sorted_matches = sorted(matches, key=lambda match: int(match.group(2)[1:]) if match.group(2) is not None else 0, reverse=True)
39+
# sort matches by their patch versions. patch versions of 0 are omitted so substitute 0 when the group is None.
40+
sorted_matches = sorted(matches, key=lambda match: int(match.group(2)[1:]) if match.group(2) is not None else 0, reverse=True)
3141

32-
# map to the first match group which contains the full version number.
33-
sorted_version_numbers = map(lambda match: match.group(1), sorted_matches)
34-
print(next(sorted_version_numbers))
42+
# map to the first match group which contains the full version number.
43+
sorted_version_numbers = map(lambda match: match.group(1), sorted_matches)
44+
print(next(sorted_version_numbers))

.evergreen/install-swift.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,4 @@ git clone --depth 1 -b "osx-install-path" https://github.com/kmahar/swiftenv.git
2020
# install swift
2121
eval "$(swiftenv init -)"
2222

23-
if [ "$SWIFT_VERSION" = "main-snapshot" ]; then
24-
SWIFT_VERSION=$(swiftenv install --list-snapshots | tail -1)
25-
fi
26-
2723
swiftenv install --install-local $SWIFT_VERSION

.evergreen/install-tools.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ install_from_gh () {
3535

3636
if [ $1 == "swiftlint" ]
3737
then
38-
build_from_gh swiftlint https://github.com/realm/SwiftLint "0.46.3"
38+
build_from_gh swiftlint https://github.com/realm/SwiftLint "0.48.0"
3939
elif [ $1 == "swiftformat" ]
4040
then
41-
build_from_gh swiftformat https://github.com/nicklockwood/SwiftFormat "0.49.4"
41+
build_from_gh swiftformat https://github.com/nicklockwood/SwiftFormat "0.49.17"
4242
elif [ $1 == "sourcery" ]
4343
then
4444
install_from_gh sourcery https://github.com/krzysztofzablocki/Sourcery/releases/download/1.6.1/Sourcery-1.6.1.zip

.evergreen/run-atlas-tests.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ INSTALL_DIR="${PROJECT_DIRECTORY}/opt"
99
# configure Swift
1010
. ${PROJECT_DIRECTORY}/.evergreen/configure-swift.sh
1111

12+
13+
# work around https://github.com/mattgallagher/CwlPreconditionTesting/issues/22 (bug still exists in version 1.x
14+
# when using Xcode 13.2)
15+
if [ "$OS" == "darwin" ]; then
16+
EXTRA_FLAGS="-Xswiftc -Xfrontend -Xswiftc -validate-tbd-against-ir=none"
17+
fi
18+
1219
# run the tests
1320
ATLAS_REPL="$ATLAS_REPL" ATLAS_SHRD="$ATLAS_SHRD" ATLAS_FREE="$ATLAS_FREE" ATLAS_TLS11="$ATLAS_TLS11" ATLAS_TLS12="$ATLAS_TLS12" \
1421
ATLAS_REPL_SRV="$ATLAS_REPL_SRV" ATLAS_SHRD_SRV="$ATLAS_SHRD_SRV" ATLAS_FREE_SRV="$ATLAS_FREE_SRV" ATLAS_TLS11_SRV="$ATLAS_TLS11_SRV" ATLAS_TLS12_SRV="$ATLAS_TLS12_SRV" \

0 commit comments

Comments
 (0)