-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update minimum Swift version to 5.5 (#51)
* Update minimum Swift version to 5.5, improve CI * Normalize behavior of Mongo driver tests to match other drivers. Fix copy-paste error in logger label for second database connection.
- Loading branch information
Showing
3 changed files
with
101 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,77 @@ | ||
name: test | ||
on: | ||
- pull_request | ||
pull_request: { branches: ['*'] } | ||
push: { branches: ['main'] } | ||
|
||
env: | ||
LOG_LEVEL: debug | ||
SWIFT_DETERMINISTIC_HASHING: 1 | ||
MONGO_HOSTNAME: 'mongo-a' | ||
MONGO_HOSTNAME_A: 'mongo-a' | ||
MONGO_HOSTNAME_B: 'mongo-b' | ||
MONGO_DATABASE: 'test_database' | ||
MONGO_DATABASE_A: 'test_database' | ||
MONGO_DATABASE_B: 'test_database' | ||
|
||
jobs: | ||
linux: | ||
# Baseline test run for code coverage stats | ||
codecov: | ||
strategy: | ||
matrix: | ||
dbimage: | ||
- mongo:6 | ||
runs-on: ubuntu-latest | ||
container: swift:5.7-jammy | ||
services: | ||
mongo-a: | ||
image: ${{ matrix.dbimage }} | ||
mongo-b: | ||
image: ${{ matrix.dbimage }} | ||
steps: | ||
- name: Save Mongo version to env | ||
run: | | ||
echo MONGO_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV | ||
- name: Check out package | ||
uses: actions/checkout@v3 | ||
- name: Run local tests with coverage | ||
run: swift test --enable-code-coverage | ||
- name: Submit coverage report to Codecov.io | ||
uses: vapor/[email protected] | ||
with: | ||
cc_flags: 'unittests' | ||
cc_env_vars: 'SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,MONGO_VERSION' | ||
cc_fail_ci_if_error: true | ||
cc_verbose: true | ||
cc_dry_run: false | ||
|
||
# Check for API breakage versus main | ||
api-breakage: | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
container: swift:5.7-jammy | ||
steps: | ||
- name: Check out package | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
# https://github.com/actions/checkout/issues/766 | ||
- name: Mark the workspace as safe | ||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE} | ||
- name: Check for API breaking changes | ||
run: swift package diagnose-api-breaking-changes origin/main | ||
|
||
linux-all: | ||
if: github.event_name == 'pull_request' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: | ||
- mongo | ||
- mongo:6 | ||
runner: | ||
- swift:5.4-focal | ||
- swift:5.5-focal | ||
- swift:5.5-bionic | ||
- swift:5.6-focal | ||
- swiftlang/swift:nightly-main-focal | ||
- swift:5.7-jammy | ||
- swiftlang/swift:nightly-main-jammy | ||
container: ${{ matrix.runner }} | ||
runs-on: ubuntu-latest | ||
services: | ||
|
@@ -25,6 +84,33 @@ jobs: | |
uses: actions/checkout@v3 | ||
- name: Run tests with Thread Sanitizer | ||
run: swift test --sanitize=thread | ||
env: | ||
MONGO_HOSTNAME_A: mongo-a | ||
MONGO_HOSTNAME_B: mongo-b | ||
|
||
macos-all: | ||
if: github.event_name == 'pull_request' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: ['mongodb-community'] | ||
macos: ['macos-11', 'macos-12'] | ||
xcode: ['latest-stable'] | ||
runs-on: ${{ matrix.macos }} | ||
env: | ||
MONGO_HOSTNAME: 127.0.0.1 | ||
MONGO_HOSTNAME_A: 127.0.0.1 | ||
MONGO_HOSTNAME_B: 127.0.0.1 | ||
MONGO_DATABASE_B: 'test_database_b' | ||
steps: | ||
- name: Select latest available Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.xcode }} | ||
- name: Install Mongo and wait for server start | ||
run: | | ||
brew tap mongodb/brew | ||
brew install ${{ matrix.dbimage }} | ||
brew services start ${{ matrix.dbimage }} | ||
timeout-minutes: 2 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Run all tests | ||
run: swift test --sanitize=thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters