Skip to content

Commit f1bee07

Browse files
authored
Merge pull request #1206 from stephencelis/macos-13
Run CI on macOS 13
2 parents d7fe449 + 6aab9fc commit f1bee07

27 files changed

+204
-150
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
name: Build and test
22
on: [push, pull_request]
33
env:
4-
IOS_SIMULATOR: iPhone 12
5-
IOS_VERSION: "15.2"
4+
IOS_SIMULATOR: "iPhone 14"
5+
IOS_VERSION: "16.2"
66
jobs:
77
build:
8-
runs-on: macos-11
8+
runs-on: macos-13
99
steps:
1010
- uses: actions/checkout@v2
11-
- name: Install
11+
- name: "Select Xcode"
12+
# Currently only works with Xcode 14.2:
13+
# https://github.com/CocoaPods/CocoaPods/issues/11839
1214
run: |
13-
gem update bundler
14-
gem install xcpretty --no-document
15-
brew update
16-
brew outdated carthage || brew upgrade carthage
17-
brew outdated swiftlint || brew upgrade swiftlint
15+
xcode-select -p
16+
sudo xcode-select -s /Applications/Xcode_14.2.app/Contents/Developer
1817
- name: "Lint"
1918
run: make lint
2019
- name: "Run tests (PACKAGE_MANAGER_COMMAND: test)"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ DerivedData
2222
# Carthage
2323
/Carthage/
2424

25+
# Makefile
26+
bin/
27+
2528
# Swift Package Manager
2629
.build
2730
Packages/
31+
.swiftpm/

.swiftlint.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
opt_in_rules:
2+
- shorthand_optional_binding
13
disabled_rules: # rule identifiers to exclude from running
24
- todo
35
- operator_whitespace
46
- large_tuple
57
- closure_parameter_position
68
- inclusive_language # sqlite_master etc.
9+
- blanket_disable_command
710
included: # paths to include during linting. `--path` is ignored if present. takes precendence over `excluded`.
811
- Sources
912
- Tests
@@ -26,8 +29,8 @@ identifier_name:
2629
- SQLITE_TRANSIENT
2730

2831
type_body_length:
29-
warning: 260
30-
error: 260
32+
warning: 350
33+
error: 350
3134

3235
function_body_length:
3336
warning: 60

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
0.15.0 (unreleased)
2+
========================================
3+
4+
* New minimum deployment targets: iOS/tvOS 11.0, watchOS 4.0
5+
16
0.14.1 (01-11-2022), [diff][diff-0.14.1]
27
========================================
38

Documentation/Index.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@
7777

7878
## Installation
7979

80-
> _Note:_ SQLite.swift requires Swift 5 (and
81-
> [Xcode 10.2](https://developer.apple.com/xcode/downloads/)) or greater.
82-
8380
### Swift Package Manager
8481

8582
The [Swift Package Manager][] is a tool for managing the distribution of
@@ -1142,11 +1139,11 @@ let query = managers
11421139
chain.with(chain, recursive: true, as: query)
11431140
// WITH RECURSIVE
11441141
// "chain" AS (
1145-
// SELECT * FROM "managers" WHERE "id" = 8
1146-
// UNION
1147-
// SELECT * from "chain"
1142+
// SELECT * FROM "managers" WHERE "id" = 8
1143+
// UNION
1144+
// SELECT * from "chain"
11481145
// JOIN "managers" ON "chain"."manager_id" = "managers"."id"
1149-
// )
1146+
// )
11501147
// SELECT * FROM "chain"
11511148
```
11521149
@@ -1156,7 +1153,7 @@ Column names and a materialization hint can optionally be provided.
11561153
// Add a "level" column to the query representing manager's position in the chain
11571154
let level = Expression<Int64>("level")
11581155

1159-
let queryWithLevel =
1156+
let queryWithLevel =
11601157
managers
11611158
.select(id, managerId, 0)
11621159
.where(id == 8)
@@ -1166,18 +1163,18 @@ let queryWithLevel =
11661163
.join(managers, on: chain[managerId] == managers[id])
11671164
)
11681165

1169-
chain.with(chain,
1170-
columns: [id, managerId, level],
1166+
chain.with(chain,
1167+
columns: [id, managerId, level],
11711168
recursive: true,
11721169
hint: .materialize,
11731170
as: queryWithLevel)
11741171
// WITH RECURSIVE
11751172
// "chain" ("id", "manager_id", "level") AS MATERIALIZED (
1176-
// SELECT ("id", "manager_id", 0) FROM "managers" WHERE "id" = 8
1177-
// UNION
1178-
// SELECT ("manager"."id", "manager"."manager_id", "level" + 1) FROM "chain"
1173+
// SELECT ("id", "manager_id", 0) FROM "managers" WHERE "id" = 8
1174+
// UNION
1175+
// SELECT ("manager"."id", "manager"."manager_id", "level" + 1) FROM "chain"
11791176
// JOIN "managers" ON "chain"."manager_id" = "managers"."id"
1180-
// )
1177+
// )
11811178
// SELECT * FROM "chain"
11821179
```
11831180

@@ -1266,7 +1263,7 @@ let count = try db.scalar(users.filter(name != nil).count)
12661263
We can upsert rows into a table by calling a [query’s](#queries) `upsert`
12671264
function with a list of [setters](#setters)—typically [typed column
12681265
expressions](#expressions) and values (which can also be expressions)—each
1269-
joined by the `<-` operator. Upserting is like inserting, except if there is a
1266+
joined by the `<-` operator. Upserting is like inserting, except if there is a
12701267
conflict on the specified column value, SQLite will perform an update on the row instead.
12711268

12721269
```swift
@@ -1957,7 +1954,7 @@ for row in stmt.bind(kUTTypeImage) { /* ... */ }
19571954
```
19581955

19591956
> _Note:_ Prepared queries can be reused, and long lived prepared queries should be `reset()` after each use. Otherwise, the transaction (either [implicit or explicit](https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions)) will be held open until the query is reset or finalized. This can affect performance. Statements are reset automatically during `deinit`.
1960-
>
1957+
>
19611958
> ```swift
19621959
> someObj.statement = try db.prepare("SELECT * FROM attachments WHERE typeConformsTo(UTI, ?)")
19631960
> for row in someObj.statement.bind(kUTTypeImage) { /* ... */ }
@@ -2134,7 +2131,7 @@ using the following functions.
21342131
}
21352132
}
21362133
```
2137-
2134+
21382135
- `run` prepares a single `Statement` object from a SQL string, optionally
21392136
binds values to it (using the statement’s `bind` function), executes,
21402137
and returns the statement.

Makefile

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,76 @@
1-
BUILD_TOOL = xcodebuild
1+
XCODEBUILD = xcodebuild
22
BUILD_SCHEME = SQLite Mac
3-
IOS_SIMULATOR = iPhone 12
4-
IOS_VERSION = 15.0
3+
IOS_SIMULATOR = iPhone 14
4+
IOS_VERSION = 16.4
5+
6+
# tool settings
7+
SWIFTLINT_VERSION=0.52.2
8+
SWIFTLINT=bin/swiftlint-$(SWIFTLINT_VERSION)
9+
SWIFTLINT_URL=https://github.com/realm/SwiftLint/releases/download/$(SWIFTLINT_VERSION)/portable_swiftlint.zip
10+
XCBEAUTIFY_VERSION=0.20.0
11+
XCBEAUTIFY=bin/xcbeautify-$(XCBEAUTIFY_VERSION)
12+
ifeq ($(shell uname), Linux)
13+
XCBEAUTIFY_PLATFORM=x86_64-unknown-linux-gnu.tar.xz
14+
else
15+
XCBEAUTIFY_PLATFORM=universal-apple-macosx.zip
16+
endif
17+
XCBEAUTIFY_URL=https://github.com/tuist/xcbeautify/releases/download/$(XCBEAUTIFY_VERSION)/xcbeautify-$(XCBEAUTIFY_VERSION)-$(XCBEAUTIFY_PLATFORM)
18+
CURL_OPTS=--fail --silent -L --retry 3
19+
520
ifeq ($(BUILD_SCHEME),SQLite iOS)
621
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)" -destination "platform=iOS Simulator,name=$(IOS_SIMULATOR),OS=$(IOS_VERSION)"
722
else
823
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)"
924
endif
1025

11-
XCPRETTY := $(shell command -v xcpretty)
12-
TEST_ACTIONS := clean build build-for-testing test-without-building
26+
test: $(XCBEAUTIFY)
27+
set -o pipefail; \
28+
$(XCODEBUILD) $(BUILD_ARGUMENTS) test | $(XCBEAUTIFY)
1329

14-
default: test
30+
build: $(XCBEAUTIFY)
31+
set -o pipefail; \
32+
$(XCODEBUILD) $(BUILD_ARGUMENTS) | $(XCBEAUTIFY)
1533

16-
build:
17-
$(BUILD_TOOL) $(BUILD_ARGUMENTS)
34+
lint: $(SWIFTLINT)
35+
$< --strict
1836

19-
lint:
20-
swiftlint --strict
21-
lint-fix:
22-
swiftlint lint fix
23-
24-
test:
25-
ifdef XCPRETTY
26-
@set -o pipefail && $(BUILD_TOOL) $(BUILD_ARGUMENTS) $(TEST_ACTIONS) | $(XCPRETTY) -c
27-
else
28-
$(BUILD_TOOL) $(BUILD_ARGUMENTS) $(TEST_ACTIONS)
29-
endif
37+
lint-fix: $(SWIFTLINT)
38+
$< lint fix
3039

3140
clean:
32-
$(BUILD_TOOL) $(BUILD_ARGUMENTS) clean
41+
$(XCODEBUILD) $(BUILD_ARGUMENTS) clean
3342

3443
repl:
35-
@$(BUILD_TOOL) $(BUILD_ARGUMENTS) -derivedDataPath $(TMPDIR)/SQLite.swift > /dev/null && \
36-
swift -F '$(TMPDIR)/SQLite.swift/Build/Products/Debug'
44+
@$(XCODEBUILD) $(BUILD_ARGUMENTS) -derivedDataPath $(TMPDIR)/SQLite.swift > /dev/null && \
45+
swift repl -F '$(TMPDIR)/SQLite.swift/Build/Products/Debug'
3746

3847
sloc:
39-
@zsh -c "grep -vE '^ *//|^$$' Sources/**/*.{swift,h,m} | wc -l"
48+
@zsh -c "grep -vE '^ *//|^$$' Sources/**/*.{swift,h} | wc -l"
49+
50+
$(SWIFTLINT):
51+
set -e ; \
52+
curl $(CURL_OPTS) $(SWIFTLINT_URL) -o swiftlint.zip; \
53+
unzip -o swiftlint.zip swiftlint; \
54+
mkdir -p bin; \
55+
mv swiftlint $@ && rm -f swiftlint.zip
56+
57+
$(XCBEAUTIFY):
58+
set -e; \
59+
FILE=$(XCBEAUTIFY_PLATFORM); \
60+
curl $(CURL_OPTS) $(XCBEAUTIFY_URL) -o $$FILE; \
61+
case "$${FILE#*.}" in \
62+
"zip") \
63+
unzip -o $$FILE xcbeautify; \
64+
;; \
65+
"tar.xz") \
66+
tar -xvf $$FILE xcbeautify; \
67+
;; \
68+
*) \
69+
echo "unknown extension $${FILE#*.}!"; \
70+
exit 1; \
71+
;; \
72+
esac; \
73+
mkdir -p bin; \
74+
mv xcbeautify $@ && rm -f $$FILE;
4075

4176
.PHONY: test clean repl sloc

Package.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// swift-tools-version:5.3
1+
// swift-tools-version:5.7
22
import PackageDescription
33

44
let package = Package(
55
name: "SQLite.swift",
66
platforms: [
7-
.iOS(.v9),
8-
.macOS(.v10_10),
9-
.watchOS(.v3),
10-
.tvOS(.v9)
7+
.iOS(.v11),
8+
.macOS(.v10_13),
9+
.watchOS(.v4),
10+
.tvOS(.v11)
1111
],
1212
products: [
1313
.library(

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ API.
9090
// Wrap everything in a do...catch to handle errors
9191
do {
9292
// ...
93-
93+
9494
let stmt = try db.prepare("INSERT INTO users (email) VALUES (?)")
9595
for email in ["betty@icloud.com", "cathy@icloud.com"] {
9696
try stmt.run(email)
@@ -119,9 +119,6 @@ interactively, from the Xcode project’s playground.
119119

120120
## Installation
121121

122-
> _Note:_ Version 0.11.6 and later requires Swift 5 (and [Xcode](https://developer.apple.com/xcode/downloads/) 10.2) or greater.
123-
> Version 0.11.5 requires Swift 4.2 (and [Xcode](https://developer.apple.com/xcode/downloads/) 10.1) or greater.
124-
125122
### Swift Package Manager
126123

127124
The [Swift Package Manager][] is a tool for managing the distribution of

SQLite.swift.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Pod::Spec.new do |s|
1818
s.default_subspec = 'standard'
1919
s.swift_versions = ['5']
2020

21-
ios_deployment_target = '9.0'
22-
tvos_deployment_target = '9.1'
23-
osx_deployment_target = '10.10'
24-
watchos_deployment_target = '3.0'
21+
ios_deployment_target = '11.0'
22+
tvos_deployment_target = '11.0'
23+
osx_deployment_target = '10.13'
24+
watchos_deployment_target = '4.0'
2525

2626
s.ios.deployment_target = ios_deployment_target
2727
s.tvos.deployment_target = tvos_deployment_target

0 commit comments

Comments
 (0)