Skip to content

Commit c883157

Browse files
committed
Set ANDROID_NDK_HOME instead of ANDROID_NDK_ROOT; permit ndk-version=latest to use ANDROID_NDK_LATEST_HOME
1 parent 5ef48fa commit c883157

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

.github/workflows/test-action.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
os: ['ubuntu-24.04', 'ubuntu-22.04', 'macos-13', 'macos-15']
1414
#swift-version: ['6.0', '6.1']
1515
swift-version: ['6.0', '6.1', '6.1.1', 'nightly-6.2']
16-
ndk-version: ['27', '28']
16+
ndk-version: ['27', 'latest']
1717
steps:
1818
- name: Checkout Action
1919
uses: actions/checkout@v4
@@ -40,6 +40,19 @@ jobs:
4040
copy-files: Tests
4141
test-env: TEST_WORKSPACE=1
4242

43+
- name: Checkout apple/swift-system
44+
uses: actions/checkout@v4
45+
with:
46+
repository: apple/swift-system
47+
path: apple/swift-system
48+
- name: Test apple/swift-system
49+
uses: ./swift-android-action/
50+
with:
51+
package-path: apple/swift-system
52+
swift-version: ${{ matrix.swift-version }}
53+
ndk-version: ${{ matrix.ndk-version }}
54+
run-tests: ${{ matrix.os != 'macos-15' }} # no tests on macOS ARM
55+
4356
- name: Checkout skiptools/swift-android-native
4457
uses: actions/checkout@v4
4558
with:
@@ -69,19 +82,19 @@ jobs:
6982
- name: Setup Toolchain
7083
id: setup-toolchain
7184
uses: ./swift-android-action/
72-
#uses: skiptools/swift-android-action@v2
85+
#uses: swift-android-sdk/swift-android-action@v2
7386
with:
7487
# just set up the toolchain and don't build anything
7588
build-package: false
7689
swift-version: ${{ matrix.swift-version }}
7790
ndk-version: ${{ matrix.ndk-version }}
78-
- name: Checkout apple/swift-numerics
91+
- name: Checkout apple/swift-algorithms
7992
uses: actions/checkout@v4
8093
with:
81-
repository: apple/swift-numerics
82-
path: apple/swift-numerics
94+
repository: apple/swift-algorithms
95+
path: apple/swift-algorithms
8396
- name: Build Package With Toolchain
84-
working-directory: apple/swift-numerics
97+
working-directory: apple/swift-algorithms
8598
run: |
8699
echo "SWIFT COMMAND: ${{ steps.setup-toolchain.outputs.swift-build }}"
87100
${{ steps.setup-toolchain.outputs.swift-build }} -c debug

action.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,21 @@ runs:
225225
echo "swift-branch=${SWIFT_BRANCH}" >> $GITHUB_OUTPUT
226226
227227
NDK_VERSION="${{ inputs.ndk-version }}"
228-
if [[ "${NDK_VERSION}" != '' ]]; then
228+
if [[ "${NDK_VERSION}" == 'latest' ]]; then
229+
# can set latest, which is currently 28. See:
230+
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#environment-variables-2
231+
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#environment-variables-1
232+
echo "ANDROID_NDK_HOME={ANDROID_NDK_LATEST_HOME}" >> $GITHUB_ENV
233+
elif [[ "${NDK_VERSION}" != '' ]]; then
229234
# we can set ndk-version to "27" or "27.0" or "27.2.12479018"
230-
NDK_BASE=$(dirname "${ANDROID_NDK_ROOT}")
231-
echo "ANDROID_NDK_ROOT=$(ls -rd ${NDK_BASE}/${NDK_VERSION}* | head -n 1)" >> $GITHUB_ENV
235+
NDK_BASE=$(dirname "${ANDROID_NDK_HOME}")
236+
# the setup scripts use "ANDROID_NDK_HOME" for linking the NDK
237+
echo "ANDROID_NDK_HOME=$(ls -rd ${NDK_BASE}/${NDK_VERSION}* | head -n 1)" >> $GITHUB_ENV
238+
fi
239+
240+
if [[ ${SWIFT_VERSION_ID} != swift-6.0* ]]; then
241+
# see https://github.com/finagolfin/swift-android-sdk/issues/207
242+
echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV
232243
fi
233244
234245
- name: Cache Swift ${{ steps.setup.outputs.swift-version }} Host Toolchain
@@ -377,11 +388,6 @@ runs:
377388
# plugin-path is a workaround for https://github.com/swiftlang/swift-package-manager/issues/8362
378389
echo "swiftcmd=TARGET_OS_ANDROID=1 SKIP_BRIDGE=1 ${SWIFT_INSTALLATION}/bin/swift build --swift-sdk ${SWIFT_SDK_TARGET} -Xswiftc -plugin-path -Xswiftc ${SWIFT_INSTALLATION}/lib/swift/host/plugins/testing -Xswiftc -DTARGET_OS_ANDROID -Xswiftc -DSKIP_BRIDGE ${{ inputs.swift-build-flags }}" >> $GITHUB_OUTPUT
379390
echo "swift-sdk=${SWIFT_SDK_TARGET}" >> $GITHUB_OUTPUT
380-
381-
if [[ ${SWIFT_VERSION_ID} != swift-6.0* ]]; then
382-
# see https://github.com/finagolfin/swift-android-sdk/issues/207
383-
echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV
384-
fi
385391
- name: Check Swift Version
386392
shell: bash
387393
run: |

0 commit comments

Comments
 (0)