Skip to content

Add Android (aarch64) cross-compile support to SwiftTimecodeCore #1962

Add Android (aarch64) cross-compile support to SwiftTimecodeCore

Add Android (aarch64) cross-compile support to SwiftTimecodeCore #1962

Workflow file for this run

name: build
permissions:
contents: read
on:
push:
branches: [main, dev]
paths-ignore:
- 'Docs/**' # Docs folder in root of repo
- '**/*.md' # .md files anywhere in the repo
- '**/LICENSE' # LICENSE files anywhere in the repo
- '**/.gitignore' # .gitignore files anywhere in the repo
pull_request:
branches: [main]
paths-ignore:
- 'Docs/**' # Docs folder in root of repo
- '**/*.md' # .md files anywhere in the repo
- '**/LICENSE' # LICENSE files anywhere in the repo
- '**/.gitignore' # .gitignore files anywhere in the repo
workflow_dispatch:
schedule:
- cron: '40 11 * * *' # once a day @ 11:40am UTC (4:40am PST)
env:
SCHEME: swift-timecode
WORKSPACEPATH: .swiftpm/xcode/package.xcworkspace
jobs:
macOS:
name: Tests (macOS)
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build
run: xcodebuild build -skipMacroValidation -workspace "$WORKSPACEPATH" -scheme "$SCHEME" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Unit Tests
run: xcodebuild test -skipMacroValidation -workspace "$WORKSPACEPATH" -scheme "$SCHEME" -destination "platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
macOS-swift6-2:
name: Tests (macOS - Swift 6.2)
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Set Package to Swift 6.2
run: swift package tools-version --set "6.2"
- name: Build
run: xcodebuild build -skipMacroValidation -workspace "$WORKSPACEPATH" -scheme "$SCHEME" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Unit Tests
run: xcodebuild test -skipMacroValidation -workspace "$WORKSPACEPATH" -scheme "$SCHEME" -destination "platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
macCatalyst:
name: Tests (macCatalyst)
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build
run: xcodebuild build -skipMacroValidation -workspace "$WORKSPACEPATH" -scheme "$SCHEME" -destination "generic/platform=macOS,variant=Mac Catalyst" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Unit Tests
run: xcodebuild test -skipMacroValidation -workspace "$WORKSPACEPATH" -scheme "$SCHEME" -destination "platform=macOS,variant=Mac Catalyst" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
device-simulators:
name: Tests
runs-on: macos-latest
strategy:
matrix:
target: [iOS, tvOS, watchOS, visionOS]
continue-on-error: true
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Prepare Device Simulator
id: sim-setup
uses: orchetect/setup-xcode-simulator@v1
with:
refresh: true
download: true
scheme: ${{ env.SCHEME }}
target: ${{ matrix.target }}
- name: Build
run: xcodebuild build -skipMacroValidation -workspace "$WORKSPACEPATH" -scheme "$SCHEME" -destination "generic/platform=$PLATFORMSHORT" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
env:
PLATFORMSHORT: ${{ steps.sim-setup.outputs.platform-short }}
WORKSPACEPATH: ${{ steps.sim-setup.outputs.workspace-path }}
- name: Unit Tests
run: xcodebuild test -skipMacroValidation -workspace "$WORKSPACEPATH" -scheme "$SCHEME" -destination "platform=$PLATFORM,id=$ID" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
env:
ID: ${{ steps.sim-setup.outputs.id }}
PLATFORM: ${{ steps.sim-setup.outputs.platform }}
WORKSPACEPATH: ${{ steps.sim-setup.outputs.workspace-path }}
linux:
name: Tests (Linux)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- name: Build
run: swift build
- name: Unit Tests
run: swift test
android:
name: Build (Android)
runs-on: ubuntu-latest
timeout-minutes: 30
# Cross-compiles SwiftTimecodeCore for Android (aarch64) using the Swift.org Android SDK
# bundle. Requires the open-source Swift 6.3 toolchain (NOT Xcode's bundled Swift) and the
# Android Swift SDK artifact bundle, which provides the cross-compiled stdlib + Foundation
# for android28+. Tests are not executed (would require a device/emulator); the build alone
# is enough to catch missing canImport(Android) arms or unconditional Apple-only imports.
steps:
- uses: actions/checkout@main
- name: Install Swift 6.3 toolchain (open-source)
# Pinned to "6.3.0" rather than the floating "6.3" — the Android SDK artifactbundle
# (also pinned to 6.3-RELEASE) ships pre-built `.swiftmodule` files which can ONLY
# be loaded by the exact same compiler version. With "6.3" floating, swiftly picks
# up 6.3.1 once it's released, and CI breaks with:
# "module compiled with Swift 6.3 cannot be imported by the Swift 6.3.1 compiler"
# Bump this in lockstep when a 6.3.1 (or 6.4) Android SDK bundle is published.
uses: vapor/swiftly-action@v0.2
with:
toolchain: "6.3.0"
- name: Install Android Swift SDK
run: |
swift sdk install \
https://download.swift.org/swift-6.3-release/android-sdk/swift-6.3-RELEASE/swift-6.3-RELEASE_android.artifactbundle.tar.gz \
--checksum 2f2942c4bcea7965a08665206212c66991dabe23725aeec7c4365fc91acad088
- name: Build for Android (aarch64)
run: swift build --target SwiftTimecodeCore --swift-sdk aarch64-unknown-linux-android28