Skip to content

Commit 59bff45

Browse files
authored
Bump Swift minimum to 6.0 (#226)
* Bump Swift minimum to 6.0, update CI, convert tests to SwiftTesting * For some reason only 6.0 complains about non-public imports * Fix tests in 6.0 * Enable CI to specify environment more sparsely * Fix test
1 parent cd47a70 commit 59bff45

File tree

8 files changed

+321
-304
lines changed

8 files changed

+321
-304
lines changed

.github/workflows/api-docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
push:
44
branches:
55
- main
6+
permissions:
7+
contents: read
8+
id-token: write
69

710
jobs:
811
build-and-deploy:

.github/workflows/test.yml

Lines changed: 52 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ concurrency:
55
on:
66
pull_request: { types: [opened, reopened, synchronize, ready_for_review] }
77
push: { branches: [ main ] }
8-
8+
permissions:
9+
contents: read
910
env:
1011
LOG_LEVEL: info
11-
SWIFT_DETERMINISTIC_HASHING: 1
12-
POSTGRES_HOSTNAME: 'psql-a'
13-
POSTGRES_HOSTNAME_A: 'psql-a'
14-
POSTGRES_HOSTNAME_B: 'psql-b'
15-
POSTGRES_DB: 'test_database_a'
16-
POSTGRES_DB_A: 'test_database_a'
17-
POSTGRES_DB_B: 'test_database_b'
18-
POSTGRES_USER: 'test_username'
19-
POSTGRES_USER_A: 'test_username'
20-
POSTGRES_USER_B: 'test_username'
21-
POSTGRES_PASSWORD: 'test_password'
22-
POSTGRES_PASSWORD_A: 'test_password'
23-
POSTGRES_PASSWORD_B: 'test_password'
12+
POSTGRES_HOSTNAME_A: &postgres_host_a 'psql-a'
13+
POSTGRES_HOSTNAME_B: &postgres_host_b 'psql-b'
14+
POSTGRES_HOSTNAME: *postgres_host_a
15+
POSTGRES_DB_A: &postgres_db_a 'test_database_a'
16+
POSTGRES_DB_B: &postgres_db_b 'test_database_b'
17+
POSTGRES_DB: *postgres_db_a
18+
POSTGRES_USER_A: &postgres_user_a 'test_username'
19+
POSTGRES_USER_B: &postgres_user_b 'test_username'
20+
POSTGRES_USER: *postgres_user_a
21+
POSTGRES_PASSWORD_A: &postgres_pass_a 'test_password'
22+
POSTGRES_PASSWORD_B: &postgres_pass_b 'test_password'
23+
POSTGRES_PASSWORD: *postgres_pass_a
2424

2525
jobs:
2626
api-breakage:
@@ -42,35 +42,35 @@ jobs:
4242
fail-fast: false
4343
matrix:
4444
include:
45-
- postgres-image-a: 'postgres:12'
46-
postgres-image-b: 'postgres:13'
45+
- postgres-image-a: 'postgres:13'
46+
postgres-image-b: 'postgres:14'
4747
postgres-auth: 'trust'
48-
swift-image: 'swift:5.10-jammy'
49-
- postgres-image-a: 'postgres:14'
50-
postgres-image-b: 'postgres:15'
51-
postgres-auth: 'md5'
5248
swift-image: 'swift:6.0-noble'
53-
- postgres-image-a: 'postgres:16'
54-
postgres-image-b: 'postgres:17'
55-
postgres-auth: 'scram-sha-256'
49+
- postgres-image-a: 'postgres:15'
50+
postgres-image-b: 'postgres:16'
51+
postgres-auth: 'md5'
5652
swift-image: 'swift:6.1-noble'
53+
- postgres-image-a: 'postgres:17'
54+
postgres-image-b: 'postgres:18'
55+
postgres-auth: 'scram-sha-256'
56+
swift-image: 'swift:6.2-noble'
5757
container: ${{ matrix.swift-image }}
5858
runs-on: ubuntu-latest
5959
services:
60-
psql-a:
60+
*postgres_host_a:
6161
image: ${{ matrix.postgres-image-a }}
6262
env:
63-
POSTGRES_USER: 'test_username'
64-
POSTGRES_DB: 'test_database_a'
65-
POSTGRES_PASSWORD: 'test_password'
63+
POSTGRES_USER: *postgres_user_a
64+
POSTGRES_DB: *postgres_db_a
65+
POSTGRES_PASSWORD: *postgres_pass_a
6666
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
6767
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }}
68-
psql-b:
68+
*postgres_host_b:
6969
image: ${{ matrix.postgres-image-b }}
7070
env:
71-
POSTGRES_USER: 'test_username'
72-
POSTGRES_DB: 'test_database_b'
73-
POSTGRES_PASSWORD: 'test_password'
71+
POSTGRES_USER: *postgres_user_b
72+
POSTGRES_DB: *postgres_db_b
73+
POSTGRES_PASSWORD: *postgres_pass_b
7474
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
7575
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }}
7676
steps:
@@ -79,7 +79,7 @@ jobs:
7979
- name: Check out package
8080
uses: actions/checkout@v5
8181
- name: Run all tests
82-
run: swift test --enable-code-coverage
82+
run: swift test --enable-code-coverage --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable
8383
- name: Submit coverage report to Codecov.io
8484
uses: vapor/[email protected]
8585
with:
@@ -93,6 +93,8 @@ jobs:
9393
include:
9494
- macos-version: macos-15
9595
xcode-version: latest-stable
96+
- macos-version: macos-26
97+
xcode-version: latest-stable
9698
runs-on: ${{ matrix.macos-version }}
9799
env:
98100
LOG_LEVEL: debug
@@ -108,7 +110,7 @@ jobs:
108110
run: |
109111
brew upgrade || true
110112
export PATH="$(brew --prefix)/opt/postgresql@16/bin:$PATH" PGDATA=/tmp/vapor-postgres-test PGUSER="${POSTGRES_USER_A}"
111-
brew install postgresql@17 && brew link --force postgresql@17
113+
brew install postgresql@18 && brew link --force postgresql@18
112114
initdb --locale=C --auth-host "scram-sha-256" -U "${POSTGRES_USER_A}" --pwfile=<(echo "${POSTGRES_PASSWORD_A}")
113115
pg_ctl start --wait
114116
PGPASSWORD="${POSTGRES_PASSWORD_A}" createdb -w -O "${POSTGRES_USER_A}" "${POSTGRES_DB_A}"
@@ -119,4 +121,20 @@ jobs:
119121
- name: Checkout code
120122
uses: actions/checkout@v5
121123
- name: Run all tests
122-
run: swift test
124+
run: swift test --enable-code-coverage --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable
125+
- name: Submit coverage report to Codecov.io
126+
uses: vapor/[email protected]
127+
with:
128+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
129+
130+
musl:
131+
runs-on: ubuntu-latest
132+
container: swift:6.2-noble
133+
timeout-minutes: 30
134+
steps:
135+
- name: Check out code
136+
uses: actions/checkout@v5
137+
- name: Install SDK
138+
run: swift sdk install https://download.swift.org/swift-6.2-release/static-sdk/swift-6.2-RELEASE/swift-6.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz --checksum d2225840e592389ca517bbf71652f7003dbf45ac35d1e57d98b9250368769378
139+
- name: Build
140+
run: swift build --swift-sdk x86_64-swift-linux-musl

Package.swift

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

44
let package = Package(
@@ -14,7 +14,7 @@ let package = Package(
1414
],
1515
dependencies: [
1616
.package(url: "https://github.com/vapor/fluent-kit.git", from: "1.52.2"),
17-
.package(url: "https://github.com/vapor/postgres-kit.git", from: "2.14.0"),
17+
.package(url: "https://github.com/vapor/postgres-kit.git", from: "2.14.1"),
1818
.package(url: "https://github.com/vapor/async-kit.git", from: "1.21.0"),
1919
],
2020
targets: [
@@ -41,9 +41,9 @@ let package = Package(
4141

4242
var swiftSettings: [SwiftSetting] { [
4343
.enableUpcomingFeature("ExistentialAny"),
44+
//.enableUpcomingFeature("InternalImportsByDefault"),
4445
.enableUpcomingFeature("MemberImportVisibility"),
45-
.enableUpcomingFeature("ConciseMagicFile"),
46-
.enableUpcomingFeature("ForwardTrailingClosures"),
47-
.enableUpcomingFeature("DisableOutwardActorInference"),
48-
.enableExperimentalFeature("StrictConcurrency=complete"),
46+
.enableUpcomingFeature("InferIsolatedConformances"),
47+
//.enableUpcomingFeature("NonisolatedNonsendingByDefault"),
48+
.enableUpcomingFeature("ImmutableWeakCaptures"),
4949
] }

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<a href="https://discord.gg/vapor"><img src="https://design.vapor.codes/images/discordchat.svg" alt="Team Chat"></a>
77
<a href="LICENSE"><img src="https://design.vapor.codes/images/mitlicense.svg" alt="MIT License"></a>
88
<a href="https://github.com/vapor/fluent-postgres-driver/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/vapor/fluent-postgres-driver/test.yml?event=push&style=plastic&logo=github&label=tests&logoColor=%23ccc" alt="Continuous Integration"></a>
9-
<a href="https://codecov.io/github/vapor/fluent-postgres-driver"><img src="https://img.shields.io/codecov/c/github/vapor/fluent-postgres-driver?style=plastic&logo=codecov&label=codecov"></a>
10-
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift510up.svg" alt="Swift 5.10+"></a>
9+
<a href="https://codecov.io/github/vapor/fluent-postgres-driver"><img src="https://img.shields.io/codecov/c/github/vapor/fluent-postgres-driver?style=plastic&logo=codecov&label=codecov" alt="Code Coverage"></a>
10+
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift60up.svg" alt="Swift 6.0+"></a>
1111
</p>
1212

1313
<br>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"theme": {
3-
"aside": { "border-radius": "16px", "border-style": "double", "border-width": "3px" },
3+
"aside": { "border-radius": "16px", "border-width": "3px", "border-style": "double" },
44
"border-radius": "0",
55
"button": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
66
"code": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
77
"color": {
88
"fluentpsqldriver": "#336791",
99
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-fluentpsqldriver) 30%, #000 100%)",
1010
"documentation-intro-accent": "var(--color-fluentpsqldriver)",
11-
"documentation-intro-eyebrow": "white",
11+
"hero-eyebrow": "white",
1212
"documentation-intro-figure": "white",
13-
"documentation-intro-title": "white",
13+
"hero-title": "white",
1414
"logo-base": { "dark": "#fff", "light": "#000" },
1515
"logo-shape": { "dark": "#000", "light": "#fff" },
1616
"fill": { "dark": "#000", "light": "#fff" }

Sources/FluentPostgresDriver/PostgresError+Database.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,5 @@ extension PSQLError {
107107
}
108108
}
109109

110-
#if compiler(<6)
111-
extension PostgresError: DatabaseError {}
112-
extension PSQLError: DatabaseError {}
113-
#else
114110
extension PostgresError: @retroactive DatabaseError {}
115111
extension PSQLError: @retroactive DatabaseError {}
116-
#endif

0 commit comments

Comments
 (0)