Check what's going wrong on macOS CI in some cases #2048
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SDKs | |
on: | |
pull_request: | |
schedule: | |
- cron: '0 9 * * *' | |
jobs: | |
get-latest-toolchain: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: [release, devel, trunk] | |
outputs: | |
release-version: ${{ steps.check.outputs.release-tag }} | |
devel-version: ${{ steps.check.outputs.devel-tag }} | |
trunk-version: ${{ steps.check.outputs.trunk-tag }} | |
new-devel-tag: ${{ steps.download.outputs.devel-updated == 'true' }} | |
steps: | |
- name: Check for latest Swift ${{ matrix.version }} toolchain | |
id: check | |
run: | | |
if [ ${{ matrix.version }} = 'release' ]; then | |
LATEST_TOOLCHAIN_VERSION=$(curl -sL https://github.com/apple/swift/releases | grep -m1 swift-6.0 | cut -d- -f2) | |
SWIFT_TAG="swift-${LATEST_TOOLCHAIN_VERSION}-RELEASE" | |
echo "release-tag=$SWIFT_TAG" >> $GITHUB_OUTPUT | |
elif [ ${{ matrix.version }} = 'devel' ]; then | |
LATEST_TOOLCHAIN_VERSION=$(curl -sL https://github.com/apple/swift/tags | grep -m1 swift-6.0-DEV | cut -d- -f8-10) | |
SWIFT_TAG="swift-6.0-DEVELOPMENT-SNAPSHOT-${LATEST_TOOLCHAIN_VERSION}-a" | |
echo "devel-tag=$SWIFT_TAG" >> $GITHUB_OUTPUT | |
else | |
LATEST_TOOLCHAIN_VERSION=$(curl -sL https://github.com/apple/swift/tags | grep -m1 swift-DEV | cut -d- -f7-9) | |
SWIFT_TAG="swift-DEVELOPMENT-SNAPSHOT-${LATEST_TOOLCHAIN_VERSION}-a" | |
echo "trunk-tag=$SWIFT_TAG" >> $GITHUB_OUTPUT | |
fi | |
echo "latest-tag=$SWIFT_TAG" >> $GITHUB_OUTPUT | |
- name: Get cached Ubuntu toolchain | |
id: cache-toolchain-ubuntu | |
uses: actions/cache@v4 | |
with: | |
path: ~/${{ steps.check.outputs.latest-tag }}-ubuntu22.04.tar.gz | |
key: swift-ubuntu-22.04-${{ steps.check.outputs.latest-tag }}-toolchain | |
lookup-only: true | |
- name: Get cached macOS toolchain | |
id: cache-toolchain-macos | |
uses: actions/cache@v4 | |
with: | |
path: ~/${{ steps.check.outputs.latest-tag }}-osx.pkg | |
key: swift-macos-13-${{ steps.check.outputs.latest-tag }}-toolchain | |
lookup-only: true | |
- name: Download toolchain | |
id: download | |
if: ${{ steps.cache-toolchain-ubuntu.outputs.cache-hit != 'true' || steps.cache-toolchain-macos.outputs.cache-hit != 'true' }} | |
run: | | |
SWIFT_TAG="${{ steps.check.outputs.latest-tag }}" | |
if [ ${{ matrix.version }} = 'release' ]; then | |
SWIFT_BRANCH="swift-$(echo ${{ steps.check.outputs.release-tag }} | cut -d- -f2)-release" | |
elif [ ${{ matrix.version }} = 'devel' ]; then | |
SWIFT_BRANCH="swift-6.0-branch" | |
echo "devel-updated='true'" >> $GITHUB_OUTPUT | |
else | |
SWIFT_BRANCH="development" | |
fi | |
cd | |
if [[ "${{ steps.cache-toolchain-macos.outputs.cache-hit }}" != 'true' ]]; then | |
wget -q https://download.swift.org/$SWIFT_BRANCH/xcode/$SWIFT_TAG/$SWIFT_TAG-osx.pkg | |
echo "downloaded latest macOS toolchain: ${SWIFT_TAG}" | |
fi | |
if [[ "${{ steps.cache-toolchain-ubuntu.outputs.cache-hit }}" != 'true' ]]; then | |
wget -q https://download.swift.org/$SWIFT_BRANCH/ubuntu2204/$SWIFT_TAG/$SWIFT_TAG-ubuntu22.04.tar.gz | |
echo "downloaded latest Ubuntu toolchain: ${SWIFT_TAG}" | |
fi | |
build-sdk-and-tests: | |
runs-on: ${{ matrix.os }} | |
needs: get-latest-toolchain | |
strategy: | |
fail-fast: false | |
matrix: | |
version: [release, devel, trunk] | |
arch: [x86_64, aarch64, armv7] | |
os: [ubuntu-22.04, macos-13] | |
exclude: | |
- os: macos-13 | |
version: trunk | |
- os: macos-13 | |
version: ${{ needs.get-latest-toolchain.outputs.new-devel-tag == 'true' && 'devel' || 'none' }} | |
env: | |
ANDROID_API_LEVEL: 24 | |
steps: | |
- name: Extract the latest version string | |
id: version | |
run: | | |
if [[ ${{ matrix.version }} = 'release' ]]; then | |
TAG="${{ needs.get-latest-toolchain.outputs.release-version }}" | |
elif [ ${{ matrix.version }} = 'devel' ]; then | |
TAG="${{ needs.get-latest-toolchain.outputs.devel-version }}" | |
else | |
TAG="${{ needs.get-latest-toolchain.outputs.trunk-version }}" | |
fi | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
- name: Get cached SDK | |
id: cache-sdk | |
uses: actions/cache/restore@v4 | |
with: | |
path: ~/swift-${{ matrix.version }}-android-${{ matrix.arch }}-*-sdk.tar.xz | |
key: ${{ steps.version.outputs.tag }}-${{ matrix.arch }}-ndk-27b-sdk | |
- name: Clone | |
uses: actions/checkout@v4 | |
with: | |
path: sdk-config | |
- name: Get cached ${{ matrix.os }} ${{ steps.version.outputs.tag }} toolchain | |
id: cache-toolchain | |
uses: actions/cache/restore@v4 | |
with: | |
path: ~/${{ steps.version.outputs.tag }}-${{ startsWith(matrix.os, 'macos') && 'osx.pkg' || 'ubuntu22.04.tar.gz' }} | |
key: swift-${{ matrix.os }}-${{ steps.version.outputs.tag }}-toolchain | |
fail-on-cache-miss: true | |
- name: Setup Swift Toolchain | |
env: | |
SWIFT_TAG: ${{ steps.version.outputs.tag }} | |
run: | | |
set -x | |
cd sdk-config | |
if ${{ startsWith(matrix.os, 'macos') }}; then | |
mkdir ${SWIFT_TAG} | |
pushd ${SWIFT_TAG} | |
xar -x -C . -f ~/${SWIFT_TAG}-osx.pkg | |
tar xz -C . -f ${SWIFT_TAG}-osx-package.pkg/Payload | |
TOOLCHAIN=${PWD}/usr | |
popd | |
elif ${{ startsWith(matrix.os, 'ubuntu') }}; then | |
tar xf ~/$SWIFT_TAG-ubuntu22.04.tar.gz | |
TOOLCHAIN=${PWD}/$SWIFT_TAG-ubuntu22.04/usr | |
fi | |
perl -pi -e 's%canImport\(Bionic%canImport\(Android%' $TOOLCHAIN/bin/swift-package | |
perl -pi -e 's%import Bionic%import Android%' $TOOLCHAIN/bin/swift-package | |
perl -pi -e 's%TSCBasic, would be%TSCBasic, would %' $TOOLCHAIN/bin/swift-package | |
echo "TOOLCHAIN=${TOOLCHAIN}" >> $GITHUB_ENV | |
${TOOLCHAIN}/bin/swift --version | |
- name: Build Swift ${{ matrix.version }} Android SDK if not the latest | |
# build-script currently only works on ubuntu | |
if: ${{ (steps.cache-sdk.outputs.cache-hit != 'true') && startsWith(matrix.os, 'ubuntu') }} | |
env: | |
SWIFT_TAG: ${{ steps.version.outputs.tag }} | |
ANDROID_ARCH: ${{ matrix.arch }} | |
run: | | |
set -x | |
if ${{ startsWith(matrix.os, 'macos') }}; then | |
brew install ninja patchelf | |
elif ${{ startsWith(matrix.os, 'ubuntu') }}; then | |
sudo apt install ninja-build | |
fi | |
cd sdk-config | |
${TOOLCHAIN}/bin/swift --version | |
BUILD_SWIFT_PM=1 ${TOOLCHAIN}/bin/swift get-packages-and-swift-source.swift | |
SDK_NAME=$(ls | grep swift-${{ matrix.version }}-android-${{ matrix.arch }}) | |
SDK=`pwd`/$SDK_NAME | |
git apply swift-android.patch swift-android-foundation.patch swift-android-ci.patch swift-crypto.patch swift-system.patch | |
if [ ${{ matrix.version }} = 'trunk' ]; then | |
git apply swift-android-ci-trunk.patch swift-android-foundation-trunk.patch | |
else | |
git apply swift-android-ci-except-trunk.patch swift-android-foundation-except-trunk.patch | |
git apply -C1 swift-android-foundation-armv7-except-trunk.patch | |
if [ ${{ matrix.version }} = 'devel' ]; then | |
git apply swift-android-foundation-devel.patch | |
fi | |
fi | |
perl -pi -e 's%r26%ndk/27%' swift/stdlib/cmake/modules/AddSwiftStdlib.cmake | |
perl -pi -e "s%/data/data/com.termux/files%$SDK%g" $SDK/usr/lib/pkgconfig/sqlite3.pc | |
perl -pi -e 's%String\(cString: getpass%\"fake\" //%' swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift | |
./swift/utils/build-script -RA --skip-build-cmark --build-llvm=0 --android --android-ndk $ANDROID_NDK_LATEST_HOME --android-arch ${{ matrix.arch }} --android-api-level $ANDROID_API_LEVEL --build-swift-tools=0 --native-swift-tools-path=${TOOLCHAIN}/bin --native-clang-tools-path=${TOOLCHAIN}/bin --cross-compile-hosts=android-${{ matrix.arch }} --cross-compile-deps-path=$SDK --skip-local-build --build-swift-static-stdlib --xctest --skip-early-swift-driver --install-swift --install-libdispatch --install-foundation --install-xctest --install-destdir=$SDK --swift-install-components='clang-resource-dir-symlink;license;stdlib;sdk-overlay' --cross-compile-append-host-target-to-destdir=False -b -p --install-llbuild --sourcekit-lsp --skip-early-swiftsyntax | |
cp $ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$(echo ${{ matrix.arch }} | sed "s/v7//")-linux-android*/libc++_shared.so $SDK/usr/lib | |
patchelf --set-rpath \$ORIGIN $SDK/usr/lib/swift/android/libdispatch.so | |
patchelf --set-rpath \$ORIGIN/../..:\$ORIGIN $SDK/usr/lib/swift/android/lib[FXs]*.so | |
tar cJf ~/$SDK_NAME.tar.xz $SDK_NAME | |
rm -rf build/ $SDK_NAME llvm-project/ | |
- name: Cache new SDK on linux | |
if: ${{ (steps.cache-sdk.outputs.cache-hit != 'true') && startsWith(matrix.os, 'ubuntu') }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ~/swift-${{ matrix.version }}-android-${{ matrix.arch }}-*-sdk.tar.xz | |
key: ${{ steps.version.outputs.tag }}-${{ matrix.arch }}-ndk-27b-sdk | |
- name: Setup Swift ${{ matrix.version }} Android SDK | |
id: sdk-setup | |
run: | | |
set -x | |
cd sdk-config | |
tar xf ~/swift-${{ matrix.version }}-android-${{ matrix.arch }}*-sdk.tar.xz | |
pushd swift-*-sdk | |
SDK_PATH=${PWD} | |
popd | |
if ${{ startsWith(matrix.os, 'ubuntu') }}; then | |
ARCH_JSON=${SDK_PATH}/usr/swiftpm-android-${{ matrix.arch }}.json | |
cat ${ARCH_JSON} | |
NDK_PREBUILT=${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64 | |
elif ${{ startsWith(matrix.os, 'macos') }}; then | |
# fix the clang symlink | |
ls -la ${SDK_PATH}/usr/lib/swift/clang | |
rm -vf ${SDK_PATH}/usr/lib/swift/clang | |
# Swift 5.10: usr/lib/clang/15.0.0 Trunk and Devel: usr/lib/clang/17 | |
${TOOLCHAIN}/bin/clang --version | |
ln -sfv ${TOOLCHAIN}/lib/clang/* ${SDK_PATH}/usr/lib/swift/clang | |
ls -d ${SDK_PATH}/usr/lib/swift/clang/include | |
# the toolchain destination JSON in the SDK is for ubuntu, | |
# so for macOS we need to manually build it | |
ARCH=${{ matrix.arch }} | |
ARCH_JSON="$PWD/android-${ARCH}.json" | |
ARCH_TARGET="${ARCH}-unknown-linux-android${ANDROID_API_LEVEL}" | |
ARCHID="${ARCH}-linux-android" | |
if [ "$ARCH" == "armv7" ]; then | |
ARCHID="arm-linux-androideabi" | |
fi | |
NDK_PREBUILT=${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/darwin-x86_64 | |
# With the full SDK, the libs are all located in: | |
#"-L", "${SDK}/usr/lib/${ARCHID}" | |
# But with the partial SDK, they are divided between: | |
#"-L", "${SDK_PATH}/usr/lib", | |
#"-L", "${SDK_PATH}/usr/lib/swift/android", | |
cat > ${ARCH_JSON} << EOF | |
{ | |
"version": 1, | |
"target": "${ARCH_TARGET}", | |
"toolchain-bin-dir": "${TOOLCHAIN}/bin", | |
"sdk": "${NDK_PREBUILT}/sysroot", | |
"extra-cc-flags": [ "-fPIC" ], | |
"extra-cpp-flags": [ "-lstdc++" ], | |
"extra-swiftc-flags": [ | |
"-resource-dir", "${SDK_PATH}/usr/lib/swift", | |
"-tools-directory", "${NDK_PREBUILT}/bin" | |
] | |
} | |
EOF | |
cat ${ARCH_JSON} | |
fi | |
if [ ${{ matrix.version }} = 'trunk' ]; then | |
ln -sf $SDK_PATH/usr/lib/swift $NDK_PREBUILT/sysroot/usr/lib/swift | |
fi | |
echo "SDK_PATH=${SDK_PATH}" >> $GITHUB_ENV | |
echo "ARCH_JSON=${ARCH_JSON}" >> $GITHUB_ENV | |
- name: Get Swift Argument Parser package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-argument-parser | |
path: swift-argument-parser | |
- name: Build Swift Argument Parser package | |
run: | | |
cd swift-argument-parser | |
# perl -pi -e 's%macOS%Windows%' Package.swift | |
rm -r Examples/count-lines Tools/changelog-authors | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift crypto package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-crypto | |
path: swift-crypto | |
- name: Build Swift crypto package | |
run: | | |
git apply sdk-config/swift-crypto.patch | |
cd swift-crypto | |
perl -pi -e 's%\\\\(testsDirectory)/.*Vectors%/data/local/tmp/pack/crypto-vectors%' Tests/{Crypto,_CryptoExtras}Tests/Utils/{RFCVector,Wycheproof}.swift | |
perl -pi -e 's%#file%"/data/local/tmp/pack/crypto-vectors"%;s%../_CryptoExtrasVectors/%%' Tests/_CryptoExtrasTests/TestRSABlindSigning.swift | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift NIO package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-nio | |
path: swift-nio | |
- name: Build Swift NIO package | |
run: | | |
cd swift-nio | |
# Disable new tests that don't compile for 32-bit ARM yet | |
if ${{ matrix.arch == 'armv7' }}; then | |
rm Tests/NIOCoreTests/ByteBufferQUICBinaryEncodingStrategyTests.swift | |
fi | |
git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem.patch ../sdk-config/swift-nio-ndk27.patch | |
${TOOLCHAIN}/bin/swift package update | |
cd .build/checkouts/ | |
patch -p1 < ../../../sdk-config/swift-system.patch | |
cd ../.. | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift Numerics package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-numerics | |
path: swift-numerics | |
- name: Build Swift Numerics package | |
run: | | |
cd swift-numerics | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift System package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-system | |
path: swift-system | |
- name: Build Swift System package | |
run: | | |
git apply sdk-config/swift-system-tests.patch | |
cd swift-system | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift Collections package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-collections | |
path: swift-collections | |
- name: Build Swift Collections package | |
run: | | |
cd swift-collections | |
${TOOLCHAIN}/bin/swift build -j 1 --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift Atomics package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-atomics | |
path: swift-atomics | |
ref: 1.1.0 | |
- name: Get Swift NIO SSH package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-nio-ssh | |
path: sns | |
- name: Build Swift NIO SSH package | |
run: | | |
cd sns | |
perl -pi -e 's%url: .*swift-([a-z]*)\.git.*$%path: \"../swift-\1\"),%g' Package.swift | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift NIO SSL package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-nio-ssl | |
path: snl | |
- name: Build Swift NIO SSL package | |
run: | | |
cd snl | |
git apply ../sdk-config/swift-nio-ssl-test.patch | |
SWIFTCI_USE_LOCAL_DEPS=1 ${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Yams package | |
uses: actions/checkout@v4 | |
with: | |
repository: jpsim/Yams | |
path: yams | |
- name: Build Yams package | |
run: | | |
cd yams | |
perl -pi -e 's% fixturesDirectory + \"/SourceKitten#289% \"/data/local/tmp/pack%' Tests/YamsTests/PerformanceTests.swift | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift NIO HTTP/2 package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-nio-http2 | |
path: snh | |
- name: Build Swift NIO HTTP/2 package | |
if: ${{ matrix.arch != 'armv7' }} | |
run: | | |
cd snh | |
git apply ../sdk-config/swift-nio-http2-test.patch | |
perl -pi -e 's%url: .*swift-([a-z]*)\.git.*$%path: \"../swift-\1\"),%g' Package.swift | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get Swift Algorithms package | |
uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-algorithms | |
path: sa | |
- name: Build Swift Algorithms package | |
run: | | |
cd sa | |
perl -pi -e 's%url: .*$%path: \"../swift-numerics\"),%' Package.swift | |
${TOOLCHAIN}/bin/swift build --build-tests --destination ${ARCH_JSON} -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android | |
- name: Get cached Termux debug app for NIO tests | |
if: ${{ matrix.arch == 'x86_64' }} | |
id: cache-termux | |
uses: actions/cache@v4 | |
with: | |
path: ~/termux-debug.apk | |
key: termux-app | |
- name: Get Termux debug app if not cached | |
if: ${{ (matrix.arch == 'x86_64') && (steps.cache-termux.outputs.cache-hit != 'true') }} | |
run: wget -O ~/termux-debug.apk https://github.com/termux/termux-app/releases/download/v0.118.0/termux-app_v0.118.0+github-debug_x86_64.apk | |
- name: Prepare Android emulator test package | |
if: ${{ matrix.arch == 'x86_64' }} | |
run: | | |
set -x | |
# create the test runner script | |
cat > ~/test-toolchain.sh << EOF | |
adb install ~/termux-debug.apk | |
adb push pack /data/local/tmp | |
adb shell "run-as com.termux mkdir /data/data/com.termux/pack" | |
adb shell "run-as com.termux cp /data/local/tmp/pack/{swift-nioPackageTests.xctest,FileHandleTests.swift} /data/data/com.termux/pack" | |
adb shell "run-as com.termux cp -r /data/local/tmp/pack/lib /data/data/com.termux/pack" | |
adb shell "run-as com.termux cp -r /data/local/tmp/pack/Test\ Data /data/data/com.termux/pack" | |
adb shell "run-as com.termux ln -s README.md /data/data/com.termux/pack/Test\ Data/README.md.symlink" | |
adb shell "run-as com.termux ln -s Foo /data/data/com.termux/pack/Test\ Data/Foo.symlink" | |
adb shell "run-as com.termux sh -c 'TMPDIR=/data/data/com.termux /data/data/com.termux/pack/swift-nioPackageTests.xctest'" | |
adb shell "TMPDIR=/data/local/tmp /data/local/tmp/pack/swift-systemPackageTests.xctest" | |
EOF | |
mkdir -p pack/lib/swift/android | |
TARGET="x86_64-unknown-linux-android$ANDROID_API_LEVEL" | |
cp swift-argument-parser/.build/$TARGET/debug/{generate-manual,math,repeat,roll,swift-argument-parserPackageTests.xctest} pack | |
echo 'adb shell /data/local/tmp/pack/swift-argument-parserPackageTests.xctest' >> ~/test-toolchain.sh | |
wget -q https://raw.githubusercontent.com/termux/termux-elf-cleaner/v2.1.1/elf-cleaner.cpp | |
wget -q https://raw.githubusercontent.com/termux/termux-elf-cleaner/v2.1.1/elf.h | |
wget -q https://raw.githubusercontent.com/termux/termux-elf-cleaner/v2.1.1/arghandling.h | |
wget -q https://raw.githubusercontent.com/termux/termux-elf-cleaner/v2.1.1/arghandling.c | |
clang -c arghandling.c | |
clang -o elf-cleaner arghandling.o elf-cleaner.cpp -DCOPYRIGHT=\"foo\" -DPACKAGE_NAME=\"termux-elf-cleaner\" -DPACKAGE_VERSION=\"2.2.1\" | |
./elf-cleaner --api-level $ANDROID_API_LEVEL pack/{generate-manual,math,repeat,roll} || true | |
cp swift-crypto/.build/$TARGET/debug/swift-cryptoPackageTests.xctest pack | |
echo 'adb shell /data/local/tmp/pack/swift-cryptoPackageTests.xctest' >> ~/test-toolchain.sh | |
cp swift-nio/.build/$TARGET/debug/swift-nioPackageTests.xctest pack | |
cp swift-numerics/.build/$TARGET/debug/swift-numericsPackageTests.xctest pack | |
echo 'adb shell /data/local/tmp/pack/swift-numericsPackageTests.xctest' >> ~/test-toolchain.sh | |
cp swift-system/.build/$TARGET/debug/swift-systemPackageTests.xctest pack | |
cp swift-collections/.build/$TARGET/debug/swift-collectionsPackageTests.xctest pack | |
echo 'adb shell /data/local/tmp/pack/swift-collectionsPackageTests.xctest' >> ~/test-toolchain.sh | |
cp sns/.build/$TARGET/debug/swift-nio-sshPackageTests.xctest pack | |
echo 'adb shell /data/local/tmp/pack/swift-nio-sshPackageTests.xctest' >> ~/test-toolchain.sh | |
cp snl/.build/$TARGET/debug/swift-nio-sslPackageTests.xctest pack | |
echo 'adb shell /data/local/tmp/pack/swift-nio-sslPackageTests.xctest' >> ~/test-toolchain.sh | |
cp snh/.build/$TARGET/debug/swift-nio-http2PackageTests.xctest pack | |
echo 'adb shell /data/local/tmp/pack/swift-nio-http2PackageTests.xctest' >> ~/test-toolchain.sh | |
cp yams/.build/$TARGET/debug/YamsPackageTests.xctest pack | |
echo 'adb shell /data/local/tmp/pack/YamsPackageTests.xctest' >> ~/test-toolchain.sh | |
cp sa/.build/$TARGET/debug/swift-algorithmsPackageTests.xctest pack | |
echo 'adb shell /data/local/tmp/pack/swift-algorithmsPackageTests.xctest' >> ~/test-toolchain.sh | |
mkdir pack/crypto-vectors pack/swift-crypto_CryptoTests.resources | |
cp swift-crypto/Tests/Test\ Vectors/* swift-crypto/Tests/_CryptoExtrasVectors/* pack/crypto-vectors | |
cp swift-crypto/Tests/CryptoTests/HPKE/hpke-test-vectors.json pack/swift-crypto_CryptoTests.resources | |
rm swift-nio/Tests/NIOFileSystemIntegrationTests/Test\ Data/*symlink | |
cp -r swift-nio/Tests/NIOFileSystemIntegrationTests/Test\ Data/ swift-nio/Tests/NIOFileSystemIntegrationTests/FileHandleTests.swift pack | |
cp yams/Tests/YamsTests/Fixtures/SourceKitten#289/debug.yaml pack | |
cp sdk-config/swift-*-android-x86_64-*${ANDROID_API_LEVEL}-sdk/usr/lib/lib*so pack/lib | |
cp sdk-config/swift-*-android-x86_64-*${ANDROID_API_LEVEL}-sdk/usr/lib/swift/android/lib*so pack/lib/swift/android | |
mv pack/lib/libc++_shared.so pack/lib/swift/android | |
# need to free up some space or else the emulator fails to launch: | |
# ERROR | Not enough space to create userdata partition. Available: 6086.191406 MB at /home/runner/.android/avd/../avd/test.avd, need 7372.800000 MB. | |
rm -rf sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04 */.build | |
chmod +x ~/test-toolchain.sh | |
echo "TEST SCRIPT:" | |
cat ~/test-toolchain.sh | |
if ${{ startsWith(matrix.os, 'ubuntu') }}; then | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
fi | |
- name: Run tests on Android x86_64 emulator | |
if: ${{ matrix.arch == 'x86_64' }} | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
arch: x86_64 | |
script: ~/test-toolchain.sh |