Merge branch 'main' into nftquest-authserver #1045
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Swift CI | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| paths: | |
| - "packages/contracts/**" | |
| - "packages/sdk-platforms/rust/**" | |
| - "packages/sdk-platforms/swift/**" | |
| - ".github/workflows/ci-swift.yml" | |
| pull_request: | |
| paths: | |
| - "packages/contracts/**" | |
| - "packages/sdk-platforms/rust/**" | |
| - "packages/sdk-platforms/swift/**" | |
| - ".github/workflows/ci-swift.yml" | |
| jobs: | |
| swift-sdk: | |
| name: Swift Package - latest | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| config: | |
| - debug | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@v0.0.4 | |
| - name: Install Rust | |
| run: | | |
| rustup update stable && rustup default stable | |
| - name: Install Anvil ZKsync Manually | |
| run: | | |
| SCRIPT_PATH=".github/workflows/scripts/install-anvil-zksync.sh" | |
| chmod +x "$SCRIPT_PATH" | |
| bash "$SCRIPT_PATH" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.11.0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/Iron | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install -r --frozen-lockfile | |
| - name: Install contract dependencies | |
| run: pnpm install -r --frozen-lockfile | |
| working-directory: packages/contracts | |
| - name: Build contracts | |
| run: pnpm build | |
| working-directory: packages/contracts | |
| - name: Start anvil-zksync node | |
| run: | | |
| anvil-zksync --cache=none run > anvil-zksync.log 2>&1 & | |
| # Wait a few seconds to ensure the node starts | |
| sleep 5 | |
| # Verify it's running | |
| if ! pgrep -f "anvil-zksync"; then | |
| echo "Error: anvil-zksync failed to start" | |
| cat anvil-zksync.log | |
| exit 1 | |
| fi | |
| - name: Deploy contracts and create Swift config | |
| run: cargo run --bin cli -- deploy-contracts | |
| working-directory: packages/sdk-platforms/rust/zksync-sso | |
| - name: Select Xcode 16.3 | |
| run: sudo xcode-select -s /Applications/Xcode_16.3.app | |
| - name: Create and Select Simulator | |
| run: | | |
| # List available runtimes before installation | |
| echo "Available runtimes before installation:" | |
| xcrun simctl list runtimes | |
| # Download iOS platform | |
| echo "Downloading iOS platform..." | |
| xcodebuild -downloadPlatform iOS | |
| # Wait for download to complete | |
| sleep 10 | |
| # List available runtimes after installation | |
| echo "Available runtimes after installation:" | |
| xcrun simctl list runtimes | |
| # Get the latest iOS runtime | |
| IOS_RUNTIME=$(xcrun simctl list runtimes | grep "iOS" | tail -1 | awk '{for(i=1;i<=NF;i++) if($i ~ /^com\.apple\.CoreSimulator\.SimRuntime/) print $i}' | tr -d ')') | |
| if [ -z "$IOS_RUNTIME" ]; then | |
| echo "ERROR: No iOS runtime found" | |
| xcrun simctl list runtimes | |
| exit 1 | |
| fi | |
| echo "Using iOS runtime: $IOS_RUNTIME" | |
| # List available device types | |
| echo "Available device types:" | |
| xcrun simctl list devicetypes | grep iPhone | |
| # Create a new iPhone simulator | |
| UDID=$(xcrun simctl create "iPhone-CI" "com.apple.CoreSimulator.SimDeviceType.iPhone-15" "$IOS_RUNTIME") | |
| echo "Created simulator with UDID: $UDID" | |
| # Boot the simulator | |
| xcrun simctl boot "$UDID" | |
| echo "Booted simulator" | |
| # Verify simulator is booted | |
| xcrun simctl list devices | grep "$UDID" | |
| # Wait for simulator to be ready | |
| sleep 5 | |
| echo "SIMULATOR_UDID=$UDID" >> $GITHUB_ENV | |
| - name: Install swiftformat | |
| run: brew install swiftformat | |
| - name: Build bindings | |
| run: sh packages/sdk-platforms/rust/zksync-sso/crates/ffi/build-swift-framework-ios-ci.sh | |
| - name: Build & test Swift SDK | |
| run: | | |
| xcodebuild test \ | |
| -skipMacroValidation \ | |
| -configuration debug \ | |
| -workspace .github/zksyncsso.xcworkspace \ | |
| -scheme zksyncsso \ | |
| -destination "platform=iOS Simulator,id=${{ env.SIMULATOR_UDID }}" || exit 1 | |
| - name: Run Swift Integration Tests | |
| run: | | |
| xcodebuild test \ | |
| -skipMacroValidation \ | |
| -configuration debug \ | |
| -workspace .github/zksyncssointegration.xcworkspace \ | |
| -scheme zksyncssointegration \ | |
| -destination "platform=iOS Simulator,id=${{ env.SIMULATOR_UDID }}" || exit 1 |