-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for new SQLKit and support more URL string formats (#325)
* Update package infrastructure, bump Swift minimum to 5.8, add ExistentialAny and StrictConcurrency compliance * Leverage the new SQLKit functionality, remove various crashing codepaths from the encoder and decoder, add more features to the dialect, improve NULL handling, other misc cleanup * Remove obsolete file * Add Swift 5.9 manifest * Improve docs * Add support for additional MySQL URL formats. * Add 100% doc comments coverage (rather trivial for this package) * Add tests for new URL formats and use the undeprecated SQLBenchmarker API * Make MySQLConfiguration Sendable
- Loading branch information
Showing
22 changed files
with
866 additions
and
355 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 +1,8 @@ | ||
* @0xTim @gwynne | ||
* @gwynne | ||
/.github/CONTRIBUTING.md @gwynne @0xTim | ||
/.github/workflows/*.yml @gwynne @0xTim | ||
/.github/workflows/test.yml @gwynne | ||
/.spi.yml @gwynne @0xTim | ||
/.gitignore @gwynne @0xTim | ||
/LICENSE @gwynne @0xTim | ||
/README.md @gwynne @0xTim |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,17 +23,18 @@ env: | |
MYSQL_PASSWORD_B: 'test_password' | ||
|
||
jobs: | ||
|
||
api-breakage: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
if: ${{ github.event_name == 'pull_request' && !(github.event.pull_request.draft || false) }} | ||
runs-on: ubuntu-latest | ||
container: swift:5.9-jammy | ||
container: swift:jammy | ||
steps: | ||
- name: Check out code | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: { 'fetch-depth': 0 } | ||
- name: Run API breakage check action | ||
uses: vapor/ci/.github/actions/ci-swift-check-api-breakage@reusable-workflows | ||
- name: API breaking changes | ||
run: | | ||
git config --global --add safe.directory "${GITHUB_WORKSPACE}" | ||
swift package diagnose-api-breaking-changes origin/main | ||
dependents: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
|
@@ -53,13 +54,13 @@ jobs: | |
MYSQL_USER: test_username | ||
MYSQL_PASSWORD: test_password | ||
MYSQL_DATABASE: test_database | ||
container: swift:5.9-jammy | ||
container: swift:5.10-jammy | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dbimage: | ||
- mysql:5.7 | ||
- mysql:8.1 | ||
- mysql:8 | ||
- mariadb:11 | ||
- percona:8.0 | ||
steps: | ||
|
@@ -85,15 +86,15 @@ jobs: | |
dbimage: | ||
- mysql:5.7 | ||
- mysql:8.0 | ||
- mysql:8.1 | ||
- mysql:8.3 | ||
- mariadb:10.4 | ||
- mariadb:11 | ||
- percona:8.0 | ||
runner: | ||
# List is deliberately incomplete; we want to avoid running 50 jobs on every commit | ||
- swift:5.7-focal | ||
- swift:5.9-jammy | ||
- swiftlang/swift:nightly-5.10-jammy | ||
- swift:5.8-focal | ||
- swift:5.10-jammy | ||
- swiftlang/swift:nightly-6.0-jammy | ||
container: ${{ matrix.runner }} | ||
runs-on: ubuntu-latest | ||
services: | ||
|
@@ -105,43 +106,36 @@ jobs: | |
MYSQL_PASSWORD: test_password | ||
MYSQL_DATABASE: test_database | ||
steps: | ||
- name: Save MySQL version to env | ||
run: | | ||
echo MYSQL_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV | ||
- name: Display versions | ||
shell: bash | ||
run: | | ||
if [[ '${{ contains(matrix.container, 'nightly') }}' == 'true' ]]; then | ||
SWIFT_PLATFORM="$(source /etc/os-release && echo "${ID}${VERSION_ID}")" SWIFT_VERSION="$(cat /.swift_tag)" | ||
printf 'SWIFT_PLATFORM=%s\nSWIFT_VERSION=%s\n' "${SWIFT_PLATFORM}" "${SWIFT_VERSION}" >>"${GITHUB_ENV}" | ||
fi | ||
printf 'OS: %s\nTag: %s\nVersion:\n' "${SWIFT_PLATFORM}-${RUNNER_ARCH}" "${SWIFT_VERSION}" && swift --version | ||
- name: Check out package | ||
uses: actions/checkout@v4 | ||
- name: Run local tests with coverage and TSan | ||
run: swift test --enable-code-coverage --sanitize=thread | ||
- name: Submit coverage report to Codecov.io | ||
uses: vapor/[email protected] | ||
uses: vapor/[email protected] | ||
with: | ||
codecov_token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# Run unit tests (macOS). Don't bother with lots of variations, Linux will cover that. | ||
macos-unit: | ||
if: ${{ !(github.event.pull_request.draft || false) }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
formula: [ '[email protected]' ] | ||
macos: [ 'macos-13' ] | ||
xcode: [ 'latest-stable' ] | ||
runs-on: ${{ matrix.macos }} | ||
include: | ||
- macos-version: macos-13 | ||
xcode-version: '~14.3' | ||
- macos-version: macos-14 | ||
xcode-version: latest | ||
runs-on: ${{ matrix.macos-version }} | ||
steps: | ||
- name: Select latest available Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.xcode }} | ||
with: | ||
xcode-version: ${{ matrix.xcode-version }} | ||
- name: Install MySQL server from Homebrew | ||
run: brew install ${{ matrix.formula }} && brew link --force ${{ matrix.formula }} | ||
run: brew install mysql && brew link --force mysql | ||
- name: Start MySQL server | ||
run: brew services start ${{ matrix.formula }} | ||
run: brew services start mysql | ||
- name: Wait for MySQL server to be ready | ||
run: until echo | mysql -uroot; do sleep 1; done | ||
timeout-minutes: 5 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// swift-tools-version:5.9 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "mysql-kit", | ||
platforms: [ | ||
.macOS(.v10_15), | ||
.iOS(.v13), | ||
.watchOS(.v6), | ||
.tvOS(.v13), | ||
], | ||
products: [ | ||
.library(name: "MySQLKit", targets: ["MySQLKit"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/vapor/mysql-nio.git", from: "1.7.1"), | ||
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.29.2"), | ||
.package(url: "https://github.com/vapor/async-kit.git", from: "1.19.0"), | ||
.package(url: "https://github.com/apple/swift-crypto.git", "2.0.0" ..< "4.0.0"), | ||
.package(url: "https://github.com/apple/swift-nio.git", from: "2.64.0"), | ||
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.26.0"), | ||
], | ||
targets: [ | ||
.target( | ||
name: "MySQLKit", | ||
dependencies: [ | ||
.product(name: "AsyncKit", package: "async-kit"), | ||
.product(name: "MySQLNIO", package: "mysql-nio"), | ||
.product(name: "SQLKit", package: "sql-kit"), | ||
.product(name: "Crypto", package: "swift-crypto"), | ||
.product(name: "NIOFoundationCompat", package: "swift-nio"), | ||
.product(name: "NIOSSL", package: "swift-nio-ssl"), | ||
], | ||
swiftSettings: swiftSettings | ||
), | ||
.testTarget( | ||
name: "MySQLKitTests", | ||
dependencies: [ | ||
.product(name: "SQLKitBenchmark", package: "sql-kit"), | ||
.target(name: "MySQLKit"), | ||
], | ||
swiftSettings: swiftSettings | ||
), | ||
] | ||
) | ||
|
||
var swiftSettings: [SwiftSetting] { [ | ||
.enableUpcomingFeature("ExistentialAny"), | ||
.enableUpcomingFeature("ConciseMagicFile"), | ||
.enableUpcomingFeature("ForwardTrailingClosures"), | ||
.enableUpcomingFeature("DisableOutwardActorInference"), | ||
.enableExperimentalFeature("StrictConcurrency=complete"), | ||
] } |
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.