Skip to content

Commit 6ef92c6

Browse files
authored
Merge pull request #29 from PerfectlySoft/declare-ios
Declare iOS 15 and add CI
2 parents 2cf1f92 + cb9c514 commit 6ef92c6

5 files changed

Lines changed: 101 additions & 9 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
linux:
12+
name: Linux (Swift ${{ matrix.swift }}, ${{ matrix.configuration }})
13+
runs-on: ubuntu-24.04
14+
container: swift:${{ matrix.swift }}-noble
15+
timeout-minutes: 30
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
# The oldest supported Swift (swift-tools-version 6.2) and the newest.
20+
swift: ["6.2", "6.4"]
21+
configuration: [debug, release]
22+
steps:
23+
- uses: actions/checkout@v7
24+
25+
- name: Install SQLite
26+
run: |
27+
apt-get update
28+
apt-get install -y --no-install-recommends pkg-config libsqlite3-dev
29+
30+
- name: Toolchain
31+
run: swift --version
32+
33+
- name: Build (warnings are errors)
34+
run: |
35+
flags="-c ${{ matrix.configuration }} -Xswiftc -warnings-as-errors"
36+
# @testable imports need testing enabled in an optimized build.
37+
[ "${{ matrix.configuration }}" = release ] && flags="$flags -Xswiftc -enable-testing"
38+
echo "FLAGS=$flags" >> "$GITHUB_ENV"
39+
swift build --build-tests $flags
40+
41+
- name: Test
42+
run: swift test $FLAGS
43+
44+
macos:
45+
name: macOS (Xcode ${{ matrix.xcode }}, ${{ matrix.configuration }})
46+
runs-on: macos-26
47+
timeout-minutes: 30
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
# The oldest Xcode with Swift 6.2, and the runner's default.
52+
xcode: ["26.0.1", "26.6"]
53+
configuration: [debug, release]
54+
steps:
55+
- uses: actions/checkout@v7
56+
57+
- name: Select Xcode
58+
run: |
59+
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
60+
swift --version
61+
62+
- name: Build (warnings are errors)
63+
run: |
64+
flags="-c ${{ matrix.configuration }} -Xswiftc -warnings-as-errors"
65+
# @testable imports need testing enabled in an optimized build.
66+
[ "${{ matrix.configuration }}" = release ] && flags="$flags -Xswiftc -enable-testing"
67+
echo "FLAGS=$flags" >> "$GITHUB_ENV"
68+
swift build --build-tests $flags
69+
70+
- name: Test
71+
run: swift test $FLAGS
72+
73+
ios:
74+
name: iOS Simulator
75+
runs-on: macos-26
76+
timeout-minutes: 30
77+
steps:
78+
- uses: actions/checkout@v7
79+
80+
- name: Select Xcode
81+
run: |
82+
sudo xcode-select -s /Applications/Xcode_26.6.app
83+
xcodebuild -version
84+
85+
# The test target builds at the package's iOS 15 deployment target, so this also
86+
# catches APIs that need a newer iOS. No SWIFT_TREAT_WARNINGS_AS_ERRORS: Xcode builds the
87+
# Perfect-CRUD dependency with warnings suppressed, and the two flags conflict. The macOS
88+
# and Linux jobs check warnings.
89+
- name: Test
90+
run: |
91+
xcodebuild test -scheme PerfectSQLite \
92+
-destination 'platform=iOS Simulator,name=iPhone 17,OS=latest'

‎Package.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PackageDescription
33

44
let package = Package(
55
name: "PerfectSQLite",
6-
platforms: [.macOS(.v12)],
6+
platforms: [.macOS(.v12), .iOS(.v15)],
77
products: [
88
.library(name: "PerfectSQLite", targets: ["PerfectSQLite"]),
99
],

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<img src="https://img.shields.io/badge/Swift-6.2-orange.svg?style=flat" alt="Swift 6.2">
66
</a>
77
<a href="#building">
8-
<img src="https://img.shields.io/badge/Platforms-macOS%2012%2B%20%7C%20Linux-lightgray.svg?style=flat" alt="Platforms macOS 12+ | Linux">
8+
<img src="https://img.shields.io/badge/Platforms-macOS%2012%2B%20%7C%20iOS%2015%2B%20%7C%20Linux-lightgray.svg?style=flat" alt="Platforms macOS 12+ | iOS 15+ | Linux">
99
</a>
1010
<a href="./LICENSE" target="_blank">
1111
<img src="https://img.shields.io/badge/License-Apache-lightgrey.svg?style=flat" alt="License Apache">
@@ -14,7 +14,7 @@
1414

1515
This project provides a Swift wrapper around the SQLite 3 C library, plus a [Perfect-CRUD](https://github.com/PerfectlySoft/Perfect-CRUD) database driver built on top of it.
1616

17-
**Modernized for Swift 6.** Requires **swift-tools-version 6.2** and builds under full **Swift 6 language mode** (strict concurrency checking on for both the library and test targets). Supports **macOS 12+** (`platforms: [.macOS(.v12)]`) and **Linux** (tested with Swift 6.2.4, 6.3.2 and 6.4 on Ubuntu 24.04). iOS/tvOS/watchOS aren't declared or tested.
17+
**Modernized for Swift 6.** Requires **swift-tools-version 6.2** and builds under full **Swift 6 language mode** (strict concurrency checking on for both the library and test targets). Supports **macOS 12+** and **iOS 15+** (`platforms: [.macOS(.v12), .iOS(.v15)]`) and **Linux** (tested with Swift 6.2.4, 6.3.2 and 6.4 on Ubuntu 24.04). CI runs the tests on Linux (Swift 6.2 and 6.4), macOS (Xcode 26.0.1 and 26.6) and the iOS Simulator. tvOS/watchOS/visionOS aren't declared or tested.
1818

1919
The pre-Swift-6 version of this package is preserved on the [`legacy`](../../tree/legacy) branch.
2020

@@ -57,7 +57,7 @@ dependencies: [
5757

5858
and add `"PerfectSQLite"` to your target's `dependencies` array. You need the Swift 6.2 toolchain (or newer).
5959

60-
- **macOS:** SQLite ships with the macOS 12+ SDK; nothing else to install. If the build fails on `PerfectCSQLite` (`no such module 'PerfectCSQLite'` or `unable to resolve module dependency: 'PerfectCSQLite'`), the SDK's `SQLite3` module wasn't found: check the selected toolchain and SDK (`xcode-select -p`, `xcrun --show-sdk-path`).
60+
- **macOS / iOS:** SQLite ships with the macOS 12+ and iOS 15+ SDKs; nothing else to install. If the build fails on `PerfectCSQLite` (`no such module 'PerfectCSQLite'` or `unable to resolve module dependency: 'PerfectCSQLite'`), the SDK's `SQLite3` module wasn't found: check the selected toolchain and SDK (`xcode-select -p`, `xcrun --show-sdk-path`).
6161
- **Linux:** install the SQLite development package (`sqlite-devel` on Fedora/RHEL), e.g. on Debian/Ubuntu:
6262

6363
```bash

‎Tests/PerfectSQLiteTests/PerfectSQLiteTests.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ func getDB(reset: Bool = true) throws -> Database<DBConfiguration> {
5252
func getTestDB() throws -> Database<DBConfiguration> {
5353
let db = try getDB()
5454
try db.create(TestTable1.self, policy: .dropTable)
55-
try db.transaction {
55+
_ = try db.transaction {
5656
try db.table(TestTable1.self).insert((1...5).map { num -> TestTable1 in
5757
let n = UInt8(num)
5858
let blob: [UInt8]? = (num % 2 != 0) ? nil : [UInt8](arrayLiteral: n+1, n+2, n+3, n+4, n+5)
5959
return TestTable1(id: num, name: "This is name bind \(num)", integer: num, double: Double(num), blob: blob)
6060
})
6161
}
62-
try db.transaction {
62+
_ = try db.transaction {
6363
try db.table(TestTable2.self).insert((1...5).flatMap { parentId -> [TestTable2] in
6464
(1...5).map { num -> TestTable2 in
6565
let n = UInt8(num)
@@ -326,7 +326,7 @@ func getDB(reset: Bool = true) throws -> Database<DBConfiguration> {
326326
@Test func selfJoin() throws {
327327
struct Me: Codable { let id: Int; let parentId: Int; let mes: [Me]?; init(id i: Int, parentId p: Int) { id = i; parentId = p; mes = nil } }
328328
let db = try getTestDB()
329-
try db.transaction {
329+
_ = try db.transaction {
330330
try db.create(Me.self, policy: .dropTable)
331331
.insert([Me(id: 1, parentId: 0), Me(id: 2, parentId: 1),
332332
Me(id: 3, parentId: 1), Me(id: 4, parentId: 1), Me(id: 5, parentId: 1)])

‎Tests/PerfectSQLiteTests/ReconcileTableTests.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ extension PerfectSQLiteTests {
181181
#expect(try columnNames(db, of: TestTable1.tableName).contains("int"))
182182
#expect(try db.table(TestTable2.self).count() == 25)
183183
// A table nothing references can still be rebuilt in one.
184-
try db.transaction {
184+
_ = try db.transaction {
185185
try db.create(ReducedTestTable2.self, policy: [.reconcileTable, .shallow])
186186
}
187187
let childTable = TestTable2.CRUDTableName
@@ -206,7 +206,7 @@ extension PerfectSQLiteTests {
206206
foreignKeysOn = stmt.columnInt(position: 0)
207207
}
208208
#expect(foreignKeysOn == 1)
209-
try db.transaction {
209+
_ = try db.transaction {
210210
try db.table(TestTable1.self).where(\TestTable1.id == 3).delete()
211211
}
212212
#expect(try db.table(TestTable2.self).count() == 20)

0 commit comments

Comments
 (0)