Skip to content

Commit 31fba85

Browse files
committed
Move Swift dev commands under root dev.yml
1 parent 68173bf commit 31fba85

7 files changed

Lines changed: 85 additions & 89 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 `platforms/swift/Mintfile`. This ensures consistent formatting across all contributors and CI.
4949

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

5252
```bash
5353
dev up

dev.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ up:
44
- packages:
55
- quicktype
66
- rover
7+
- mint
8+
- xcbeautify
9+
- jq
710
- ruby
811
- custom:
912
name: Install bundle packages
@@ -16,6 +19,37 @@ up:
1619
([ -f "./platforms/android/samples/MobileBuyIntegration/.env" ] || exit 1)
1720
meet: cd platforms/android && ./scripts/setup_env.sh
1821

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

platforms/swift/.cursor/rules/swift-development.mdc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ alwaysApply: true
1616
## Verification Commands
1717

1818
### Check your work systematically:
19-
1. **Lint & Format** → `dev lint` (or `dev style`) - Checks for linting and stylistic errors
20-
2. **Build Issues** → `dev build` - Checks for compilation issues
21-
3. **Test Issues** → `dev test` - Checks for failing tests
19+
1. **Lint & Format** → `dev swift lint` (or `dev swift style`) - Checks for linting and stylistic errors
20+
2. **Build Issues** → `dev swift build` - Checks for compilation issues
21+
3. **Test Issues** → `dev swift test` - Checks for failing tests
2222

2323
### Available dev commands:
2424
**See `dev.yml` in project root for complete list of commands and descriptions.**
2525

2626
Key commands for verification:
27-
- `dev lint` (alias: `dev style`) - Check format & lint issues
28-
- `dev fix` - Auto-fix formatting and linting issues
29-
- `dev build packages` - Build both packages
30-
- `dev test packages` - Run all tests
27+
- `dev swift lint` (alias: `dev swift style`) - Check format & lint issues
28+
- `dev swift fix` - Auto-fix formatting and linting issues
29+
- `dev swift build packages` - Build both packages
30+
- `dev swift test` - Run all tests
3131

3232
## Concurrency Best Practices
3333

@@ -50,22 +50,22 @@ actor QueryCache {
5050
✅ DO: Run the appropriate dev command to verify
5151

5252
### After making changes:
53-
- ALWAYS run `dev fix && dev lint` to check your code is formatted and written in our style.
53+
- ALWAYS run `dev swift fix && dev swift lint` to check your code is formatted and written in our style.
5454

5555
## Example Workflow
5656

5757
```bash
5858
# Make your Swift changes...
5959

6060
# Fix any auto-fixable issues
61-
dev fix
61+
dev swift fix
6262

6363
# Check for any remaining lint issues
64-
dev lint
64+
dev swift lint
6565

6666
# Verify it compiles
67-
dev build
67+
dev swift build
6868

6969
# Run tests if needed
70-
dev test packages
70+
dev swift test
7171
```

platforms/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

platforms/swift/Scripts/apollo_codegen

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ case "$APP" in
5858
;;
5959
esac
6060

61-
/opt/dev/bin/dev fix
61+
/opt/dev/bin/dev swift fix

platforms/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"

platforms/swift/dev.yml

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

0 commit comments

Comments
 (0)