|
58 | 58 |
|
59 | 59 | runs-on: ${{ matrix.os }} |
60 | 60 | steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + |
61 | 63 | - name: Free Disk Space |
62 | 64 | if: runner.os == 'Linux' |
63 | 65 | run: | |
@@ -204,70 +206,6 @@ jobs: |
204 | 206 | adb push $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/*/sysroot/usr/lib/${ANDROID_EMULATOR_ARCH_TRIPLE}-linux-android/libc++_shared.so /data/local/tmp/ |
205 | 207 | adb shell /data/local/tmp/hello |
206 | 208 |
|
207 | | - - name: Create android-ci script |
208 | | - run: | |
209 | | - cat > android-ci.sh << "EOF" |
210 | | - #!/bin/bash -ex |
211 | | -
|
212 | | - if [[ -z "${2}" ]]; then |
213 | | - echo "$0: Usage: $0 build/test org/package |
214 | | - exit 1 |
215 | | - fi |
216 | | -
|
217 | | - ACT=${1} |
218 | | - ORG=$(echo "${2}" | cut -d '/' -f 1) |
219 | | - PACKAGE=$(echo "${2}" | cut -d '/' -f 2) |
220 | | -
|
221 | | - git clone https://github.com/${ORG}/${PACKAGE} |
222 | | - cd ${PACKAGE} |
223 | | -
|
224 | | - TRIPLE="${ANDROID_EMULATOR_ARCH_TRIPLE}-unknown-linux-android${ANDROID_API}" |
225 | | - swiftly run swift build --swift-sdk "${TRIPLE}" --build-tests +"${SWIFT_TOOLCHAIN_VERSION}" |
226 | | -
|
227 | | - if [[ "${ACT}" == "build" ]]; then |
228 | | - # build-only, not test |
229 | | - exit 0 |
230 | | - fi |
231 | | -
|
232 | | - if [[ "${ACT}" != "test" ]]; then |
233 | | - # build-only, not test |
234 | | - echo "$0: Usage: $0 build/test org/package |
235 | | - exit 1 |
236 | | - fi |
237 | | -
|
238 | | - STAGING="android-test-${PACKAGE}" |
239 | | - rm -rf .build/"${STAGING}" |
240 | | - mkdir .build/"${STAGING}" |
241 | | -
|
242 | | - # for the common case of tests referencing their own files as hardwired resource paths |
243 | | - cp -a Tests .build/"${STAGING}" |
244 | | -
|
245 | | - cd .build/ |
246 | | - cp -a debug/*.xctest "${STAGING}" |
247 | | - cp -a debug/*.resources "${STAGING}" || true |
248 | | - cp -a ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/*/sysroot/usr/lib/${ANDROID_EMULATOR_ARCH_TRIPLE}-linux-android/libc++_shared.so "${STAGING}" |
249 | | - cp -a ${SWIFT_ANDROID_SDK_HOME}/swift-android/swift-resources/usr/lib/swift-${ANDROID_EMULATOR_ARCH_TRIPLE}/android/*.so "${STAGING}" |
250 | | -
|
251 | | - adb push ${STAGING} /data/local/tmp/ |
252 | | -
|
253 | | - cd - |
254 | | -
|
255 | | - TEST_CMD="./${PACKAGE}PackageTests.xctest" |
256 | | - TEST_SHELL="cd /data/local/tmp/${STAGING}" |
257 | | - TEST_SHELL="${TEST_SHELL} && ${TEST_CMD}" |
258 | | -
|
259 | | - # Run a second time with the Swift Testing library |
260 | | - # We additionally need to handle the special exit code EXIT_NO_TESTS_FOUND (69 on Android), |
261 | | - # which can happen when the tests link to Testing, but no tests are executed |
262 | | - # see: https://github.com/swiftlang/swift-package-manager/blob/1b593469e8ad3daf2cc10e798340bd2de68c402d/Sources/Commands/SwiftTestCommand.swift#L1542 |
263 | | - TEST_SHELL="${TEST_SHELL} && ${TEST_CMD} --testing-library swift-testing && [ \$? -eq 0 ] || [ \$? -eq 69 ]" |
264 | | -
|
265 | | - adb shell "${TEST_SHELL}" |
266 | | - EOF |
267 | | -
|
268 | | - chmod +x android-ci.sh |
269 | | - cat android-ci.sh |
270 | | -
|
271 | 209 | - name: Run swift-numerics tests |
272 | 210 | run: ./android-ci.sh test apple/swift-numerics |
273 | 211 |
|
|
0 commit comments