Skip to content

Commit eaca02a

Browse files
committed
Add Windows and Android CI
Windows builds and runs the unit tests via compnerd/gha-setup-swift on windows-latest. Android cross-compiles and runs the unit tests on an x86_64 emulator via skiptools/swift-android-action, plus a separate armv7 cross-compile check using the swift.org Android SDK.
1 parent 2a2696f commit eaca02a

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Swift Android
2+
3+
on: [push]
4+
5+
jobs:
6+
android:
7+
name: Android (unit tests)
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
# Cross-compiles the package for Android and runs the XCTest suite on an
13+
# Android emulator (x86_64) provisioned by the action.
14+
- name: Build and test on Android emulator
15+
uses: skiptools/swift-android-action@v2
16+
with:
17+
swift-version: 6.3.3
18+
19+
android-armv7:
20+
name: Android (armv7 cross-compile)
21+
runs-on: ubuntu-latest
22+
container: swift:6.3.3
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
- name: Install dependencies
27+
run: apt-get update -y && apt-get install -y curl
28+
- name: Install Swift Android SDK
29+
# The Android SDK artifact bundle is only published for 6.3.3, and the
30+
# host toolchain must match the bundle version exactly (Swift's module
31+
# format isn't cross-patch-compatible) — hence the swift:6.3.3 container.
32+
run: |
33+
set -eux
34+
url="https://download.swift.org/swift-6.3.3-release/android-sdk/swift-6.3.3-RELEASE/swift-6.3.3-RELEASE_android.artifactbundle.tar.gz"
35+
curl -fsSL "$url" -o android.artifactbundle.tar.gz
36+
swift sdk install android.artifactbundle.tar.gz \
37+
--checksum d160cc3206dd1886dae3fef2337af5e25ec034692cd0ec225721c56cc69da7f5
38+
swift sdk list
39+
# armv7 can't run on the x86_64 emulator, so this is a cross-compile check
40+
# only. The armv7 SDK id is resolved from `swift sdk list` to avoid pinning
41+
# the exact API-level suffix in the target triple.
42+
- name: Build (armv7)
43+
run: |
44+
set -eux
45+
SDK=$(swift sdk list | grep -iE 'armv7|armeabi' | head -1)
46+
test -n "$SDK"
47+
swift build --swift-sdk "$SDK"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Swift Windows
2+
3+
on: [push]
4+
5+
jobs:
6+
windows:
7+
name: Windows
8+
runs-on: windows-latest
9+
steps:
10+
- uses: compnerd/gha-setup-swift@main
11+
with:
12+
branch: swift-6.3.3-release
13+
tag: 6.3.3-RELEASE
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Swift Version
17+
run: swift --version
18+
- name: Build
19+
run: swift build
20+
- name: Test
21+
run: swift test

0 commit comments

Comments
 (0)