Skip to content

Android support #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/swift_package_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,42 @@ on:
type: boolean
description: "Boolean to enable running build in windows docker container. Defaults to true"
default: true
enable_android_checks:
type: boolean
description: "Boolean to enable android testing. Defaults to false"
default: false
android_copy_files:
type: string
description: "Additional files to copy to the Android emulator for testing"
default: ""
android_cores:
type: number
description: "Number of cores to use for the Android emulator"
default: 2
android_api_level:
type: number
description: "The API level of the Android emulator"
default: 30
android_channel:
type: string
description: "Android channel to download the SDK components from - stable, beta, dev, canary"
default: "canary"
android_profile:
type: string
description: "Android emulator hardware profile used for creating the AVD"
default: "pixel"
android_target:
type: string
description: "Target of the Android system image"
default: "aosp_atd"
android_test_env:
type: string
description: "Android emulator test environment variables key=value"
default: ""
android_exclude_swift_versions:
type: string
description: "Exclude Android Swift version list (JSON)"
default: "[{\"swift_version\": \"\"}]"
needs_token:
type: boolean
description: "Boolean to enable providing the GITHUB_TOKEN to downstream job."
Expand Down Expand Up @@ -187,3 +223,34 @@ jobs:
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
RefreshEnv
powershell.exe -NoLogo -File $env:TEMP\test-script\run.ps1; exit $LastExitCode

android-build:
name: Android (${{ matrix.swift_version }})
if: ${{ inputs.enable_android_checks }}
runs-on: 'ubuntu-24.04'
strategy:
fail-fast: false
matrix:
swift_version: ['nightly-6.1']
exclude:
- ${{ fromJson(inputs.android_exclude_swift_versions) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Provide token
if: ${{ inputs.needs_token }}
run: |
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Build / Test
uses: skiptools/swift-android-action@v2
with:
swift-version: ${{ matrix.swift_version }}
swift-build-flags: ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
copy-files: ${{ inputs.android_copy_files }}
test-env: ${{ inputs.android_test_env }}
android-cores: ${{ inputs.android_cores }}
android-api-level: ${{ inputs.android_api_level }}
android-channel: ${{ inputs.android_channel }}
android-profile: ${{ inputs.android_profile }}
android-target: ${{ inputs.android_target }}