Skip to content

Commit 262e5cf

Browse files
authored
General cleanup (#330)
Bump Swift minimum to 5.10, update CI, update dependency requirements, update README and API docs, clean up tests
1 parent b5dee87 commit 262e5cf

File tree

9 files changed

+102
-123
lines changed

9 files changed

+102
-123
lines changed

.github/workflows/test.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88

99
env:
1010
LOG_LEVEL: info
11-
SWIFT_DETERMINISTIC_HASHING: 1
1211
MYSQL_HOSTNAME: 'mysql-a'
1312
MYSQL_HOSTNAME_A: 'mysql-a'
1413
MYSQL_HOSTNAME_B: 'mysql-b'
@@ -26,7 +25,7 @@ jobs:
2625
api-breakage:
2726
if: ${{ github.event_name == 'pull_request' && !(github.event.pull_request.draft || false) }}
2827
runs-on: ubuntu-latest
29-
container: swift:jammy
28+
container: swift:noble
3029
steps:
3130
- name: Checkout
3231
uses: actions/checkout@v4
@@ -54,13 +53,13 @@ jobs:
5453
MYSQL_USER: test_username
5554
MYSQL_PASSWORD: test_password
5655
MYSQL_DATABASE: test_database
57-
container: swift:5.10-jammy
56+
container: swift:6.1-noble
5857
strategy:
5958
fail-fast: false
6059
matrix:
6160
dbimage:
6261
- mysql:5.7
63-
- mysql:8
62+
- mysql:9
6463
- mariadb:11
6564
- percona:8.0
6665
steps:
@@ -86,15 +85,15 @@ jobs:
8685
dbimage:
8786
- mysql:5.7
8887
- mysql:8.0
89-
- mysql:8.3
88+
- mysql:9.3
9089
- mariadb:10.4
9190
- mariadb:11
9291
- percona:8.0
9392
runner:
9493
# List is deliberately incomplete; we want to avoid running 50 jobs on every commit
95-
- swift:5.8-focal
9694
- swift:5.10-jammy
97-
- swiftlang/swift:nightly-6.0-jammy
95+
- swift:6.0-noble
96+
- swift:6.1-noble
9897
container: ${{ matrix.runner }}
9998
runs-on: ubuntu-latest
10099
services:
@@ -122,10 +121,10 @@ jobs:
122121
fail-fast: false
123122
matrix:
124123
include:
125-
- macos-version: macos-13
126-
xcode-version: '~14.3'
127124
- macos-version: macos-14
128-
xcode-version: latest
125+
xcode-version: latest-stable
126+
- macos-version: macos-15
127+
xcode-version: latest-stable
129128
runs-on: ${{ matrix.macos-version }}
130129
steps:
131130
- name: Select latest available Xcode
@@ -148,6 +147,10 @@ jobs:
148147
SQL
149148
- name: Check out code
150149
uses: actions/checkout@v4
151-
- name: Run tests with Thread Sanitizer
152-
run: swift test --sanitize=thread
150+
- name: Run tests with code coverage
151+
run: swift test --enable-code-coverage
153152
env: { MYSQL_HOSTNAME: '127.0.0.1' }
153+
- name: Submit coverage report to Codecov.io
154+
uses: vapor/[email protected]
155+
with:
156+
codecov_token: ${{ secrets.CODECOV_TOKEN }}

Package.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:5.10
22
import PackageDescription
33

44
let package = Package(
@@ -13,12 +13,12 @@ let package = Package(
1313
.library(name: "MySQLKit", targets: ["MySQLKit"]),
1414
],
1515
dependencies: [
16-
.package(url: "https://github.com/vapor/mysql-nio.git", from: "1.7.2"),
17-
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.29.3"),
1816
.package(url: "https://github.com/vapor/async-kit.git", from: "1.20.0"),
17+
.package(url: "https://github.com/vapor/mysql-nio.git", from: "1.7.2"),
18+
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.33.0"),
1919
.package(url: "https://github.com/apple/swift-crypto.git", "2.0.0" ..< "4.0.0"),
20-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.65.0"),
21-
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.26.0"),
20+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.82.0"),
21+
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.30.0"),
2222
],
2323
targets: [
2424
.target(
@@ -45,6 +45,10 @@ let package = Package(
4545
)
4646

4747
var swiftSettings: [SwiftSetting] { [
48+
.enableUpcomingFeature("ExistentialAny"),
4849
.enableUpcomingFeature("ConciseMagicFile"),
4950
.enableUpcomingFeature("ForwardTrailingClosures"),
51+
.enableUpcomingFeature("DisableOutwardActorInference"),
52+
.enableUpcomingFeature("MemberImportVisibility"),
53+
.enableExperimentalFeature("StrictConcurrency=complete"),
5054
] }

[email protected]

Lines changed: 0 additions & 53 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<p align="center">
2-
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/vapor/mysql-kit/assets/1130717/d5582d0a-f8b2-4fab-aeea-79b170bebc28">
4-
<source media="(prefers-color-scheme: light)" srcset="https://github.com/vapor/mysql-kit/assets/1130717/71d0fa71-5ded-492c-9657-4206f233419e">
5-
<img src="https://github.com/vapor/mysql-kit/assets/1130717/71d0fa71-5ded-492c-9657-4206f233419e" height="96" alt="MySQLKit">
6-
</picture>
2+
<img src="https://design.vapor.codes/images/vapor-mysqlkit.svg" height="96" alt="MySQLKit">
73
<br>
84
<br>
95
<a href="https://docs.vapor.codes/4.0/"><img src="https://design.vapor.codes/images/readthedocs.svg" alt="Documentation"></a>
106
<a href="https://discord.gg/vapor"><img src="https://design.vapor.codes/images/discordchat.svg" alt="Team Chat"></a>
117
<a href="LICENSE"><img src="https://design.vapor.codes/images/mitlicense.svg" alt="MIT License"></a>
128
<a href="https://github.com/vapor/mysql-kit/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/vapor/mysql-kit/test.yml?event=push&style=plastic&logo=github&label=tests&logoColor=%23ccc" alt="Continuous Integration"></a>
139
<a href="https://codecov.io/github/vapor/mysql-kit"><img src="https://img.shields.io/codecov/c/github/vapor/mysql-kit?style=plastic&logo=codecov&label=codecov"></a>
14-
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift58up.svg" alt="Swift 5.8+"></a>
10+
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift510up.svg" alt="Swift 5.10+"></a>
1511
</p>
1612

1713
<br>
Lines changed: 36 additions & 13 deletions
Loading

Sources/MySQLKit/Docs.docc/theme-settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
"mysql-turquoise": "#02758f",
99
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-mysql-turquoise) 30%, #000 100%)",
1010
"documentation-intro-accent": "var(--color-mysql-turquoise)",
11+
"documentation-intro-eyebrow": "white",
12+
"documentation-intro-figure": "white",
13+
"documentation-intro-title": "white",
1114
"logo-base": { "dark": "#fff", "light": "#000" },
1215
"logo-shape": { "dark": "#000", "light": "#fff" },
1316
"fill": { "dark": "#000", "light": "#fff" }
1417
},
15-
"icons": { "technology": "/mysqlkit/images/vapor-mysqlkit-logo.svg" }
18+
"icons": { "technology": "/mysqlkit/images/MySQLKit/vapor-mysqlkit-logo.svg" }
1619
},
1720
"features": {
1821
"quickNavigation": { "enable": true },

Sources/MySQLKit/MySQLDatabase+SQL.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private struct MySQLSQLDatabase<D: MySQLDatabase>: SQLDatabase {
7979
}
8080

8181
// See `SQLDatabase.withSession(_:)`.
82-
func withSession<R>(_ closure: @escaping @Sendable (any SQLDatabase) async throws -> R) async throws -> R {
82+
func withSession<R: Sendable>(_ closure: @escaping @Sendable (any SQLDatabase) async throws -> R) async throws -> R {
8383
try await self.database.value.withConnection { c in
8484
let sqlDb = c.sql(encoder: self.encoder, decoder: self.decoder)
8585

Sources/MySQLKit/MySQLDialect.swift

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ public struct MySQLDialect: SQLDialect {
2929

3030
// See `SQLDialect.literalBoolean(_:)`.
3131
public func literalBoolean(_ value: Bool) -> any SQLExpression {
32-
switch value {
33-
case false:
34-
return SQLRaw("0")
35-
case true:
36-
return SQLRaw("1")
37-
}
32+
SQLRaw(value ? "1" : "0")
3833
}
3934

4035
// See `SQLDialect.autoIncrementClause`.
@@ -56,9 +51,9 @@ public struct MySQLDialect: SQLDialect {
5651
public func customDataType(for dataType: SQLDataType) -> (any SQLExpression)? {
5752
switch dataType {
5853
case .text:
59-
return SQLRaw("VARCHAR(255)")
54+
SQLRaw("VARCHAR(255)")
6055
default:
61-
return nil
56+
nil
6257
}
6358
}
6459

@@ -73,9 +68,9 @@ public struct MySQLDialect: SQLDialect {
7368
// See `SQLDialect.normalizeSQLConstraint(identifier:)`.
7469
public func normalizeSQLConstraint(identifier: any SQLExpression) -> any SQLExpression {
7570
if let sqlIdentifier = identifier as? SQLIdentifier {
76-
return SQLIdentifier(Insecure.SHA1.hash(data: Data(sqlIdentifier.string.utf8)).hexRepresentation)
71+
SQLIdentifier(Insecure.SHA1.hash(data: Data(sqlIdentifier.string.utf8)).hexRepresentation)
7772
} else {
78-
return identifier
73+
identifier
7974
}
8075
}
8176

0 commit comments

Comments
 (0)