-
Notifications
You must be signed in to change notification settings - Fork 145
382 lines (374 loc) · 17.1 KB
/
test-objc.yaml
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
name: ObjCThemis
on:
pull_request:
paths:
- '.github/workflows/test-objc.yaml'
- 'docs/examples/objc/**'
- 'docs/examples/swift/**'
- 'src/soter/**'
- 'src/themis/**'
- 'src/wrappers/themis/Obj-C/**'
- 'tests/objcthemis/**'
- 'Themis.xcodeproj/**'
- 'third_party/boringssl/src/**'
- '**/Cartfile*'
- '**/Podfile*'
- '**/*.podspec'
- '!**/README*'
push:
branches:
- master
- stable
- release/*
schedule:
- cron: '20 6 * * 1' # every Monday at 6:20 UTC
env:
WITH_FATAL_WARNINGS: yes
# See here for what devices are available:
# https://github.com/actions/virtual-environments/blob/master/images/macos/
TEST_IPHONE: iPhone 8
TEST_IPAD: iPad Pro (9.7-inch)
# Most of our tests and examples are actually Xcode projects which integrate
# Themis via a dependency manager (Carthage, CocoaPods). This means that they
# depend on the current stable version, and that's what they will pull in.
#
# However, most of the time we want to build against the HEAD being tested.
# Pristine source should be built only for stable release branches.
#
# Each job has a "Hack dependencies" step which will retarget dependencies
# to the current git HEAD. These steps are enabled if HACK_DEPENDENCIES is
# set to "true". Note that you need to perform the check in a silly way:
#
# if: contains(env.HACK_DEPENDENCIES, 'true')
#
# because JavaScript^W of how substitutions in GitHub Actions work.
HACK_DEPENDENCIES: >
${{
github.event_name != 'release'
&& github.ref != 'refs/heads/stable'
&& !startsWith(github.ref, 'refs/heads/release/')
&& !startsWith(github.ref, 'refs/tags/')
}}
# When building pull requests GitHub uses an internal ref in the *base repo*,
# making it inaccessible to dumb tools. Use these variables that point to PRs
# head, not the result of merge with base.
HACK_REPOSITORY: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
HACK_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#xcode
DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer
jobs:
unit-tests-cocoapods:
name: Unit tests (CocoaPods)
runs-on: macos-12
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Hack dependencies
if: contains(env.HACK_DEPENDENCIES, 'true')
run: |
# CocoaPods
find tests/objcthemis -type f -name Podfile.lock -delete
find tests/objcthemis -type f -name Podfile -print0 | xargs -0 \
sed -E -i '' \
-e "s|(pod 'themis.*').*|\1, :git => \"https://github.com/${HACK_REPOSITORY}.git\", :commit => \"$HACK_SHA\"|"
- name: Update CocoaPods repo
run: |
pod repo update
- name: Install Themis via CocoaPods
run: |
cd $GITHUB_WORKSPACE/tests/objcthemis
pod install
- name: Run unit tests (iOS Simulator, OpenSSL)
if: always()
run: |
cd $GITHUB_WORKSPACE/tests/objcthemis
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-workspace objcthemis.xcworkspace \
-scheme "objthemis" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=${TEST_IPHONE}" \
test
unit-tests-carthage:
name: Unit tests (Carthage)
runs-on: macos-12
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out code
uses: actions/checkout@v2
# Work around Carthage braindeath and let it focus on building the project
# that actually matters not a gazillion of examples with SPM dependencies.
# If these issues get resolved, they might contain a better way:
# https://github.com/Carthage/Carthage/issues/3148
# https://github.com/Carthage/Carthage/issues/1227
- name: Remove Carthage distractions
run: |
rm -rf docs/examples/objc
rm -rf docs/examples/swift
rm -rf tests/objcthemis/objcthemis.xcworkspace
rm -rf tests/objcthemis/objcthemis.xcodeproj
- name: Pull Carthage dependencies
run: |
carthage bootstrap --use-xcframeworks
- name: Build Carthage projects
run: |
carthage build --no-skip-current --use-xcframeworks
- name: Run unit tests (Swift 4, macOS)
if: always()
run: |
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project Themis.xcodeproj \
-scheme "Test Themis (Swift 4, macOS)" \
test
- name: Run unit tests (Swift 5, macOS)
if: always()
run: |
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project Themis.xcodeproj \
-scheme "Test Themis (Swift 5, macOS)" \
test
- name: Run unit tests (Swift 4, iOS Simulator)
if: always()
run: |
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project Themis.xcodeproj \
-scheme "Test Themis (Swift 4, iOS)" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=${TEST_IPAD}" \
test
- name: Run unit tests (Swift 5, iOS Simulator)
if: always()
run: |
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project Themis.xcodeproj \
-scheme "Test Themis (Swift 5, iOS)" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=${TEST_IPHONE}" \
test
project-carthage:
name: Carthage project
runs-on: macos-12
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out code
uses: actions/checkout@v2
# Work around Carthage braindeath and let it focus on building the project
# that actually matters not a gazillion of examples with SPM dependencies.
# If these issues get resolved, they might contain a better way:
# https://github.com/Carthage/Carthage/issues/3148
# https://github.com/Carthage/Carthage/issues/1227
- name: Remove Carthage distractions
run: |
rm -rf docs/examples/objc
rm -rf docs/examples/swift
rm -rf tests/objcthemis/objcthemis.xcworkspace
rm -rf tests/objcthemis/objcthemis.xcodeproj
- name: Pull Carthage dependencies
run: |
carthage bootstrap --use-xcframeworks
- name: Build Carthage projects
run: |
carthage build --no-skip-current --use-xcframeworks
project-cocoapods:
name: CocoaPods project
runs-on: macos-12
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Hack dependencies
if: contains(env.HACK_DEPENDENCIES, 'true')
run: |
# Use the current commit in CocoaPods podspec
sed -E -i '' \
-e "s|^([ ]*s\.source = ).*$|\1{ :git => \"https://github.com/${HACK_REPOSITORY}.git\", :commit => \"$HACK_SHA\" }|" \
themis.podspec
# Note that CocoaPods is *really* strict with versioning, does not
# allow modified podspec to be published, and issues a warning
# if the source is anything but a release tag. For regular builds
# we allow warnings with this extra flag:
echo "ALLOW_WARNINGS=--allow-warnings" >> "$GITHUB_ENV"
- name: Syntax check
run: pod spec lint $ALLOW_WARNINGS --quick
- name: Lint podspec
env:
# Always allow warnings in podspec, even for pristine release one.
# This is due to silly warnings produced by our glorious dependencies:
#
# - WARN | [themis/themis-openssl, themis/themis-openssl/core, themis/themis-openssl/objcwrapper, and more...] xcodebuild: GRKOpenSSLFramework/OpenSSL-iOS/bin/openssl.framework/Headers/ecdsa.h:295:14: warning: parameter 'flags' not found in the function declaration [-Wdocumentation]
# - NOTE | [themis/themis-openssl, themis/themis-openssl/core, themis/themis-openssl/objcwrapper, and more...] xcodebuild: GRKOpenSSLFramework/OpenSSL-iOS/bin/openssl.framework/Headers/ecdsa.h:295:14: note: did you mean 'name'?
# - WARN | [themis/themis-openssl, themis/themis-openssl/core, themis/themis-openssl/objcwrapper, and more...] xcodebuild: GRKOpenSSLFramework/OpenSSL-iOS/bin/openssl.framework/Headers/ecdsa.h:301:14: warning: parameter 'ecdsa_method' not found in the function declaration [-Wdocumentation]
# - WARN | [themis/themis-openssl, themis/themis-openssl/core, themis/themis-openssl/objcwrapper, and more...] xcodebuild: GRKOpenSSLFramework/OpenSSL-iOS/bin/openssl.framework/Headers/ecdsa.h:302:14: warning: parameter 'name' not found in the function declaration [-Wdocumentation]
# - WARN | [themis/themis-openssl, themis/themis-openssl/core, themis/themis-openssl/objcwrapper, and more...] xcodebuild: GRKOpenSSLFramework/OpenSSL-macOS/bin/openssl.framework/Headers/ecdsa.h:295:14: warning: parameter 'flags' not found in the function declaration [-Wdocumentation]
# - NOTE | [themis/themis-openssl, themis/themis-openssl/core, themis/themis-openssl/objcwrapper, and more...] xcodebuild: GRKOpenSSLFramework/OpenSSL-macOS/bin/openssl.framework/Headers/ecdsa.h:295:14: note: did you mean 'name'?
# - WARN | [themis/themis-openssl, themis/themis-openssl/core, themis/themis-openssl/objcwrapper, and more...] xcodebuild: GRKOpenSSLFramework/OpenSSL-macOS/bin/openssl.framework/Headers/ecdsa.h:301:14: warning: parameter 'ecdsa_method' not found in the function declaration [-Wdocumentation]
# - WARN | [themis/themis-openssl, themis/themis-openssl/core, themis/themis-openssl/objcwrapper, and more...] xcodebuild: GRKOpenSSLFramework/OpenSSL-macOS/bin/openssl.framework/Headers/ecdsa.h:302:14: warning: parameter 'name' not found in the function declaration [-Wdocumentation]
# - WARN | [themis/themis-boringssl, themis/themis-boringssl/core, themis/themis-boringssl/objcwrapper, and more...] xcodebuild: <module-includes>:1:1: warning: umbrella header for module 'openssl' does not include header '/third_party/fiat/internal.h' [-Wincomplete-umbrella]
# - WARN | [themis/themis-boringssl, themis/themis-boringssl/core, themis/themis-boringssl/objcwrapper, and more...] xcodebuild: <module-includes>:1:1: warning: umbrella header for module 'openssl' does not include header '/third_party/fiat/curve25519_tables.h' [-Wincomplete-umbrella]
#
# While -Wdocumentation is definitely not going to break anything,
# I wonder if -Wincomplete-umbrella for BoringSSL is risky. Though,
# we are not be exporting {Open,Boring}SSL API from Themis, so it's
# probably fine.
ALLOW_WARNINGS: --allow-warnings
run: pod spec lint $ALLOW_WARNINGS --verbose --fail-fast
examples:
name: Code examples
runs-on: macos-12
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Hack dependencies
if: contains(env.HACK_DEPENDENCIES, 'true')
run: |
# Carthage
find docs/examples -type f -name Cartfile.resolved -delete
find docs/examples -type f -name Cartfile -print0 | xargs -0 \
sed -E -i '' \
-e "s|github \"cossacklabs/themis\".*|github \"$HACK_REPOSITORY\" \"$HACK_SHA\"|"
# CocoaPods
find docs/examples -type f -name Podfile.lock -delete
find docs/examples -type f -name Podfile -print0 | xargs -0 \
sed -E -i '' \
-e "s|(pod 'themis(/[a-z-]*)*').*|\1, :git => \"https://github.com/${HACK_REPOSITORY}.git\", :commit => \"$HACK_SHA\"|"
- name: Update CocoaPods repo
run: |
pod repo update
# Try building Themis for all iOS device architectures. We do it here
# because CocoaPods does not allow to check that directly but with
# example projects it's more or less possible.
- name: Build ObjCThemis for Generic Device (Carthage)
if: always()
run: |
carthage bootstrap --platform iOS --use-xcframeworks
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project Themis.xcodeproj \
-scheme "Themis (iOS)" \
-sdk iphoneos \
-destination "generic/platform=iOS" \
build
- name: Build ObjCThemis for Generic Device (CocoaPods)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/objc/iOS-CocoaPods
pod install
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-workspace ThemisTest.xcworkspace \
-scheme "Pods-ThemisTest" \
-sdk iphoneos \
-destination "generic/platform=iOS" \
build
# Since all code examples are macOS/iOS applications, not command-line
# utilities, we only verify that they build. This is fine.
#
# App samples: Objective-C
#
- name: Build sample app (Objective-C, Carthage, iOS)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/objc/iOS-Carthage
carthage bootstrap --platform iOS --use-xcframeworks --no-build
find Carthage/Checkouts/themis -type d -name '*.xcodeproj' \
| grep -v 'Carthage/Checkouts/themis/Themis.xcodeproj' \
| xargs rm -rf
carthage build --platform iOS --use-xcframeworks
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project ThemisTest.xcodeproj \
-scheme "ThemisTest" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=${TEST_IPAD}" \
build
- name: Build sample app (Objective-C, Carthage, macOS)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/objc/macOS-Carthage
carthage bootstrap --platform macOS --use-xcframeworks --no-build
find Carthage/Checkouts/themis -type d -name '*.xcodeproj' \
| grep -v 'Carthage/Checkouts/themis/Themis.xcodeproj' \
| xargs rm -rf
carthage build --platform macOS --use-xcframeworks
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project ThemisTest.xcodeproj \
-scheme "ThemisTest" \
build
- name: Build sample app (Objective-C, CocoaPods, iOS)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/objc/iOS-CocoaPods
pod install
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-workspace ThemisTest.xcworkspace \
-scheme "ThemisTest" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=${TEST_IPHONE}" \
build
#
# App samples: Swift
#
- name: Build sample app (Swift, Carthage, iOS)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/swift/iOS-Carthage
carthage bootstrap --platform iOS --use-xcframeworks --no-build
find Carthage/Checkouts/themis -type d -name '*.xcodeproj' \
| grep -v 'Carthage/Checkouts/themis/Themis.xcodeproj' \
| xargs rm -rf
carthage build --platform iOS --use-xcframeworks
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project ThemisTest.xcodeproj \
-scheme "ThemisTest" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=${TEST_IPHONE}" \
build
- name: Build sample app (Swift, Carthage, macOS)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/swift/macOS-Carthage
carthage bootstrap --platform macOS --use-xcframeworks --no-build
find Carthage/Checkouts/themis -type d -name '*.xcodeproj' \
| grep -v 'Carthage/Checkouts/themis/Themis.xcodeproj' \
| xargs rm -rf
carthage build --platform macOS --use-xcframeworks
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-project ThemisTest.xcodeproj \
-scheme "ThemisTest" \
build
- name: Build sample app (Swift, CocoaPods, iOS)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/swift/iOS-CocoaPods
pod install
rm -rf DerivedData
xcodebuild \
-derivedDataPath DerivedData \
-workspace ThemisSwift.xcworkspace \
-scheme "ThemisSwift" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=${TEST_IPAD}" \
build