diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index b61a8f3..b4734fc 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -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." @@ -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 }} +