Add missing MySQLNIO import #116
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 | |
MYSQL_HOSTNAME: 'mysql-a' | |
MYSQL_HOSTNAME_A: 'mysql-a' | |
MYSQL_HOSTNAME_B: 'mysql-b' | |
MYSQL_DATABASE: 'test_database' | |
MYSQL_DATABASE_A: 'test_database' | |
MYSQL_DATABASE_B: 'test_database' | |
MYSQL_USERNAME: 'test_username' | |
MYSQL_USERNAME_A: 'test_username' | |
MYSQL_USERNAME_B: 'test_username' | |
MYSQL_PASSWORD: 'test_password' | |
MYSQL_PASSWORD_A: 'test_password' | |
MYSQL_PASSWORD_B: 'test_password' | |
jobs: | |
codecov: | |
strategy: | |
# For MySQL we have to run coverage baselines against multiple DB versions thanks to | |
# the driver's behavior changing notably depending on the server. | |
matrix: { dbimage: ['mysql:5.7', 'mysql:8.0', 'mariadb:10.7'] } | |
runs-on: ubuntu-latest | |
container: swift:5.7-jammy | |
services: | |
mysql-a: | |
image: ${{ matrix.dbimage }} | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | |
MYSQL_USER: test_username | |
MYSQL_PASSWORD: test_password | |
MYSQL_DATABASE: test_database | |
mysql-b: | |
image: ${{ matrix.dbimage }} | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | |
MYSQL_USER: test_username | |
MYSQL_PASSWORD: test_password | |
MYSQL_DATABASE: test_database | |
steps: | |
- name: Save MySQL version to env | |
run: | | |
echo MYSQL_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,MYSQL_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.8-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 | |
# Unit tests (Linux) | |
linux-unit: | |
if: ${{ github.event_name == 'pull_request' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
dbimage: | |
- mysql:5.7 | |
- mysql:8.0 | |
- mariadb:10.4 | |
- mariadb:10.11 | |
- percona:8.0 | |
runner: | |
- swift:5.6-focal | |
- swift:5.7-jammy | |
- swift:5.8-jammy | |
- swiftlang/swift:nightly-5.9-jammy | |
- swiftlang/swift:nightly-main-jammy | |
runs-on: ubuntu-latest | |
container: ${{ matrix.runner }} | |
services: | |
mysql-a: | |
image: ${{ matrix.dbimage }} | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | |
MYSQL_USER: test_username | |
MYSQL_PASSWORD: test_password | |
MYSQL_DATABASE: test_database | |
mysql-b: | |
image: ${{ matrix.dbimage }} | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | |
MYSQL_USER: test_username | |
MYSQL_PASSWORD: test_password | |
MYSQL_DATABASE: test_database | |
steps: | |
- name: Check out package | |
uses: actions/checkout@v3 | |
- name: Run tests with Thread Sanitizer | |
run: swift test --sanitize=thread | |
# Unit tests (macOS) | |
macos-unit: | |
if: ${{ github.event_name == 'pull_request' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
formula: | |
- mysql@8.0 | |
macos: | |
- macos-12 | |
xcode: | |
- latest-stable | |
runs-on: ${{ matrix.macos }} | |
steps: | |
- name: Select latest available Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ matrix.xcode }} | |
- name: Install MySQL server from Homebrew | |
run: brew install ${{ matrix.formula }} && brew link --force ${{ matrix.formula }} | |
- name: Start MySQL server | |
run: brew services start ${{ matrix.formula }} | |
- name: Wait for MySQL server to be ready | |
run: until echo | mysql -uroot; do sleep 1; done | |
timeout-minutes: 5 | |
- name: Set up MySQL databases and privileges | |
run: | | |
mysql -uroot --batch <<-'SQL' | |
CREATE USER test_username@localhost IDENTIFIED BY 'test_password'; | |
CREATE DATABASE test_database_a; GRANT ALL PRIVILEGES ON test_database_a.* TO test_username@localhost; | |
CREATE DATABASE test_database_b; GRANT ALL PRIVILEGES ON test_database_b.* TO test_username@localhost; | |
SQL | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Run tests with Thread Sanitizer | |
run: swift test --sanitize=thread | |
env: | |
MYSQL_HOSTNAME_A: '127.0.0.1' | |
MYSQL_HOSTNAME_B: '127.0.0.1' | |
MYSQL_DATABASE_A: test_database_a | |
MYSQL_DATABASE_B: test_database_b | |
test-exports: | |
name: Test exports | |
runs-on: ubuntu-latest | |
container: swift:5.8-jammy | |
steps: | |
- name: Check out Vapor | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
run: swift build -Xswiftc -DBUILDING_DOCC |