Skip to content

Commit f18af35

Browse files
Move Swift dev commands under root dev.yml (#36)
### What changes are you making? Move swift/dev.yml into namespaced commands at the repo root so`dev up` and `dev swift <cmd>` work from the monorepo root. Refs issue [#908](shop/issues-checkout-kit#908). React Native to follow upstack. ## How to test From the repo root: - `dev up` completes without error, including Mint bootstrap, Xcode 26.2, `Storefront.xcconfig`, and entitlements setup - `dev swift lint` runs `platforms/swift/Scripts/lint` - `dev swift style` still works as a legacy alias for `lint` - `dev swift format` runs `platforms/swift/Scripts/lint fix` - `dev swift fix` still works as a legacy alias for `format` - `dev swift build` builds the Swift package target - `dev swift build packages` builds the Swift package target - `dev swift build samples` builds the sample apps - `dev swift test` runs the full `ShopifyCheckoutKit-Package` test suite - `dev swift test <ClassName>` scopes the test run to one test class - `dev swift clean` cleans Swift package build artifacts - `dev swift check license-headers` checks Swift license headers --- ### Before you merge > [!IMPORTANT] > - [ ] I've added tests to support my implementation > - [ ] I have read and agree with the [Contribution Guidelines](./CONTRIBUTING.md) > - [ ] I have read and agree with the [Code of Conduct](./CODE_OF_CONDUCT.md) > - [ ] I've updated the relevant platform README (`swift/README.md` and/or `android/README.md`) --- <details> <summary>Releasing a new Swift version?</summary> - [ ] I have bumped the version in `swift/ShopifyCheckoutKit.podspec` - [ ] I have bumped the version in `swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift` - [ ] I have updated `swift/CHANGELOG.md` - [ ] I have updated the SwiftPM/CocoaPods version snippets in `swift/README.md` (major version only) </details> <details> <summary>Releasing a new Android version?</summary> - [ ] I have bumped the `versionName` in `android/lib/build.gradle` - [ ] I have updated `android/CHANGELOG.md` - [ ] I have updated the Gradle/Maven version snippets in `android/README.md` </details> > [!TIP] > See the [Contributing documentation](./CONTRIBUTING.md) for the full release process per platform.
1 parent e65ff86 commit f18af35

7 files changed

Lines changed: 86 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: 67 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"
@@ -25,6 +59,7 @@ check:
2559
android-license-headers: cd platforms/android && ./scripts/check_license_headers.rb
2660
android-detekt: cd platforms/android && ./gradlew detekt
2761
android-lint: cd platforms/android && ./gradlew lintRelease
62+
swift-lint: cd platforms/swift && ./Scripts/lint
2863

2964
commands:
3065
# Repo-wide
@@ -120,3 +155,35 @@ commands:
120155
android-lint:
121156
desc: Run Android lint
122157
run: cd platforms/android && ./gradlew lintRelease
158+
159+
# Swift
160+
swift:
161+
desc: "Swift Checkout Kit commands"
162+
subcommands:
163+
lint:
164+
desc: Check format and lint issues using SwiftLint and SwiftFormat
165+
aliases: [style]
166+
run: cd platforms/swift && ./Scripts/lint
167+
fix:
168+
desc: Automatically fix format and lint issues where possible
169+
run: cd platforms/swift && ./Scripts/lint fix
170+
build:
171+
desc: Build Swift packages or sample apps
172+
run: |
173+
echo "Usage: dev swift build {packages|samples}"
174+
subcommands:
175+
packages:
176+
desc: Build both ShopifyCheckoutKit and ShopifyAcceleratedCheckouts packages
177+
run: |
178+
cd platforms/swift
179+
./Scripts/xcode_run build ShopifyCheckoutKit
180+
./Scripts/xcode_run build ShopifyAcceleratedCheckouts
181+
samples:
182+
desc: Build all sample applications to verify integration
183+
run: cd platforms/swift && ./Scripts/build_samples
184+
test:
185+
desc: |
186+
`dev swift test` - Run all tests for the ShopifyCheckoutKit-Package.
187+
`dev swift test <test_class_name>` - Run only the specified test class.
188+
syntax: "[test_class_name]"
189+
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)