-
Notifications
You must be signed in to change notification settings - Fork 246
200 lines (188 loc) · 7.3 KB
/
Copy pathchecks.yml
File metadata and controls
200 lines (188 loc) · 7.3 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Checks
on:
push:
branches: [ main, develop ]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
platform: iOS Simulator
device: iPhone 17 Pro
os: latest
arch: arm64
commit_sha: ${{ github.sha }}
DEVELOPER_DIR: /Applications/Xcode_26.4.app/Contents/Developer
jobs:
build:
name: Build
runs-on: macos-26
if: ${{ !github.event.pull_request.draft }}
timeout-minutes: 60
env:
scheme: Readium-Package
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
run: |
brew install xcodegen
# Preload the list of simulator for xcodebuild. The workflow is flaky without it.
xcrun simctl list
- name: Build
run: |
set -eo pipefail
xcodebuild build-for-testing -scheme "$scheme" -destination "platform=$platform,name=$device,OS=$os,arch=$arch" | xcbeautify --renderer github-actions
- name: Test
run: |
set -eo pipefail
xcodebuild test-without-building -scheme "$scheme" -destination "platform=$platform,name=$device,OS=$os,arch=$arch" | xcbeautify --renderer github-actions
- name: Print Swift package versions
run: |
jq -r '.pins[] | "\(.identity): \(.state.version)"' Package.resolved
# Runs the test suite under the Thread Sanitizer to validate the
# `@unchecked Sendable` and `nonisolated(unsafe)` sites at runtime.
# Only runs on pushes to main/develop to keep pull requests light.
test-tsan:
name: Test (Thread Sanitizer)
runs-on: macos-26
if: github.event_name == 'push'
timeout-minutes: 60
env:
scheme: Readium-Package
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
run: |
# Preload the list of simulator for xcodebuild. The workflow is flaky without it.
xcrun simctl list
- name: Test
run: |
set -eo pipefail
xcodebuild test -scheme "$scheme" -destination "platform=$platform,name=$device,OS=$os,arch=$arch" -enableThreadSanitizer YES | xcbeautify --renderer github-actions
lint:
name: Lint
runs-on: macos-26
if: ${{ !github.event.pull_request.draft }}
timeout-minutes: 60
env:
scripts: Sources/Navigator/EPUB/Scripts
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
package_json_file: Sources/Navigator/EPUB/Scripts/package.json
run_install: false
- name: Setup cache
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'pnpm'
cache-dependency-path: Sources/Navigator/EPUB/Scripts/pnpm-lock.yaml
- name: Install dependencies
run: pnpm --dir "$scripts" install --frozen-lockfile
- name: Lint
run: pnpm --dir "$scripts" run lint
- name: Check formatting
run: pnpm --dir "$scripts" run checkformat
- name: Check if bundled scripts are up-to-date
run: |
make scripts
git diff --exit-code --name-only Sources/Navigator/EPUB/Assets/Static/scripts/*.js
if git ls-files --others --exclude-standard Sources/Navigator/EPUB/Assets/Static/scripts/ | grep -q .; then echo "Untracked bundled scripts found. Run 'make scripts' and commit the result."; exit 1; fi
- name: Lint Swift formatting
run: make lint-format
- name: Check CocoaPods podspecs
run: |
# Check that the podspecs are up to date.
make podspecs
git diff --exit-code Support/CocoaPods/
if git ls-files --others --exclude-standard Support/CocoaPods/ | grep -q .; then echo "Untracked podspec files found. Run 'make podspecs' and commit the result."; exit 1; fi
int-dev:
name: Integration (Local)
runs-on: macos-26
if: ${{ !github.event.pull_request.draft }}
timeout-minutes: 60
environment:
name: LCP
deployment: false
env:
# Empty for pull requests opened from a fork: GitHub never passes secrets
# to `pull_request` runs from forks. The LCP steps are skipped in that
# case, and the projects are generated without LCP.
LCP_URL_SPM: ${{ secrets.LCP_URL_SPM }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
run: |
brew install xcodegen
# Preload the list of simulator for xcodebuild. The workflow is flaky without it.
xcrun simctl list
- name: Generate Playground project
run: make playground lcp="$LCP_URL_SPM"
- name: Build Playground
# Without the LCP secret we can't run the LCP tests, but we still check
# that the Playground compiles. With it, the test step below builds the
# Playground itself.
if: env.LCP_URL_SPM == ''
run: |
set -eo pipefail
xcodebuild build -scheme Playground -project Playground/Playground.xcodeproj -destination "platform=$platform,name=$device,OS=$os,arch=$arch" | xcbeautify --renderer github-actions
- name: Test LCP
if: env.LCP_URL_SPM != ''
run: |
set -eo pipefail
xcodebuild test -scheme Playground -project Playground/Playground.xcodeproj -destination "platform=$platform,name=$device,OS=$os,arch=$arch" -only-testing:ReadiumLCPTests | xcbeautify --renderer github-actions
- name: Generate TestApp project
working-directory: TestApp
run: make dev lcp="$LCP_URL_SPM"
- name: Build TestApp
working-directory: TestApp
run: |
set -eo pipefail
xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device,OS=$os,arch=$arch" | xcbeautify --renderer github-actions
int-spm:
name: Integration (Swift Package Manager)
runs-on: macos-26
if: ${{ !github.event.pull_request.draft }}
timeout-minutes: 60
defaults:
run:
working-directory: TestApp
environment:
name: LCP
deployment: false
env:
# See the note in the `int-dev` job: this is empty for pull requests
# opened from a fork, in which case the project is generated without LCP.
LCP_URL_SPM: ${{ secrets.LCP_URL_SPM }}
steps:
- name: Checkout
uses: actions/checkout@v6
# We can't use the current github.sha with pull_request event, because they will
# reference the merge commit which cannot be fetched with SPM.
- name: Set commit SHA
if: github.event_name == 'pull_request'
run: |
echo "commit_sha=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV"
- name: Install dependencies
run: |
brew install xcodegen
# Preload the list of simulator for xcodebuild. The workflow is flaky without it.
xcrun simctl list
- name: Generate project
env:
LCP_URL_SPM: ${{ secrets.LCP_URL_SPM }}
run: make spm lcp="$LCP_URL_SPM" commit="$commit_sha"
- name: Build
run: |
set -eo pipefail
xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device,OS=$os,arch=$arch" | xcbeautify --renderer github-actions