|
37 | 37 | run: swift build -c ${{ matrix.config }} |
38 | 38 | - name: Test |
39 | 39 | run: swift test -c ${{ matrix.config }} |
| 40 | + |
| 41 | + android: |
| 42 | + name: Android |
| 43 | + runs-on: macos-15 |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + config: ["debug", "release"] |
| 48 | + env: |
| 49 | + SWIFT_VERSION: "6.3.2" |
| 50 | + ANDROID_NDK_VERSION: "27.2.12479018" |
| 51 | + steps: |
| 52 | + - name: Checkout |
| 53 | + uses: actions/checkout@v4 |
| 54 | + - name: Install Swift |
| 55 | + run: | |
| 56 | + curl -O https://download.swift.org/swiftly/darwin/swiftly.pkg |
| 57 | + installer -pkg swiftly.pkg -target CurrentUserHomeDirectory |
| 58 | + ~/.swiftly/bin/swiftly init --assume-yes --skip-install |
| 59 | + echo "$HOME/.swiftly/bin" >> "$GITHUB_PATH" |
| 60 | + source ~/.swiftly/env.sh |
| 61 | + swiftly install ${{ env.SWIFT_VERSION }} |
| 62 | + swiftly use ${{ env.SWIFT_VERSION }} |
| 63 | + echo "$(swiftly use --print-location)/usr/bin" >> "$GITHUB_PATH" |
| 64 | + - name: Install Android NDK |
| 65 | + run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;${{ env.ANDROID_NDK_VERSION }}" |
| 66 | + - name: Install Swift SDK for Android |
| 67 | + run: | |
| 68 | + curl -L -o android-sdk.artifactbundle.tar.gz "https://download.swift.org/swift-${{ env.SWIFT_VERSION }}-release/android-sdk/swift-${{ env.SWIFT_VERSION }}-RELEASE/swift-${{ env.SWIFT_VERSION }}-RELEASE_android.artifactbundle.tar.gz" |
| 69 | + CHECKSUM=$(swift package compute-checksum android-sdk.artifactbundle.tar.gz) |
| 70 | + swift sdk install android-sdk.artifactbundle.tar.gz --checksum "$CHECKSUM" |
| 71 | + ANDROID_NDK_HOME="$ANDROID_HOME/ndk/${{ env.ANDROID_NDK_VERSION }}" \ |
| 72 | + bash "$HOME/Library/org.swift.swiftpm/swift-sdks/swift-${{ env.SWIFT_VERSION }}-RELEASE_android.artifactbundle/swift-android/scripts/setup-android-sdk.sh" |
| 73 | + - name: Build |
| 74 | + run: TARGET_OS_ANDROID=1 swift build --swift-sdk aarch64-unknown-linux-android28 -c ${{ matrix.config }} |
| 75 | + |
| 76 | + ios: |
| 77 | + name: iOS |
| 78 | + runs-on: macos-26 |
| 79 | + strategy: |
| 80 | + fail-fast: false |
| 81 | + matrix: |
| 82 | + config: ["debug", "release"] |
| 83 | + steps: |
| 84 | + - name: Checkout |
| 85 | + uses: actions/checkout@v4 |
| 86 | + - name: Select Simulator |
| 87 | + run: | |
| 88 | + DEVICE_ID=$(xcrun simctl list devices available -j | python3 -c "import json,sys; d=json.load(sys.stdin)['devices']; devices=[v for vs in d.values() for v in vs if 'iPhone' in v['name']]; print(devices[0]['udid'])") |
| 89 | + echo "DEVICE_ID=${DEVICE_ID}" >> "$GITHUB_ENV" |
| 90 | + - name: Build |
| 91 | + run: > |
| 92 | + xcodebuild build -scheme CoreModel-SQLite |
| 93 | + -destination "generic/platform=iOS" |
| 94 | + -configuration ${{ matrix.config == 'release' && 'Release' || 'Debug' }} |
| 95 | + -skipMacroValidation -skipPackagePluginValidation |
| 96 | + - name: Test |
| 97 | + run: > |
| 98 | + xcodebuild test -scheme CoreModel-SQLite |
| 99 | + -destination "id=${{ env.DEVICE_ID }}" |
| 100 | + -configuration ${{ matrix.config == 'release' && 'Release' || 'Debug' }} |
| 101 | + -skipMacroValidation -skipPackagePluginValidation |
| 102 | + ENABLE_TESTABILITY=YES |
| 103 | +
|
| 104 | + android-test: |
| 105 | + name: Android Test |
| 106 | + runs-on: ubuntu-latest |
| 107 | + steps: |
| 108 | + - name: Checkout |
| 109 | + uses: actions/checkout@v4 |
| 110 | + - name: Test on Android emulator |
| 111 | + uses: skiptools/swift-android-action@v2 |
| 112 | + with: |
| 113 | + swift-version: "6.3.2" |
| 114 | + android-api-level: 28 |
| 115 | + swift-configuration: debug |
| 116 | + free-disk-space: true |
| 117 | + run-tests: true |
0 commit comments