Skip to content

Commit

Permalink
Test new Android overlay on the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
finagolfin committed May 26, 2024
1 parent d6b9865 commit 2aee293
Show file tree
Hide file tree
Showing 8 changed files with 2,672 additions and 18 deletions.
62 changes: 44 additions & 18 deletions .github/workflows/sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
with:
path: sdk-config
- name: Build Swift ${{ matrix.version }} Android SDK if not the latest
if: ${{ steps.cache-sdk.outputs.cache-hit != 'true' }}
if: ${{ steps.cache-sdk.outputs.cache-hit != 'true' || (matrix.version == 'trunk' && matrix.ndk == '26d') }}
env:
SWIFT_TAG: ${{ steps.version.outputs.tag }}
ANDROID_ARCH: ${{ matrix.arch }}
Expand All @@ -107,6 +107,7 @@ jobs:
SDK=`pwd`/$SDK_NAME
tar xf ~/$SWIFT_TAG-ubuntu22.04.tar.gz
./$SWIFT_TAG-ubuntu22.04/usr/bin/swift --version
git apply swift-android-ci.patch
git apply -C1 swift-android.patch swift-android-both-ndks.patch
if [ ${{ matrix.version }} = 'release' ]; then
Expand All @@ -124,6 +125,13 @@ jobs:
git apply -C0 swift-android-foundation-ndk26.patch
if [ ${{ matrix.version }} = 'release' ]; then
git apply swift-android-stdlib-ndk26.patch
elif [ ${{ matrix.version }} = 'trunk' ]; then
git apply android-overlay/modulemap.patch android-overlay/overlay.patch android-overlay/foundation-fixes.patch android-overlay/import-android.patch android-overlay/swift-argument-parser.patch android-overlay/yams.patch
wget -q https://download.swift.org/tmp/pull-request/73127/813/ubuntu2004/PR-ubuntu2004.tar.gz
tar xf PR-ubuntu2004.tar.gz
rm -rf $SWIFT_TAG-ubuntu22.04/usr/
mv usr/ $SWIFT_TAG-ubuntu22.04/
rm ~/swift-${{ matrix.version }}-android-${{ matrix.arch }}*-sdk.tar.xz
fi
else
NDK=$ANDROID_NDK
Expand Down Expand Up @@ -161,6 +169,12 @@ jobs:
if [ ! -d ${{ steps.version.outputs.tag }}-ubuntu22.04 ]; then
tar xf ~/${{ steps.version.outputs.tag }}-ubuntu22.04.tar.gz
fi
if [[ ${{ matrix.version }} = 'trunk' && ${{ matrix.ndk }} = '26d' ]]; then
sed -i "s%canImport(Glibc%canImport(Android%" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
sed -i "s%import Glibc%import Android%" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
sed -i "s%TSCBasic, would be nice%TSCBasic, would be %" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
fi
./${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift --version
tar xf ~/swift-${{ matrix.version }}-android-${{ matrix.arch }}*-sdk.tar.xz
- name: Get Swift Argument Parser package
Expand All @@ -170,6 +184,9 @@ jobs:
path: swift-argument-parser
- name: Build Swift Argument Parser package
run: |
if [[ ${{ matrix.version }} = 'trunk' && ${{ matrix.ndk }} = '26d' ]]; then
git apply sdk-config/android-overlay/swift-argument-parser.patch
fi
cd swift-argument-parser
../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift build --build-tests --destination ../sdk-config/swift-${{ matrix.version }}-*-sdk/usr/swiftpm-android-${{ matrix.arch }}.json -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android
- name: Get Swift crypto package
Expand All @@ -191,6 +208,7 @@ jobs:
repository: apple/swift-nio
path: swift-nio
- name: Build Swift NIO package
if: ${{ matrix.version != 'trunk' || matrix.ndk != '26d' }}
run: |
cd swift-nio
git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem-both-ndks.patch
Expand All @@ -215,6 +233,9 @@ jobs:
- name: Build Swift System package
run: |
cd swift-system
if [[ ${{ matrix.version }} = 'trunk' && ${{ matrix.ndk }} = '26d' ]]; then
git apply ../sdk-config/android-overlay/swift-system.patch
fi
../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift build --build-tests --destination ../sdk-config/swift-${{ matrix.version }}-*-sdk/usr/swiftpm-android-${{ matrix.arch }}.json -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android
- name: Get Swift Collections package
uses: actions/checkout@v4
Expand All @@ -237,6 +258,7 @@ jobs:
repository: apple/swift-nio-ssh
path: sns
- name: Build Swift NIO SSH package
if: ${{ matrix.version != 'trunk' || matrix.ndk != '26d' }}
run: |
cd sns
sed -i "s%url: .*swift-\(\w\+\)\.git.*$%path: \"../swift-\1\"),%g" Package.swift
Expand All @@ -247,6 +269,7 @@ jobs:
repository: apple/swift-nio-ssl
path: snl
- name: Build Swift NIO SSL package
if: ${{ matrix.version != 'trunk' || matrix.ndk != '26d' }}
run: |
cd snl
if [ ${{ matrix.ndk }} = '25c' ]; then
Expand All @@ -260,6 +283,9 @@ jobs:
path: yams
- name: Build Yams package
run: |
if [[ ${{ matrix.version }} = 'trunk' && ${{ matrix.ndk }} = '26d' ]]; then
git apply sdk-config/android-overlay/yams.patch
fi
cd yams
sed -i "s% fixturesDirectory + \"/SourceKitten#289% \"/data/local/tmp/pack%" Tests/YamsTests/PerformanceTests.swift
../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift build --build-tests --destination ../sdk-config/swift-${{ matrix.version }}-*-sdk/usr/swiftpm-android-${{ matrix.arch }}.json -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android
Expand All @@ -269,7 +295,7 @@ jobs:
repository: apple/swift-nio-http2
path: snh
- name: Build Swift NIO HTTP/2 package
if: ${{ matrix.arch != 'armv7' }}
if: ${{ matrix.arch != 'armv7' && (matrix.version != 'trunk' || matrix.ndk != '26d') }}
run: |
cd snh
sed -i "s%url: .*swift-\(\w\+\)\.git.*$%path: \"../swift-\1\"),%g" Package.swift
Expand Down Expand Up @@ -307,21 +333,21 @@ jobs:
./elf-cleaner pack/{generate-manual,math,repeat,roll} || true
cp swift-crypto/.build/$TARGET/debug/swift-cryptoPackageTests.xctest pack
cp swift-nio/.build/$TARGET/debug/swift-nioPackageTests.xctest pack
# cp swift-nio/.build/$TARGET/debug/swift-nioPackageTests.xctest pack
cp swift-numerics/.build/$TARGET/debug/swift-numericsPackageTests.xctest pack
cp swift-system/.build/$TARGET/debug/swift-systemPackageTests.xctest pack
cp swift-collections/.build/$TARGET/debug/swift-collectionsPackageTests.xctest pack
cp sns/.build/$TARGET/debug/swift-nio-sshPackageTests.xctest pack
cp snl/.build/$TARGET/debug/swift-nio-sslPackageTests.xctest pack
# cp sns/.build/$TARGET/debug/swift-nio-sshPackageTests.xctest pack
# cp snl/.build/$TARGET/debug/swift-nio-sslPackageTests.xctest pack
cp yams/.build/$TARGET/debug/YamsPackageTests.xctest pack
cp snh/.build/$TARGET/debug/swift-nio-http2PackageTests.xctest pack
# cp snh/.build/$TARGET/debug/swift-nio-http2PackageTests.xctest pack
cp sa/.build/$TARGET/debug/swift-algorithmsPackageTests.xctest pack
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
# 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-${{ matrix.version }}*-android-x86_64-*${ANDROID_API_LEVEL}-sdk/usr/lib/lib*so pack/lib
cp sdk-config/swift-${{ matrix.version }}*-android-x86_64-*${ANDROID_API_LEVEL}-sdk/usr/lib/swift/android/lib*so pack/lib/swift/android
Expand All @@ -342,18 +368,18 @@ jobs:
adb shell /data/local/tmp/pack/swift-argument-parserPackageTests.xctest
adb shell /data/local/tmp/pack/swift-cryptoPackageTests.xctest
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 "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 /data/local/tmp/pack/swift-numericsPackageTests.xctest
adb shell "TMPDIR=/data/local/tmp /data/local/tmp/pack/swift-systemPackageTests.xctest"
adb shell /data/local/tmp/pack/swift-collectionsPackageTests.xctest
adb shell /data/local/tmp/pack/swift-nio-sshPackageTests.xctest
adb shell /data/local/tmp/pack/swift-nio-sslPackageTests.xctest
adb shell /data/local/tmp/pack/swift-nio-http2PackageTests.xctest
# adb shell /data/local/tmp/pack/swift-nio-sshPackageTests.xctest
# adb shell /data/local/tmp/pack/swift-nio-sslPackageTests.xctest
# adb shell /data/local/tmp/pack/swift-nio-http2PackageTests.xctest
adb shell /data/local/tmp/pack/swift-algorithmsPackageTests.xctest
adb shell /data/local/tmp/pack/YamsPackageTests.xctest
Loading

0 comments on commit 2aee293

Please sign in to comment.