Skip to content

Commit 11b5dd9

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

7 files changed

Lines changed: 87 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 `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/.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
```

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

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)