Update For Swift 6 #105
Workflow file for this run
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
name: test | |
on: | |
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: | |
# Baseline test run for code coverage stats | |
codecov: | |
strategy: | |
matrix: | |
dbimage: | |
- mongo:6 | |
runs-on: ubuntu-latest | |
container: swift:6.0-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/swift-codecov-action@v0.2 | |
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:6.0-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:6 | |
runner: | |
- swift:5.9-focal | |
- swift:5.10-jammy | |
- swift:6.0-jammy | |
container: ${{ matrix.runner }} | |
runs-on: ubuntu-latest | |
services: | |
mongo-a: | |
image: ${{ matrix.dbimage }} | |
mongo-b: | |
image: ${{ matrix.dbimage }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Run tests with Thread Sanitizer | |
run: swift test --sanitize=thread | |
macos-all: | |
if: github.event_name == 'pull_request' | |
strategy: | |
fail-fast: false | |
matrix: | |
dbimage: ['mongodb-community'] | |
macos: ['macos-14'] | |
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 |