Repository navigation
113 lines (98 loc) · 3.72 KB
/
Copy pathci.yml
File metadata and controls
113 lines (98 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
linux:
name: Linux (Swift ${{ matrix.swift }}, ${{ matrix.configuration }})
runs-on: ubuntu-24.04
container: swift:${{ matrix.swift }}-noble
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# The oldest supported Swift (swift-tools-version 6.2) and the newest.
swift: ["6.2", "6.4"]
configuration: [debug, release]
steps:
- uses: actions/checkout@v7
- name: Install SQLite
run: |
apt-get update
apt-get install -y --no-install-recommends pkg-config libsqlite3-dev
- name: Toolchain
run: swift --version
- name: Build (warnings are errors)
run: |
flags="-c ${{ matrix.configuration }} -Xswiftc -warnings-as-errors"
# @testable imports need testing enabled in an optimized build.
[ "${{ matrix.configuration }}" = release ] && flags="$flags -Xswiftc -enable-testing"
echo "FLAGS=$flags" >> "$GITHUB_ENV"
swift build --build-tests $flags
- name: Test
run: swift test $FLAGS
macos:
name: macOS (Xcode ${{ matrix.xcode }}, ${{ matrix.configuration }})
runs-on: macos-26
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# The oldest Xcode with Swift 6.2, and the runner's default.
xcode: ["26.0.1", "26.6"]
configuration: [debug, release]
steps:
- uses: actions/checkout@v7
- name: Select Xcode
run: |
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
swift --version
- name: Build (warnings are errors)
run: |
flags="-c ${{ matrix.configuration }} -Xswiftc -warnings-as-errors"
# @testable imports need testing enabled in an optimized build.
[ "${{ matrix.configuration }}" = release ] && flags="$flags -Xswiftc -enable-testing"
echo "FLAGS=$flags" >> "$GITHUB_ENV"
swift build --build-tests $flags
- name: Test
run: swift test $FLAGS
ios:
name: iOS Simulator
runs-on: macos-26
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Select Xcode
run: |
sudo xcode-select -s /Applications/Xcode_26.6.app
xcodebuild -version
# On a fresh runner the simulator service can start late, and xcodebuild then lists no
# simulators at all ("Unable to find a device"). Wait until it offers the one we test on.
# Listing devices with simctl makes the service refresh its runtimes
# (actions/runner-images#12948).
- name: Wait for the simulator
run: |
deadline=$((SECONDS + 300))
while [ $SECONDS -lt $deadline ]; do
xcrun simctl list devices available > /dev/null 2>&1 || true
if destinations=$(xcodebuild -showdestinations -scheme PerfectSQLite) \
&& grep -q "name:iPhone 17 }" <<< "$destinations"; then
exit 0
fi
echo "No iPhone 17 simulator yet; retrying in 5 seconds"
sleep 5
done
echo "No iPhone 17 simulator after 5 minutes"
xcrun simctl list devices available
exit 1
# The test target builds at the package's iOS 15 deployment target, so this also
# catches APIs that need a newer iOS. No SWIFT_TREAT_WARNINGS_AS_ERRORS: Xcode builds the
# Perfect-CRUD dependency with warnings suppressed, and the two flags conflict. The macOS
# and Linux jobs check warnings.
- name: Test
run: |
xcodebuild test -scheme PerfectSQLite \
-destination 'platform=iOS Simulator,name=iPhone 17,OS=latest' \
-destination-timeout 120