Update Package.swift, README, and package logo. #151
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 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
on: | ||
pull_request: { types: [opened, reopened, synchronize, ready_for_review] } | ||
push: { branches: [ main ] } | ||
env: | ||
LOG_LEVEL: info | ||
SWIFT_DETERMINISTIC_HASHING: 1 | ||
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' | ||
MYSQL_HOSTNAME: 'mysql-a' | ||
MYSQL_HOSTNAME_A: 'mysql-a' | ||
MYSQL_HOSTNAME_B: 'mysql-b' | ||
SERVICE_CONFIG: | | ||
{ | ||
"MYSQL_ALLOW_EMPTY_PASSWORD": true, | ||
"MYSQL_USER": "test_username", | ||
"MYSQL_PASSWORD": "test_password", | ||
"MYSQL_DATABASE": "test_database" | ||
} | ||
jobs: | ||
dependency-graph: | ||
if: ${{ github.event_name == 'push' }} | ||
runs-on: ubuntu-latest | ||
container: swift:jammy | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Fix Git configuration | ||
run: | | ||
git config --global --add safe.directory "${GITHUB_WORKSPACE}" | ||
apt-get update && apt-get install -y curl | ||
- name: Submit dependency graph | ||
uses: vapor-community/swift-dependency-submission@v0.1 | ||
with: | ||
path: ${{ github.workspace }} | ||
api-breakage: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
runs-on: ubuntu-latest | ||
container: swift:jammy | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: { 'fetch-depth': 0 } | ||
- name: Run API breakage check | ||
run: | | ||
git config --global --add safe.directory "${GITHUB_WORKSPACE}" | ||
swift package diagnose-api-breaking-changes origin/main | ||
gh-codeql: | ||
if: ${{ false && !(github.event.pull_request.draft || false) }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: swift:jammy | ||
permissions: { actions: write, contents: read, security-events: write } | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Mark repo safe in non-fake global config | ||
run: | | ||
git config --global --add safe.directory "${GITHUB_WORKSPACE}" | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v4 | ||
with: { languages: swift } | ||
- name: Perform build | ||
run: | | ||
swift build | ||
- name: Run CodeQL analyze | ||
uses: github/codeql-action/analyze@v4 | ||
code-coverage: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: | ||
- mysql:8.0 | ||
- mariadb:11 | ||
runs-on: ubuntu-latest | ||
container: swift:jammy | ||
services: | ||
mysql-a: | ||
image: ${{ matrix.dbimage }} | ||
env: ${{ fromJSON(env.SERVICE_CONFIG) }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Run unit tests for coverage data | ||
run: swift test --enable-code-coverage | ||
- name: Upload coverage data | ||
uses: vapor/swift-codecov-action@v0.2 | ||
gh-codeql: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runner_os: | ||
- ubuntu-latest | ||
- macos-13 | ||
runs-on: ${{ matrix.runner_os }} | ||
permissions: | ||
security-events: write | ||
steps: | ||
- name: Select appropriate Xcode version | ||
if: ${{ startsWith(matrix.runner_os, 'macos') }} | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: { xcode-version: latest-stable } | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: { languages: swift } | ||
- name: Perform build | ||
run: swift build | ||
- name: Run CodeQL analyze | ||
uses: github/codeql-action/analyze@v2 | ||
linux-unit: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: | ||
- mysql:5.7 | ||
- mysql:8.2 | ||
- mariadb:10.2 | ||
- mariadb:11 | ||
- percona:5.7 | ||
- percona:8 | ||
swiftver: | ||
- swift:5.7-jammy | ||
- swift:5.8-jammy | ||
- swift:5.9-jammy | ||
- swiftlang/swift:nightly-5.10-jammy | ||
- swiftlang/swift:nightly-main-jammy | ||
runs-on: ubuntu-latest | ||
container: ${{ matrix.swiftver }} | ||
services: | ||
mysql-a: | ||
image: ${{ matrix.dbimage }} | ||
env: ${{ fromJSON(env.SERVICE_CONFIG) }} | ||
steps: | ||
- name: Check out package | ||
uses: actions/checkout@v4 | ||
with: { path: 'mysql-nio' } | ||
- name: Run unit tests | ||
run: swift test --package-path mysql-nio --enable-code-coverage --sanitize=thread | ||
- name: Upload code coverage | ||
uses: vapor/swift-codecov-action@v0.2 | ||
with: | ||
package_path: 'mysql-nio' | ||
- name: Check out mysql-kit dependent | ||
uses: actions/checkout@v4 | ||
with: { repository: 'vapor/mysql-kit', path: 'mysql-kit' } | ||
- name: Check out fluent-mysql-driver dependent | ||
uses: actions/checkout@v4 | ||
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 | ||
- name: Run fluent-mysql-driver tests | ||
run: swift test --package-path fluent-mysql-driver | ||
macos-unit: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: [mysql, mariadb, percona-server] | ||
xcode: ['~14.3', 'latest'] | ||
macos: ['macos-13'] | ||
include: | ||
- { username: root } | ||
- { dbimage: mariadb, username: runner } | ||
runs-on: macos-13 | ||
env: { MYSQL_HOSTNAME: '127.0.0.1' } | ||
steps: | ||
- name: Select latest available Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: { xcode-version: latest-stable } | ||
- name: Install MySQL, setup DB and auth, and wait for server start | ||
env: | ||
FORMULA: ${{ matrix.dbimage }} | ||
RUNAS_USER: ${{ matrix.username }} | ||
shell: bash | ||
run: | | ||
brew install "${FORMULA}" && brew link --force "${FORMULA}" | ||
brew services start "${FORMULA}" | ||
until echo | mysql -u"${RUNAS_USER}"; do sleep 1; done | ||
mysql -u"${RUNAS_USER}" --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@v4 | ||
- name: Run all tests | ||
run: swift test --sanitize=thread |