Skip to content

Commit 0c8370e

Browse files
committed
Move Swift dev commands under root dev.yml
1 parent 6e8f971 commit 0c8370e

5 files changed

Lines changed: 74 additions & 76 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ When in doubt about whether we will be interested in including a new feature, pl
4747

4848
This project uses [Mint](https://github.com/yonaskolb/Mint) to manage Swift linting tools (SwiftLint and SwiftFormat) at pinned versions via `swift/Mintfile`. This ensures consistent formatting across all contributors and CI.
4949

50-
**Shopify employees** (from `swift/`):
50+
**Shopify employees** (from the repo root):
5151

5252
```bash
5353
dev up

dev.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,42 @@ up:
1616
([ -f "./android/samples/MobileBuyIntegration/.env" ] || exit 1)
1717
meet: cd android && ./scripts/setup_env.sh
1818

19+
# Swift
20+
- packages:
21+
- mint
22+
- xcbeautify
23+
- jq
24+
- custom:
25+
name: Bootstrap Mint packages
26+
met?: |
27+
set -e
28+
cd swift
29+
expected_swiftlint="$(sed -n 's#^realm/SwiftLint@##p' Mintfile)"
30+
expected_swiftformat="$(sed -n 's#^nicklockwood/SwiftFormat@##p' Mintfile)"
31+
swiftlint_bin="$(mint which swiftlint)"
32+
swiftformat_bin="$(mint which swiftformat)"
33+
test -n "$expected_swiftlint"
34+
test -n "$expected_swiftformat"
35+
test "$("$swiftlint_bin" version)" = "$expected_swiftlint"
36+
test "$("$swiftformat_bin" --version)" = "$expected_swiftformat"
37+
meet: cd swift && mint bootstrap
38+
- xcode:
39+
version: "26.2"
40+
runtimes:
41+
ios:
42+
- version: 23C54 # 26.2
43+
architecture_variant: arm64
44+
- custom:
45+
name: Ensure Storefront.xcconfig file
46+
met?: |
47+
([ -f "./swift/samples/MobileBuyIntegration/Storefront.xcconfig" ] || exit 1)
48+
meet: cd swift && ./scripts/ensure_storefront_config
49+
- custom:
50+
name: Setup entitlements
51+
met?: |
52+
([ -f "./swift/samples/MobileBuyIntegration/MobileBuyIntegration/MobileBuyIntegration.entitlements" ] || exit 1;)
53+
meet: cd swift && ./scripts/setup_entitlements
54+
1955
open:
2056
"GitHub": "https://github.com/Shopify/checkout-kit"
2157
"Issues": "https://github.com/Shopify/checkout-kit/issues"
@@ -115,3 +151,35 @@ commands:
115151
android-lint:
116152
desc: Run Android lint
117153
run: cd android && ./gradlew lintRelease
154+
155+
# Swift
156+
swift:
157+
desc: "Swift Checkout Kit commands"
158+
subcommands:
159+
lint:
160+
desc: Check format and lint issues using SwiftLint and SwiftFormat
161+
aliases: [style]
162+
run: cd swift && ./scripts/lint
163+
fix:
164+
desc: Automatically fix format and lint issues where possible
165+
run: cd swift && ./scripts/lint fix
166+
build:
167+
desc: Build Swift packages or sample apps
168+
run: |
169+
echo "Usage: dev swift build {packages|samples}"
170+
subcommands:
171+
packages:
172+
desc: Build both ShopifyCheckoutKit and ShopifyAcceleratedCheckouts packages
173+
run: |
174+
cd swift
175+
./scripts/xcode_run build ShopifyCheckoutKit
176+
./scripts/xcode_run build ShopifyAcceleratedCheckouts
177+
samples:
178+
desc: Build all sample applications to verify integration
179+
run: cd swift && ./scripts/build_samples
180+
test:
181+
desc: |
182+
`dev swift test` - Run all tests for the ShopifyCheckoutKit-Package.
183+
`dev swift test <test_class_name>` - Run only the specified test class.
184+
syntax: "[test_class_name]"
185+
run: cd swift && ./scripts/xcode_run test ShopifyCheckoutKit-Package "$1"

swift/Samples/MobileBuyIntegration/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ From the **repo root**:
123123
dev apollo codegen mobile-buy
124124
```
125125

126-
This reads the schema + your `.graphql` files and regenerates the Swift code in `Generated/`. The command also runs `dev fix` to auto-format the output.
126+
This reads the schema + your `.graphql` files and regenerates the Swift code in `Generated/`. The command also runs `dev swift fix` to auto-format the output.
127127

128128
### 5. Build and fix any issues
129129

@@ -138,9 +138,9 @@ All commands are run from the **repo root** (`checkout-kit/`):
138138
| `dev apollo download_schema mobile-buy` | Download the Storefront API schema for this sample app |
139139
| `dev apollo codegen mobile-buy` | Regenerate Swift types from `.graphql` files |
140140
| `dev apollo codegen all` | Regenerate for all sample apps |
141-
| `dev style` | Run SwiftLint + SwiftFormat checks |
142-
| `dev fix` | Auto-fix lint/format issues |
143-
| `dev build samples` | Build all sample apps |
141+
| `dev swift style` | Run SwiftLint + SwiftFormat checks |
142+
| `dev swift fix` | Auto-fix lint/format issues |
143+
| `dev swift build samples` | Build all sample apps |
144144

145145
## Key files
146146

swift/Scripts/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ print_linting_error() {
138138
echo "$tool_name detected issues that need to be fixed."
139139
if [[ "$MODE" == "check" ]]; then
140140
echo "🔧 How to fix:"
141-
echo " Shopify employee? Run 'dev fix' and resolve remaining issues"
141+
echo " Shopify employee? Run 'dev swift fix' and resolve remaining issues"
142142
echo " Not a Shopify employee? Run './Scripts/lint fix' and resolve remaining issues"
143143
else
144144
echo "🔧 These files will need to be fixed manually"

swift/dev.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)