-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates default DB config for tests to use test_ prefix (#67)
* Defaults the DB schema name, username, and password used for tests to be prefixed with `test_` rather than `vapor_`. Updates README, CI and docker-compose.yml. Removes a few Vapor-specific references in the tests. Also some CI improvements.
- Loading branch information
Showing
6 changed files
with
131 additions
and
198 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 |
---|---|---|
|
@@ -5,178 +5,129 @@ defaults: | |
run: | ||
shell: bash | ||
jobs: | ||
dependents: | ||
linux-all: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: | ||
- mysql:5.7 | ||
- mysql:8.0 | ||
- mariadb:10.2 | ||
- mariadb:10.7 | ||
- percona:5.7 | ||
- percona:8.0 | ||
swiftver: | ||
- swift:5.2 | ||
- swift:5.5 | ||
- swiftlang/swift:nightly-main | ||
swiftos: | ||
- focal | ||
container: ${{ format('{0}-{1}', matrix.swiftver, matrix.swiftos) }} | ||
runs-on: ubuntu-latest | ||
env: | ||
LOG_LEVEL: debug | ||
# Unfortunately, fluent-mysql-driver details leak through here | ||
MYSQL_DATABASE: 'test_database' | ||
MYSQL_DATABASE_A: 'test_database' | ||
MYSQL_DATABASE_B: 'test_database' | ||
MYSQL_USER: 'test_username' | ||
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' | ||
MYSQL_HOSTNAME: 'mysql-a' | ||
MYSQL_HOSTNAME_A: 'mysql-a' | ||
MYSQL_HOSTNAME_B: 'mysql-b' | ||
services: | ||
mysql-a: | ||
image: ${{ matrix.dbimage }} | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | ||
MYSQL_USER: vapor_username | ||
MYSQL_PASSWORD: vapor_password | ||
MYSQL_DATABASE: vapor_database | ||
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: vapor_username | ||
MYSQL_PASSWORD: vapor_password | ||
MYSQL_DATABASE: vapor_database | ||
container: swift:5.4-focal | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: | ||
- mysql:5.7 | ||
- mysql:8.0 | ||
- mariadb:latest | ||
dependent: | ||
- mysql-kit | ||
- fluent-mysql-driver | ||
MYSQL_USER: test_username | ||
MYSQL_PASSWORD: test_password | ||
MYSQL_DATABASE: test_database | ||
steps: | ||
- name: Check out package | ||
uses: actions/checkout@v2 | ||
with: | ||
path: package | ||
- name: Check out dependent | ||
with: { path: 'mysql-nio' } | ||
- name: Run tests | ||
run: swift test --package-path mysql-nio --enable-test-discovery | ||
- name: Check out mysql-kit dependent | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: vapor/${{ matrix.dependent }} | ||
path: dependent | ||
- name: Use local package | ||
run: swift package edit mysql-nio --path ../package | ||
working-directory: dependent | ||
- name: Run tests with Thread Sanitizer | ||
run: swift test --enable-test-discovery --sanitize=thread | ||
working-directory: dependent | ||
env: | ||
MYSQL_HOSTNAME: mysql-a | ||
MYSQL_HOSTNAME_A: mysql-a | ||
MYSQL_HOSTNAME_B: mysql-b | ||
LOG_LEVEL: trace | ||
linux: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: | ||
- mysql:5.7 | ||
- mysql:8.0 | ||
- mariadb:latest | ||
runner: | ||
- swift:5.2-xenial | ||
- swift:5.2-bionic | ||
- swift:5.2-focal | ||
- swift:5.2-centos7 | ||
- swift:5.2-centos8 | ||
- swift:5.2-amazonlinux2 | ||
- swift:5.3-xenial | ||
- swift:5.3-bionic | ||
- swift:5.3-focal | ||
- swift:5.3-centos7 | ||
- swift:5.3-centos8 | ||
- swift:5.3-amazonlinux2 | ||
- swift:5.4-bionic | ||
- swift:5.4-focal | ||
- swift:5.4-centos7 | ||
- swift:5.4-centos8 | ||
- swift:5.4-amazonlinux2 | ||
- swiftlang/swift:nightly-5.5-focal | ||
- swiftlang/swift:nightly-5.5-centos8 | ||
- swiftlang/swift:nightly-5.5-amazonlinux2 | ||
- swiftlang/swift:nightly-main-focal | ||
- swiftlang/swift:nightly-main-centos8 | ||
- swiftlang/swift:nightly-main-amazonlinux2 | ||
exclude: | ||
- runner: swift:5.2-amazonlinux2 | ||
dbimage: mysql:8.0 | ||
- runner: swift:5.3-amazonlinux2 | ||
dbimage: mysql:8.0 | ||
- runner: swift:5.4-amazonlinux2 | ||
dbimage: mysql:8.0 | ||
- runner: swiftlang/swift:nightly-5.5-amazonlinux2 | ||
dbimage: mysql:8.0 | ||
- runner: swiftlang/swift:nightly-main-amazonlinux2 | ||
dbimage: mysql:8.0 | ||
container: ${{ matrix.runner }} | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: ${{ matrix.dbimage }} | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | ||
MYSQL_USER: vapor_username | ||
MYSQL_PASSWORD: vapor_password | ||
MYSQL_DATABASE: vapor_database | ||
steps: | ||
- name: Workaround SPM incompatibility with old Git on CentOS 7 | ||
if: ${{ contains(matrix.runner, 'centos7') }} | ||
run: | | ||
yum install -y make libcurl-devel | ||
git clone https://github.com/git/git -bv2.28.0 --depth 1 && cd git | ||
make prefix=/usr -j all install NO_OPENSSL=1 NO_EXPAT=1 NO_TCLTK=1 NO_GETTEXT=1 NO_PERL=1 | ||
- name: Check out code | ||
with: { repository: 'vapor/mysql-kit', path: 'mysql-kit' } | ||
- name: Check out fluent-mysql-driver dependent | ||
uses: actions/checkout@v2 | ||
- name: Run tests with Thread Sanitizer | ||
run: swift test --enable-test-discovery --sanitize=thread | ||
env: | ||
MYSQL_HOSTNAME: mysql | ||
LOG_LEVEL: trace | ||
macOS: | ||
with: { repository: 'vapor/fluent-mysql-driver', path: 'fluent-mysql-driver' } | ||
- name: Use local package in dependents | ||
run: | | ||
swift package --package-path mysql-kit edit mysql-nio --path mysql-nio | ||
swift package --package-path fluent-mysql-driver edit mysql-nio --path mysql-nio | ||
- name: Run mysql-kit tests | ||
run: swift test --package-path mysql-kit --enable-test-discovery | ||
- name: Run fluent-mysql-driver tests | ||
run: swift test --package-path fluent-mysql-driver --enable-test-discovery | ||
|
||
macos-all: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
formula: | ||
- [email protected] | ||
- [email protected] | ||
dbimage: | ||
- mysql | ||
- mariadb | ||
- percona-server | ||
xcode: | ||
- latest | ||
- latest-stable | ||
- latest | ||
include: | ||
- username: root | ||
- formula: mariadb | ||
- dbimage: mariadb | ||
username: runner | ||
runs-on: macos-latest | ||
runs-on: macos-11 | ||
env: | ||
LOG_LEVEL: debug | ||
MYSQL_DATABASE: 'test_database' | ||
MYSQL_USERNAME: 'test_username' | ||
MYSQL_PASSWORD: 'test_password' | ||
MYSQL_HOSTNAME: '127.0.0.1' | ||
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 -u${{ matrix.username }}; do sleep 1; done | ||
timeout-minutes: 5 | ||
- name: Set up MySQL databases and privileges | ||
- name: Install MySQL, setup DB and auth, and wait for server start | ||
run: | | ||
mysql -u${{ matrix.username }} --batch <<-'SQL' | ||
CREATE USER vapor_username@localhost IDENTIFIED BY 'vapor_password'; | ||
CREATE DATABASE vapor_database; | ||
GRANT ALL PRIVILEGES ON vapor_database.* TO vapor_username@localhost; | ||
brew install ${{ matrix.dbimage }} && brew link --force ${{ matrix.dbimage }} | ||
brew services start ${{ matrix.dbimage }} | ||
until echo | mysql -u${{ matrix.username }}; do sleep 1; done | ||
mysql -u${{ matrix.username }} --batch <<-SQL | ||
CREATE USER $MYSQL_USERNAME@localhost IDENTIFIED BY '$MYSQL_PASSWORD'; | ||
CREATE DATABASE $MYSQL_DATABASE; | ||
GRANT ALL PRIVILEGES ON $MYSQL_DATABASE.* TO $MYSQL_USERNAME@localhost; | ||
SQL | ||
timeout-minutes: 5 | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Run tests with Thread Sanitizer | ||
run: swift test --enable-test-discovery --sanitize=thread | ||
env: | ||
MYSQL_HOSTNAME: '127.0.0.1' | ||
MYSQL_DATABASE: vapor_database | ||
LOG_LEVEL: trace | ||
# windows: | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# swiftver: | ||
# - '5.4.2' | ||
- name: Run all tests | ||
run: swift test | ||
|
||
# Leave Windows disabled until NIO works there. | ||
# windows-all: | ||
# runs-on: windows-latest | ||
# continue-on-error: true | ||
# steps: | ||
# - uses: compnerd/gha-setup-swift@main | ||
# with: | ||
# branch: swift-5.5-release | ||
# tag: 5.5-RELEASE | ||
# - name: Check out code | ||
# uses: actions/checkout@v2 | ||
# - name: Run tests | ||
# uses: MaxDesiatov/swift-windows-action@v1 | ||
# with: | ||
# shell-action: swift test | ||
# swift-version: ${{ matrix.swiftver }} | ||
# run: swift test |
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
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
Oops, something went wrong.