|
50 | 50 | type: string |
51 | 51 | description: "Exclude Wasm Swift SDK version list (JSON)" |
52 | 52 | default: "[{\"swift_version\": \"\"}]" |
| 53 | + android_sdk_versions: |
| 54 | + type: string |
| 55 | + description: "Android Swift SDK version list (JSON)" |
| 56 | + default: "[\"nightly-main\", \"nightly-6.2\", \"6.2\"]" |
| 57 | + android_exclude_swift_versions: |
| 58 | + type: string |
| 59 | + description: "Exclude Android Swift SDK version list (JSON)" |
| 60 | + default: "[{\"swift_version\": \"\"}]" |
53 | 61 | windows_swift_versions: |
54 | 62 | type: string |
55 | 63 | description: "Include Windows Swift version list (JSON)" |
|
79 | 87 | type: string |
80 | 88 | description: "Linux command to execute before building the Swift package with the Embedded Swift SDK for Wasm" |
81 | 89 | default: "" |
| 90 | + android_sdk_pre_build_command: |
| 91 | + type: string |
| 92 | + description: "Linux command to execute before building the Swift package with the Embedded Swift SDK for Android" |
| 93 | + default: "" |
82 | 94 | macos_pre_build_command: |
83 | 95 | type: string |
84 | 96 | description: "macOS command to execute before building the Swift package" |
|
99 | 111 | type: string |
100 | 112 | description: "Command to use when building the package with the Swift SDK for Wasm" |
101 | 113 | default: "swift build" |
| 114 | + android_sdk_build_command: |
| 115 | + type: string |
| 116 | + description: "Command to use when building the package with the Swift SDK for Android" |
| 117 | + default: "swift build" |
102 | 118 | windows_pre_build_command: |
103 | 119 | type: string |
104 | 120 | description: "Windows Command Prompt command to execute before building the Swift package" |
|
135 | 151 | type: boolean |
136 | 152 | description: "Boolean to enable building with the Embedded Swift SDK for Wasm. Defaults to false" |
137 | 153 | default: false |
| 154 | + enable_android_sdk_build: |
| 155 | + type: boolean |
| 156 | + description: "Boolean to enable building with the Swift SDK for Android. Defaults to false" |
| 157 | + default: false |
138 | 158 | enable_macos_checks: |
139 | 159 | type: boolean |
140 | 160 | description: "Boolean to enable macOS testing. Defaults to false" |
@@ -355,6 +375,63 @@ jobs: |
355 | 375 | curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \ |
356 | 376 | bash -s -- --wasm --flags="$BUILD_FLAGS" --build-command="${{ inputs.wasm_sdk_build_command }}" ${{ matrix.swift_version }} |
357 | 377 |
|
| 378 | + android-sdk-build: |
| 379 | + name: Swift SDK for Android Build (${{ matrix.swift_version }} - ${{ matrix.os_version }}) |
| 380 | + if: ${{ inputs.enable_android_sdk_build }} |
| 381 | + runs-on: ubuntu-latest |
| 382 | + strategy: |
| 383 | + fail-fast: false |
| 384 | + matrix: |
| 385 | + swift_version: ${{ fromJson(inputs.android_sdk_versions) }} |
| 386 | + os_version: ${{ fromJson(inputs.linux_os_versions) }} |
| 387 | + exclude: |
| 388 | + - ${{ fromJson(inputs.android_exclude_swift_versions) }} |
| 389 | + container: |
| 390 | + image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }} |
| 391 | + steps: |
| 392 | + - name: Swift version |
| 393 | + run: swift --version |
| 394 | + - name: Clang version |
| 395 | + run: clang --version |
| 396 | + - name: Checkout repository |
| 397 | + uses: actions/checkout@v4 |
| 398 | + if: ${{ matrix.os_version != 'amazonlinux2' }} |
| 399 | + - name: Checkout repository |
| 400 | + uses: actions/checkout@v1 |
| 401 | + if: ${{ matrix.os_version == 'amazonlinux2' }} |
| 402 | + - name: Provide token |
| 403 | + if: ${{ inputs.needs_token }} |
| 404 | + run: | |
| 405 | + echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV |
| 406 | + - name: Set environment variables |
| 407 | + if: ${{ inputs.linux_env_vars }} |
| 408 | + run: | |
| 409 | + for i in "${{ inputs.linux_env_vars }}" |
| 410 | + do |
| 411 | + printf "%s\n" $i >> $GITHUB_ENV |
| 412 | + done |
| 413 | + - name: Pre-build |
| 414 | + run: ${{ inputs.linux_pre_build_command }} |
| 415 | + - name: Install Swift SDK for Android and build |
| 416 | + env: |
| 417 | + BUILD_FLAGS: ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }} |
| 418 | + run: | |
| 419 | + ${{ inputs.android_sdk_pre_build_command }} |
| 420 | + if command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy, focal |
| 421 | + apt-get -q update && apt-get -yq install curl |
| 422 | + elif command -v dnf >/dev/null 2>&1 ; then # rhel-ubi9 |
| 423 | + dnf -y update |
| 424 | + dnf -y install curl-minimal |
| 425 | + elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2 |
| 426 | + yum -y update |
| 427 | + yum -y install curl |
| 428 | + else |
| 429 | + echo "Unknown package manager (tried apt-get, dnf, yum)" >&2 |
| 430 | + exit 1 |
| 431 | + fi |
| 432 | + curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \ |
| 433 | + bash -s -- --android --flags="$BUILD_FLAGS" --build-command="${{ inputs.android_sdk_build_command }}" ${{ matrix.swift_version }} |
| 434 | +
|
358 | 435 | embedded-wasm-sdk-build: |
359 | 436 | name: Embedded Swift SDK for Wasm Build (${{ matrix.swift_version }} - ${{ matrix.os_version }}) |
360 | 437 | if: ${{ inputs.enable_embedded_wasm_sdk_build }} |
|
0 commit comments