Skip to content

Commit 4d5cd32

Browse files
committed
fix swift ci
1 parent 1e2908b commit 4d5cd32

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

.github/workflows/ci-swift.yml

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ permissions:
55
on:
66
push:
77
paths:
8-
- 'packages/contracts/**'
9-
- 'packages/sdk-platforms/rust/**'
10-
- 'packages/sdk-platforms/swift/**'
11-
- '.github/workflows/ci-swift.yml'
8+
- "packages/contracts/**"
9+
- "packages/sdk-platforms/rust/**"
10+
- "packages/sdk-platforms/swift/**"
11+
- ".github/workflows/ci-swift.yml"
1212
pull_request:
1313
paths:
14-
- 'packages/contracts/**'
15-
- 'packages/sdk-platforms/rust/**'
16-
- 'packages/sdk-platforms/swift/**'
17-
- '.github/workflows/ci-swift.yml'
14+
- "packages/contracts/**"
15+
- "packages/sdk-platforms/rust/**"
16+
- "packages/sdk-platforms/swift/**"
17+
- ".github/workflows/ci-swift.yml"
1818

1919
jobs:
2020
swift-sdk:
@@ -28,7 +28,7 @@ jobs:
2828
- uses: actions/checkout@v4
2929
with:
3030
submodules: recursive
31-
31+
3232
- name: Run sccache-cache
3333
uses: mozilla-actions/sccache-action@v0.0.4
3434

@@ -83,22 +83,45 @@ jobs:
8383
- name: Select Xcode 16.3
8484
run: sudo xcode-select -s /Applications/Xcode_16.3.app
8585

86+
- name: Install iOS Simulator Runtime
87+
run: |
88+
# List available runtimes
89+
echo "Available runtimes:"
90+
xcrun simctl runtime list
91+
# Check what iOS runtimes are available with Xcode 16.3
92+
# Download and install iOS 18 runtime if not available
93+
xcodebuild -downloadPlatform iOS || true
94+
8695
- name: Select Simulator
8796
run: |
88-
UDID=$(xcrun simctl list devices | awk '/-- iOS 18.4 --/{flag=1; next} /--/{flag=0} flag' | grep "iPhone 16 Pro" | awk -F '[()]' '{print $2}' | head -1)
97+
# List available simulators and boot one
98+
xcrun simctl list devices available
99+
100+
# Get any available iPhone simulator (preferably newer models)
101+
UDID=$(xcrun simctl list devices available | grep -E "iPhone (1[6-9]|[2-9][0-9])" | head -1 | grep -o '[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}')
102+
if [ -z "$UDID" ]; then
103+
echo "No suitable iPhone simulator found!" >&2
104+
# Fallback: try to get any iPhone simulator
105+
UDID=$(xcrun simctl list devices available | grep "iPhone" | head -1 | grep -o '[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}')
106+
fi
89107
if [ -z "$UDID" ]; then
90-
echo "Simulator not found!" >&2
108+
echo "No iPhone simulator found at all!" >&2
91109
exit 1
92110
fi
93111
echo "Simulator UDID: $UDID"
112+
113+
# Boot the simulator
114+
xcrun simctl boot "$UDID" || echo "Simulator may already be booted"
115+
sleep 3
116+
94117
echo "SIMULATOR_UDID=$UDID" >> $GITHUB_ENV
95-
118+
96119
- name: Install swiftformat
97120
run: brew install swiftformat
98121

99122
- name: Build bindings
100123
run: sh packages/sdk-platforms/rust/zksync-sso/crates/ffi/build-swift-framework-ios-ci.sh
101-
124+
102125
- name: Build & test Swift SDK
103126
run: |
104127
xcodebuild test \

0 commit comments

Comments
 (0)