|
| 1 | +# NOTE: every job here fails on a clean checkout until PureSwift/AndroidBluetooth#4 is merged. |
| 2 | +# AndroidBluetooth requests the `AndroidManifest` product from `Android`, but it moved to |
| 3 | +# `swift-android-native` (PureSwift/Android#40), and SwiftPM validates the whole package graph even |
| 4 | +# for dependencies that are conditional on `.android`: |
| 5 | +# error: product 'AndroidManifest' required by package 'androidbluetooth' ... not found |
| 6 | +# That is a one-line manifest fix upstream, not a problem with this repo. |
| 7 | +name: CI |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [master] |
| 12 | + pull_request: |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + test: |
| 21 | + name: Test |
| 22 | + runs-on: macos-15 |
| 23 | + timeout-minutes: 45 |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 27 | + with: |
| 28 | + xcode-version: latest-stable |
| 29 | + - name: Build |
| 30 | + run: swift build --build-tests |
| 31 | + - name: Test |
| 32 | + run: swift test |
| 33 | + |
| 34 | + ios-archive: |
| 35 | + name: iOS Archive |
| 36 | + runs-on: macos-15 |
| 37 | + timeout-minutes: 60 |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 41 | + with: |
| 42 | + xcode-version: latest-stable |
| 43 | + |
| 44 | + # WasmKit declares `.treatAllWarnings(as: .error)` for Apple platforms, which conflicts with |
| 45 | + # the `-suppress-warnings` Xcode passes to package dependencies: |
| 46 | + # error: Conflicting options '-warnings-as-errors' and '-suppress-warnings' |
| 47 | + # The setting only reaches package targets from the command line, so it cannot live in the |
| 48 | + # xcconfig or the project. |
| 49 | + - name: Archive |
| 50 | + working-directory: Darwin |
| 51 | + run: | |
| 52 | + xcodebuild archive \ |
| 53 | + -project BluetoothExplorer.xcodeproj \ |
| 54 | + -scheme "BluetoothExplorer App" \ |
| 55 | + -destination 'generic/platform=iOS' \ |
| 56 | + -archivePath "$RUNNER_TEMP/BluetoothExplorer.xcarchive" \ |
| 57 | + -skipPackagePluginValidation \ |
| 58 | + -skipMacroValidation \ |
| 59 | + SWIFT_SUPPRESS_WARNINGS=NO \ |
| 60 | + CODE_SIGNING_ALLOWED=NO |
| 61 | +
|
| 62 | + - name: Verify archive contents |
| 63 | + run: | |
| 64 | + APP="$RUNNER_TEMP/BluetoothExplorer.xcarchive/Products/Applications/BluetoothExplorer.app" |
| 65 | + test -d "$APP" || { echo "::error::archive did not produce BluetoothExplorer.app"; exit 1; } |
| 66 | + # The bundled WASM parser plugins must ship inside the app. |
| 67 | + find "$APP" -name '*.wasm' -print | tee /tmp/wasm-list |
| 68 | + test -s /tmp/wasm-list || { echo "::error::no bundled .wasm plugins in the archive"; exit 1; } |
| 69 | +
|
| 70 | + - uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: ios-archive |
| 73 | + path: ${{ runner.temp }}/BluetoothExplorer.xcarchive |
| 74 | + retention-days: 14 |
| 75 | + |
| 76 | + android-package: |
| 77 | + name: Android Swift Package |
| 78 | + runs-on: macos-15 |
| 79 | + timeout-minutes: 60 |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 83 | + with: |
| 84 | + xcode-version: latest-stable |
| 85 | + |
| 86 | + - name: Install Swift Android SDK |
| 87 | + run: | |
| 88 | + brew install skiptools/skip/skip || (brew update && brew install skiptools/skip/skip) |
| 89 | + skip android sdk install --version 6.3.3 |
| 90 | +
|
| 91 | + # Only the plugin engine is built here. The full app does not yet cross-compile for Android: |
| 92 | + # AndroidBluetooth's `@JavaImplementation` macro generates invalid code for its scan callback, |
| 93 | + # and WasmKit's SystemExtras target does not compile against the Android sysroot |
| 94 | + # (`st_mode` is UInt32 there while swift-system's CInterop.Mode is UInt16). Neither is |
| 95 | + # reachable from this target. See Documentation/AndroidSwiftUIMigration.md. |
| 96 | + - name: Build plugin engine for Android |
| 97 | + run: swift build --swift-sdk swift-6.3.3-RELEASE_android --target BluetoothExplorerPluginEngine |
0 commit comments