Skip to content

Commit 7ac7a03

Browse files
committed
Test new Android overlay on the CI
1 parent 4d3ec9c commit 7ac7a03

File tree

8 files changed

+2540
-18
lines changed

8 files changed

+2540
-18
lines changed

.github/workflows/sdks.yml

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
with:
9595
path: sdk-config
9696
- name: Build Swift ${{ matrix.version }} Android SDK if not the latest
97-
if: ${{ steps.cache-sdk.outputs.cache-hit != 'true' }}
97+
if: ${{ steps.cache-sdk.outputs.cache-hit != 'true' || (matrix.version == 'trunk' && matrix.ndk == '26d') }}
9898
env:
9999
SWIFT_TAG: ${{ steps.version.outputs.tag }}
100100
ANDROID_ARCH: ${{ matrix.arch }}
@@ -107,6 +107,7 @@ jobs:
107107
SDK=`pwd`/$SDK_NAME
108108
109109
tar xf ~/$SWIFT_TAG-ubuntu22.04.tar.gz
110+
./$SWIFT_TAG-ubuntu22.04/usr/bin/swift --version
110111
git apply swift-android-ci.patch
111112
git apply -C1 swift-android.patch swift-android-both-ndks.patch
112113
if [ ${{ matrix.version }} = 'release' ]; then
@@ -124,6 +125,13 @@ jobs:
124125
git apply -C0 swift-android-foundation-ndk26.patch
125126
if [ ${{ matrix.version }} = 'release' ]; then
126127
git apply swift-android-stdlib-ndk26.patch
128+
elif [ ${{ matrix.version }} = 'trunk' ]; then
129+
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
130+
wget -q https://download.swift.org/tmp/pull-request/73127/813/ubuntu2004/PR-ubuntu2004.tar.gz
131+
tar xf PR-ubuntu2004.tar.gz
132+
rm -rf $SWIFT_TAG-ubuntu22.04/usr/
133+
mv usr/ $SWIFT_TAG-ubuntu22.04/
134+
rm ~/swift-${{ matrix.version }}-android-${{ matrix.arch }}*-sdk.tar.xz
127135
fi
128136
else
129137
NDK=$ANDROID_NDK
@@ -161,6 +169,12 @@ jobs:
161169
if [ ! -d ${{ steps.version.outputs.tag }}-ubuntu22.04 ]; then
162170
tar xf ~/${{ steps.version.outputs.tag }}-ubuntu22.04.tar.gz
163171
fi
172+
if [[ ${{ matrix.version }} = 'trunk' && ${{ matrix.ndk }} = '26d' ]]; then
173+
sed -i "s%canImport(Glibc%canImport(Android%" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
174+
sed -i "s%import Glibc%import Android%" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
175+
sed -i "s%TSCBasic, would be nice%TSCBasic, would be %" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
176+
fi
177+
./${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift --version
164178
165179
tar xf ~/swift-${{ matrix.version }}-android-${{ matrix.arch }}*-sdk.tar.xz
166180
- name: Get Swift Argument Parser package
@@ -170,6 +184,9 @@ jobs:
170184
path: swift-argument-parser
171185
- name: Build Swift Argument Parser package
172186
run: |
187+
if [[ ${{ matrix.version }} = 'trunk' && ${{ matrix.ndk }} = '26d' ]]; then
188+
git apply sdk-config/android-overlay/swift-argument-parser.patch
189+
fi
173190
cd swift-argument-parser
174191
../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
175192
- name: Get Swift crypto package
@@ -191,6 +208,7 @@ jobs:
191208
repository: apple/swift-nio
192209
path: swift-nio
193210
- name: Build Swift NIO package
211+
if: ${{ matrix.version != 'trunk' || matrix.ndk != '26d' }}
194212
run: |
195213
cd swift-nio
196214
git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem-both-ndks.patch
@@ -215,6 +233,9 @@ jobs:
215233
- name: Build Swift System package
216234
run: |
217235
cd swift-system
236+
if [[ ${{ matrix.version }} = 'trunk' && ${{ matrix.ndk }} = '26d' ]]; then
237+
git apply ../sdk-config/android-overlay/swift-system.patch
238+
fi
218239
../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
219240
- name: Get Swift Collections package
220241
uses: actions/checkout@v4
@@ -237,6 +258,7 @@ jobs:
237258
repository: apple/swift-nio-ssh
238259
path: sns
239260
- name: Build Swift NIO SSH package
261+
if: ${{ matrix.version != 'trunk' || matrix.ndk != '26d' }}
240262
run: |
241263
cd sns
242264
sed -i "s%url: .*swift-\(\w\+\)\.git.*$%path: \"../swift-\1\"),%g" Package.swift
@@ -247,6 +269,7 @@ jobs:
247269
repository: apple/swift-nio-ssl
248270
path: snl
249271
- name: Build Swift NIO SSL package
272+
if: ${{ matrix.version != 'trunk' || matrix.ndk != '26d' }}
250273
run: |
251274
cd snl
252275
if [ ${{ matrix.ndk }} = '25c' ]; then
@@ -260,6 +283,9 @@ jobs:
260283
path: yams
261284
- name: Build Yams package
262285
run: |
286+
if [[ ${{ matrix.version }} = 'trunk' && ${{ matrix.ndk }} = '26d' ]]; then
287+
git apply sdk-config/android-overlay/yams.patch
288+
fi
263289
cd yams
264290
sed -i "s% fixturesDirectory + \"/SourceKitten#289% \"/data/local/tmp/pack%" Tests/YamsTests/PerformanceTests.swift
265291
../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
@@ -269,7 +295,7 @@ jobs:
269295
repository: apple/swift-nio-http2
270296
path: snh
271297
- name: Build Swift NIO HTTP/2 package
272-
if: ${{ matrix.arch != 'armv7' }}
298+
if: ${{ matrix.arch != 'armv7' && (matrix.version != 'trunk' || matrix.ndk != '26d') }}
273299
run: |
274300
cd snh
275301
sed -i "s%url: .*swift-\(\w\+\)\.git.*$%path: \"../swift-\1\"),%g" Package.swift
@@ -307,21 +333,21 @@ jobs:
307333
./elf-cleaner pack/{generate-manual,math,repeat,roll} || true
308334
309335
cp swift-crypto/.build/$TARGET/debug/swift-cryptoPackageTests.xctest pack
310-
cp swift-nio/.build/$TARGET/debug/swift-nioPackageTests.xctest pack
336+
# cp swift-nio/.build/$TARGET/debug/swift-nioPackageTests.xctest pack
311337
cp swift-numerics/.build/$TARGET/debug/swift-numericsPackageTests.xctest pack
312338
cp swift-system/.build/$TARGET/debug/swift-systemPackageTests.xctest pack
313339
cp swift-collections/.build/$TARGET/debug/swift-collectionsPackageTests.xctest pack
314-
cp sns/.build/$TARGET/debug/swift-nio-sshPackageTests.xctest pack
315-
cp snl/.build/$TARGET/debug/swift-nio-sslPackageTests.xctest pack
340+
# cp sns/.build/$TARGET/debug/swift-nio-sshPackageTests.xctest pack
341+
# cp snl/.build/$TARGET/debug/swift-nio-sslPackageTests.xctest pack
316342
cp yams/.build/$TARGET/debug/YamsPackageTests.xctest pack
317-
cp snh/.build/$TARGET/debug/swift-nio-http2PackageTests.xctest pack
343+
# cp snh/.build/$TARGET/debug/swift-nio-http2PackageTests.xctest pack
318344
cp sa/.build/$TARGET/debug/swift-algorithmsPackageTests.xctest pack
319345
320346
mkdir pack/crypto-vectors pack/swift-crypto_CryptoTests.resources
321347
cp swift-crypto/Tests/Test\ Vectors/* swift-crypto/Tests/_CryptoExtrasVectors/* pack/crypto-vectors
322348
cp swift-crypto/Tests/CryptoTests/HPKE/hpke-test-vectors.json pack/swift-crypto_CryptoTests.resources
323-
rm swift-nio/Tests/NIOFileSystemIntegrationTests/Test\ Data/*symlink
324-
cp -r swift-nio/Tests/NIOFileSystemIntegrationTests/Test\ Data/ swift-nio/Tests/NIOFileSystemIntegrationTests/FileHandleTests.swift pack
349+
# rm swift-nio/Tests/NIOFileSystemIntegrationTests/Test\ Data/*symlink
350+
# cp -r swift-nio/Tests/NIOFileSystemIntegrationTests/Test\ Data/ swift-nio/Tests/NIOFileSystemIntegrationTests/FileHandleTests.swift pack
325351
cp yams/Tests/YamsTests/Fixtures/SourceKitten#289/debug.yaml pack
326352
cp sdk-config/swift-${{ matrix.version }}*-android-x86_64-*${ANDROID_API_LEVEL}-sdk/usr/lib/lib*so pack/lib
327353
cp sdk-config/swift-${{ matrix.version }}*-android-x86_64-*${ANDROID_API_LEVEL}-sdk/usr/lib/swift/android/lib*so pack/lib/swift/android
@@ -342,18 +368,18 @@ jobs:
342368
343369
adb shell /data/local/tmp/pack/swift-argument-parserPackageTests.xctest
344370
adb shell /data/local/tmp/pack/swift-cryptoPackageTests.xctest
345-
adb shell "run-as com.termux mkdir /data/data/com.termux/pack"
346-
adb shell "run-as com.termux cp /data/local/tmp/pack/{swift-nioPackageTests.xctest,FileHandleTests.swift} /data/data/com.termux/pack"
347-
adb shell "run-as com.termux cp -r /data/local/tmp/pack/lib /data/data/com.termux/pack"
348-
adb shell "run-as com.termux cp -r /data/local/tmp/pack/Test\ Data /data/data/com.termux/pack"
349-
adb shell "run-as com.termux ln -s README.md /data/data/com.termux/pack/Test\ Data/README.md.symlink"
350-
adb shell "run-as com.termux ln -s Foo /data/data/com.termux/pack/Test\ Data/Foo.symlink"
351-
adb shell "run-as com.termux sh -c 'TMPDIR=/data/data/com.termux /data/data/com.termux/pack/swift-nioPackageTests.xctest'"
371+
# adb shell "run-as com.termux mkdir /data/data/com.termux/pack"
372+
# adb shell "run-as com.termux cp /data/local/tmp/pack/{swift-nioPackageTests.xctest,FileHandleTests.swift} /data/data/com.termux/pack"
373+
# adb shell "run-as com.termux cp -r /data/local/tmp/pack/lib /data/data/com.termux/pack"
374+
# adb shell "run-as com.termux cp -r /data/local/tmp/pack/Test\ Data /data/data/com.termux/pack"
375+
# adb shell "run-as com.termux ln -s README.md /data/data/com.termux/pack/Test\ Data/README.md.symlink"
376+
# adb shell "run-as com.termux ln -s Foo /data/data/com.termux/pack/Test\ Data/Foo.symlink"
377+
# adb shell "run-as com.termux sh -c 'TMPDIR=/data/data/com.termux /data/data/com.termux/pack/swift-nioPackageTests.xctest'"
352378
adb shell /data/local/tmp/pack/swift-numericsPackageTests.xctest
353379
adb shell "TMPDIR=/data/local/tmp /data/local/tmp/pack/swift-systemPackageTests.xctest"
354380
adb shell /data/local/tmp/pack/swift-collectionsPackageTests.xctest
355-
adb shell /data/local/tmp/pack/swift-nio-sshPackageTests.xctest
356-
adb shell /data/local/tmp/pack/swift-nio-sslPackageTests.xctest
357-
adb shell /data/local/tmp/pack/swift-nio-http2PackageTests.xctest
381+
# adb shell /data/local/tmp/pack/swift-nio-sshPackageTests.xctest
382+
# adb shell /data/local/tmp/pack/swift-nio-sslPackageTests.xctest
383+
# adb shell /data/local/tmp/pack/swift-nio-http2PackageTests.xctest
358384
adb shell /data/local/tmp/pack/swift-algorithmsPackageTests.xctest
359385
adb shell /data/local/tmp/pack/YamsPackageTests.xctest

0 commit comments

Comments
 (0)