-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.yml
More file actions
486 lines (443 loc) · 17.2 KB
/
Copy pathdev.yml
File metadata and controls
486 lines (443 loc) · 17.2 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
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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
name: checkout-kit
up:
- packages:
- rover
- mint
- xcbeautify
- jq
- swiftlint
- swiftformat
- sccache
- ruby
- xcode:
version: "26.2"
runtimes:
ios:
- version: 23C54 # 26.2
architecture_variant: arm64
- node:
version: v22.14.0
package_manager: pnpm@10.33.1
packages:
- protocol
- platforms/react-native
- platforms/web
- custom:
name: Run Checkout Kit workspace setup
met?: ./scripts/setup_dev_workspace --check --skip-optional-prompts
meet: ./scripts/setup_dev_workspace --skip-optional-prompts
open:
"GitHub": "https://github.com/Shopify/checkout-kit"
"Issues": "https://github.com/Shopify/checkout-kit/issues"
"PRs": "https://github.com/Shopify/checkout-kit/pulls"
check:
storefront-env-tests: ./scripts/test_setup_storefront_env
android-detekt: cd platforms/android && ./gradlew detekt
android-lint: cd platforms/android && ./gradlew lintRelease
swift-lint: cd platforms/swift && ./Scripts/lint
react-native-lint-swift: cd platforms/react-native && ./scripts/lint_swift
react-native-lint-module: cd platforms/react-native && pnpm module lint
react-native-lint-sample: cd platforms/react-native && pnpm sample lint
web-lint: cd platforms/web && pnpm lint
web-test: cd platforms/web && pnpm test
commands:
# Repo-wide
build:
desc: Build all supported workspaces
run: |
set -e
/opt/dev/bin/dev android build
/opt/dev/bin/dev swift build
/opt/dev/bin/dev react-native build
/opt/dev/bin/dev web build
codegen:
desc: "Generate UCP models. Usage: dev codegen <kotlin|swift|typescript>"
syntax: "<kotlin|swift|typescript>"
run: |
case "$1" in
kotlin|swift|typescript|ts) ./protocol/scripts/generate_models.sh --lang "$1" ;;
*) echo "Usage: dev codegen <kotlin|swift|typescript>"; exit 1 ;;
esac
format:
desc: Auto-format and apply safe lint autocorrections across supported workspaces
aliases: [fix]
run: |
set -e
/opt/dev/bin/dev android format
/opt/dev/bin/dev swift format
/opt/dev/bin/dev react-native format
/opt/dev/bin/dev web format
lint:
desc: Run lint checks across supported workspaces
aliases: [style]
run: |
set -e
/opt/dev/bin/dev android lint
/opt/dev/bin/dev swift lint
/opt/dev/bin/dev react-native lint
/opt/dev/bin/dev web lint
test:
desc: Run tests across all supported workspaces
run: |
set -e
/opt/dev/bin/dev android test
/opt/dev/bin/dev swift test
/opt/dev/bin/dev react-native test
/opt/dev/bin/dev web test
apollo:
desc: "Apollo GraphQL schema and code generation commands"
subcommands:
download_schema:
desc: "Download GraphQL schema. Usage: dev apollo download_schema <android|swift> [accelerated|swift|all]"
syntax: "<android|swift> [accelerated|swift|all]"
run: |
case "$1" in
android) cd platforms/android && ./scripts/apollo_download_schema ;;
swift) shift; cd platforms/swift && ./Scripts/apollo_download_schema "$@" ;;
*) echo "Usage: dev apollo download_schema <android|swift> [accelerated|swift|all]"; exit 1 ;;
esac
codegen:
desc: "Generate Apollo models. Usage: dev apollo codegen <android|swift> [accelerated|swift|all]"
syntax: "<android|swift> [accelerated|swift|all]"
run: |
case "$1" in
android) cd platforms/android && ./scripts/apollo_codegen ;;
swift) shift; cd platforms/swift && ./Scripts/apollo_codegen "$@" ;;
*) echo "Usage: dev apollo codegen <android|swift> [accelerated|swift|all]"; exit 1 ;;
esac
# Protocol
protocol:
desc: "Checkout protocol commands"
subcommands:
build:
desc: Build the Swift protocol target
run: cd protocol/languages/swift && swift build
test:
desc: Run Swift protocol package tests
run: cd protocol/languages/swift && swift test
check:
desc: Build and test the Swift protocol package
run: |
set -e
/opt/dev/bin/dev protocol build
/opt/dev/bin/dev protocol test
check-upstream:
desc: Compare vendored UCP snapshot files against upstream
run: ./protocol/scripts/check_ucp_snapshot.sh "$@"
update-upstream:
desc: Update vendored UCP snapshot files from upstream
run: ./protocol/scripts/update_ucp_snapshot.sh "$@"
check-tools:
desc: Verify protocol codegen tools match protocol/package.json
run: ./protocol/scripts/check_codegen_tools.sh "$@"
# Android
android:
desc: "Android Checkout Kit commands"
subcommands:
build:
desc: Build the library
run: cd platforms/android && ./gradlew :lib:build
subcommands:
samples:
desc: Build all sample applications
run: cd platforms/android/samples/MobileBuyIntegration && ./gradlew build
test:
desc: Run all tests with clean build
run: cd platforms/android && ./gradlew clean test --console=plain
subcommands:
specific:
desc: Run specific test class
syntax: <TestClassName> (e.g. CheckoutBridgeTest)
run: cd platforms/android && ./gradlew :lib:testDebugUnitTest --tests "$1"
lint:
desc: Check code style and lint (detekt + Android lint)
aliases: [style]
run: cd platforms/android && ./gradlew detekt lintRelease
format:
desc: Auto-format and apply safe lint autocorrections
aliases: [fix]
run: cd platforms/android && ./gradlew detekt --auto-correct
check:
desc: Run all Android checks (detekt, Android lint)
run: |
set -e
/opt/dev/bin/dev android check detekt
/opt/dev/bin/dev android check android-lint
subcommands:
detekt:
desc: Run detekt static analysis
run: cd platforms/android && ./gradlew detekt
android-lint:
desc: Run Android lint
run: cd platforms/android && ./gradlew lintRelease
clean:
desc: Clean Android Gradle build outputs
run: cd platforms/android && ./gradlew clean
api:
desc: Validate or update the public API baseline (lib/api/lib.api)
run: |
echo "Usage: dev android api {check|dump}"
echo ""
echo " check Verify public API matches the committed baseline"
echo " dump Regenerate the baseline after intentional public API changes"
exit 1
subcommands:
check:
desc: Verify public API matches the committed baseline
run: cd platforms/android && ./gradlew :lib:apiCheck
dump:
desc: Regenerate the baseline after intentional public API changes
run: cd platforms/android && ./gradlew :lib:apiDump
# Swift
swift:
desc: "Swift Checkout Kit commands"
subcommands:
build:
desc: Build all Swift packages and sample apps
run: |
set -e
cd platforms/swift
# ShopifyCheckoutKit-Package builds every library target in
# Package.swift in one xcodebuild invocation. The sample apps act as
# integration compilation checks against the built libraries.
./Scripts/xcode_run build ShopifyCheckoutKit-Package
./Scripts/build_samples
subcommands:
packages:
desc: Build Swift package targets
run: cd platforms/swift && ./Scripts/xcode_run build ShopifyCheckoutKit-Package
samples:
desc: Build all sample applications to verify integration
run: cd platforms/swift && ./Scripts/build_samples
test:
desc: |
`dev swift test` - Run all tests for the ShopifyCheckoutKit-Package.
`dev swift test <test_class_name>` - Run only the specified test class.
syntax: "[test_class_name]"
run: cd platforms/swift && ./Scripts/xcode_run test ShopifyCheckoutKit-Package "$1"
api:
desc: Validate or update the public Swift API baseline (platforms/swift/api/*.json)
run: |
echo "Usage: dev swift api {check|dump}"
echo ""
echo " check Verify public Swift API matches the committed baselines"
echo " dump Regenerate the Swift API baselines after intentional public API changes"
exit 1
subcommands:
check:
desc: Verify public Swift API matches the committed baselines
run: cd platforms/swift && ./Scripts/api check
dump:
desc: Regenerate the Swift API baselines after intentional public API changes
run: cd platforms/swift && ./Scripts/api dump
lint:
desc: Check format and lint issues using SwiftLint and SwiftFormat
aliases: [style]
run: cd platforms/swift && ./Scripts/lint
format:
desc: Auto-format and apply safe lint autocorrections
aliases: [fix]
run: cd platforms/swift && ./Scripts/lint fix
check:
desc: Run Swift lint checks
run: /opt/dev/bin/dev swift lint
clean:
desc: Clean Swift packages and sample app build artifacts
run: |
set -e
cd platforms/swift
# ShopifyCheckoutKit-Package is the SPM-wide scheme: it cleans all
# library targets in Package.swift (ShopifyCheckoutKit,
# ShopifyAcceleratedCheckouts, ShopifyCheckoutProtocol) in one pass.
./Scripts/xcode_run clean ShopifyCheckoutKit-Package
cd Samples
# Sample apps have a "Run Script" build phase that runs during clean
# and exits non-zero when there is nothing to delete. Tolerate it so
# the second sample still gets cleaned.
../Scripts/xcode_run clean CheckoutKitSwiftDemo || true
../Scripts/xcode_run clean ShopifyAcceleratedCheckoutsApp || true
# React Native
react-native:
desc: "React Native Checkout Kit commands"
aliases: [rn]
subcommands:
build:
desc: Build the @shopify/checkout-kit-react-native module
run: cd platforms/react-native && pnpm module build
test:
desc: Run React Native module tests (JS + iOS + Android)
long_desc: |
Runs unit tests across all three React Native targets:
- JS: Jest tests in `platforms/react-native/modules/@shopify/checkout-kit-react-native/tests/`
- iOS: Swift Package tests at `platforms/react-native/modules/@shopify/checkout-kit-react-native/ios/`
- Android: Gradle JVM tests for `:shopify_checkout-kit-react-native` (requires a local Maven publish of `:lib`)
run: |
set -e
cd platforms/react-native && pnpm test
cd modules/@shopify/checkout-kit-react-native/ios && swift test
cd ../../../../
USE_LOCAL_SDK=1 ./scripts/publish_android_snapshot
cd sample/android && USE_LOCAL_SDK=1 ./gradlew :shopify_checkout-kit-react-native:test --refresh-dependencies
subcommands:
js:
desc: Run JS unit tests via jest
run: cd platforms/react-native && pnpm test
ios:
desc: Run native iOS unit tests (Swift Package at modules/.../ios)
run: cd platforms/react-native/modules/@shopify/checkout-kit-react-native/ios && swift test
android:
desc: Run native Android unit tests for the RN module (publishes/uses local platforms/android SDK)
run: |
set -e
cd platforms/react-native
USE_LOCAL_SDK=1 ./scripts/publish_android_snapshot
cd sample/android
USE_LOCAL_SDK=1 ./gradlew :shopify_checkout-kit-react-native:test --refresh-dependencies
lint:
desc: Run all React Native lint checks (Swift, module, sample)
aliases: [style]
run: |
set -e
cd platforms/react-native
./scripts/lint_swift
pnpm module lint
pnpm sample lint
subcommands:
swift:
desc: Lint Swift code via SwiftLint
run: cd platforms/react-native && ./scripts/lint_swift
module:
desc: Lint the @shopify/checkout-kit-react-native module
run: cd platforms/react-native && pnpm module lint
sample:
desc: Lint the sample app
run: cd platforms/react-native && pnpm sample lint
format:
desc: Auto-format and apply safe lint autocorrections (Swift bridge only)
aliases: [fix]
run: cd platforms/react-native && ./scripts/lint_swift fix
api:
desc: Validate or update the public React Native API baseline (api/checkout-kit-react-native.api.md)
run: |
echo "Usage: dev rn api {check|dump}"
echo ""
echo " check Verify public RN API matches the committed report"
echo " dump Regenerate the RN API report after intentional public API changes"
exit 1
subcommands:
check:
desc: Verify public RN API matches the committed report
run: cd platforms/react-native && pnpm module api:check
dump:
desc: Regenerate the RN API report after intentional public API changes
run: cd platforms/react-native && pnpm module api:dump
check:
desc: Run React Native lint checks
run: /opt/dev/bin/dev react-native lint
clean:
desc: Remove generated directories, clean CocoaPods cache, and stop sccache
run: |
cd platforms/react-native
if (cd sample/ios && bundle exec pod --version >/dev/null 2>&1); then
(cd sample/ios && bundle exec pod cache clean --all)
else
echo "Skipping CocoaPods cache clean (pod unavailable; run dev up first)"
fi
pnpm module clean
pnpm sample clean
pnpm clean
if command -v sccache >/dev/null 2>&1; then
sccache --stop-server 2>/dev/null || true
fi
echo "Cleaned root, module and sample workspaces"
server:
desc: Start Metro development server
aliases: [s]
run: cd platforms/react-native && pnpm sample start --reset-cache
ios:
desc: Run the iOS sample app in the simulator.
long_desc: |
Ensures CocoaPods are in sync, then builds and runs the iOS sample app on a simulator.
--local
Build against in-repo Swift SDK sources.
syntax:
optional: --local
run: cd platforms/react-native && pnpm sample ios "$@"
android:
desc: Run the Android sample app in the emulator.
long_desc: |
Builds and runs the Android sample app on an emulator.
--local
Build against in-repo SDK sources (publishes a local Maven snapshot first).
syntax:
optional: --local
run: cd platforms/react-native && pnpm sample android "$@"
pod-install:
desc: Install CocoaPods for the iOS sample.
long_desc: |
Runs pod install for the iOS sample app.
--local
Wire the Podfile against in-repo Swift SDK sources.
syntax:
optional: --local
run: cd platforms/react-native && pnpm run pod-install -- "$@"
rn:
desc: "Alias for React Native Checkout Kit commands"
long_desc: |
Alias for `dev react-native ...`. Use `dev help react-native` for the
full subcommand list.
syntax:
optional: "[command] [args]"
run: /opt/dev/bin/dev react-native "$@"
# Web
web:
desc: "Web Checkout Kit commands"
subcommands:
build:
desc: Build the @shopify/checkout-kit package
run: cd platforms/web && pnpm build
test:
desc: Run unit tests with coverage
run: cd platforms/web && pnpm test
subcommands:
watch:
desc: Run tests in watch mode
run: cd platforms/web && pnpm test:watch
lint:
desc: Run typecheck, oxlint, and format checks
aliases: [style]
run: cd platforms/web && pnpm lint
format:
desc: Auto-fix JS lint and formatting issues
aliases: [fix]
run: |
set -e
cd platforms/web
pnpm run lint:js:fix
pnpm run format
check:
desc: Run Web lint, unit tests, build, package verification, and sample build checks
run: |
set -e
/opt/dev/bin/dev web lint
/opt/dev/bin/dev web test
/opt/dev/bin/dev web build
/opt/dev/bin/dev web verify
/opt/dev/bin/dev web sample build
clean:
desc: Remove dist and coverage directories
run: cd platforms/web && pnpm clean
sample:
desc: Start the sample app dev server
aliases: [s]
run: cd platforms/web && pnpm sample
subcommands:
build:
desc: Build the sample app
run: cd platforms/web && pnpm sample:build
preview:
desc: Preview the built sample app
run: cd platforms/web && pnpm sample:preview
verify:
desc: Run Web package verification
run: cd platforms/web && pnpm verify