Skip to content

Commit 5e8011e

Browse files
committed
Swift Android build
1 parent 8a8b68b commit 5e8011e

File tree

1 file changed

+42
-39
lines changed

1 file changed

+42
-39
lines changed

.github/workflows/pull_request.yml

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ jobs:
4040
fail-fast: false
4141
matrix:
4242
# build only x86_64 to speed up the validation
43-
arch: ['x86_64']
44-
#arch: ['x86_64', '']
43+
#arch: ['x86_64']
44+
arch: ['x86_64', '']
4545
runs-on: ubuntu-24.04
4646
steps:
4747
- name: Checkout repository
@@ -54,14 +54,18 @@ jobs:
5454
run: |
5555
TARGET_ARCHS=${{ matrix.arch }} ./build
5656
- name: Get artifact info
57-
id: paths
57+
id: info
58+
shell: bash
5859
run: |
60+
set -ex
5961
SWIFT_ROOT=$(dirname ${{ runner.temp }}/swift-android-sdk/host-toolchain/*/usr)
6062
echo "swift-root=${SWIFT_ROOT}" >> $GITHUB_OUTPUT
6163
echo "swift-path=${SWIFT_ROOT}/usr/bin/swift" >> $GITHUB_OUTPUT
6264
65+
ARTIFACT_BUILD=$(realpath ${{ runner.temp }}/swift-android-sdk/build/*.artifactbundle)
6366
ARTIFACT_PATH=$(realpath ${{ runner.temp }}/swift-android-sdk/products/*.artifactbundle.tar.gz)
6467
echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
68+
echo "sdk-id=x86_64-unknown-linux-android28" >> $GITHUB_OUTPUT
6569
6670
ARTIFACT_EXT=".artifactbundle.tar.gz"
6771
ARTIFACT_NAME="$(basename ${ARTIFACT_PATH} ${ARTIFACT_EXT})"
@@ -78,12 +82,35 @@ jobs:
7882
7983
# e.g.: swift-6.1-RELEASE_android-0.1-x86_64.artifactbundle.tar.gz
8084
echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
85+
86+
# validate some required paths in the artifactbundle
87+
pushd ${ARTIFACT_BUILD}/*/*/usr
88+
ls lib/swift/android
89+
ls lib/swift/android/*
90+
ls lib/swift/android/*/swiftrt.o
91+
ls lib/*-linux-android/*/crtbegin_dynamic.o
92+
93+
ls lib/swift_static-*
94+
ls lib/swift_static-*/android
95+
ls lib/swift_static-*/android/libFoundationEssentials.a
96+
97+
ls lib/*-linux-android/libFoundationEssentials.so
98+
ls lib/*-linux-android/libFoundationNetworking.so
99+
ls lib/*-linux-android/libFoundationInternationalization.so
100+
ls lib/*-linux-android/lib_FoundationICU.so
101+
ls lib/*-linux-android/libFoundationXML.so
102+
ls lib/*-linux-android/libTesting.so
103+
104+
ls lib/swift/clang/lib
105+
ls lib/swift/clang/lib/linux
106+
ls lib/swift/clang/lib/linux/*/libunwind.a
107+
popd
81108
- name: Upload SDK artifactbundle
82109
uses: actions/upload-artifact@v4
83110
with:
84111
compression-level: 0
85-
name: ${{ steps.paths.outputs.artifact-name }}
86-
path: ${{ steps.paths.outputs.artifact-path }}
112+
name: ${{ steps.info.outputs.artifact-name }}
113+
path: ${{ steps.info.outputs.artifact-path }}
87114
- name: Cleanup
88115
run: |
89116
# need to free up some space or else when installing we get: No space left on device
@@ -92,65 +119,41 @@ jobs:
92119
shell: bash
93120
run: |
94121
set -ex
95-
${{ steps.paths.outputs.swift-path }} sdk install ${{ steps.paths.outputs.artifact-path }}
96-
${{ steps.paths.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.paths.outputs.swift-path }} sdk list | head -n 1) x86_64-unknown-linux-android28
122+
${{ steps.info.outputs.swift-path }} sdk install ${{ steps.info.outputs.artifact-path }}
123+
${{ steps.info.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.info.outputs.swift-path }} sdk list | head -n 1) ${{ steps.info.outputs.sdk-id }}
97124
# recent releases require that ANDROID_NDK_ROOT *not* be set
98125
# see https://github.com/finagolfin/swift-android-sdk/issues/207
99126
echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV
100-
101-
# validate some required paths in the artifactbundle
102-
cd ${HOME}/.config/swiftpm/swift-sdks/*.artifactbundle/*/*/usr
103-
pwd
104-
105-
ls lib/swift/android
106-
ls lib/swift/android/*
107-
ls lib/swift/android/*/swiftrt.o
108-
ls lib/*-linux-android/*/crtbegin_dynamic.o
109-
110-
ls lib/swift_static-*
111-
ls lib/swift_static-*/android
112-
ls lib/swift_static-*/android/libFoundationEssentials.a
113-
114-
ls lib/*-linux-android/libFoundationEssentials.so
115-
ls lib/*-linux-android/libFoundationNetworking.so
116-
ls lib/*-linux-android/libFoundationInternationalization.so
117-
ls lib/*-linux-android/lib_FoundationICU.so
118-
ls lib/*-linux-android/libFoundationXML.so
119-
ls lib/*-linux-android/libTesting.so
120-
121-
ls lib/swift/clang/lib
122-
ls lib/swift/clang/lib/linux
123-
ls lib/swift/clang/lib/linux/*/libunwind.a
124127
- name: Build Demo Project
125128
run: |
126129
cd ${{ runner.temp }}
127130
mkdir DemoProject
128131
cd DemoProject
129-
${{ steps.paths.outputs.swift-path }} --version
130-
${{ steps.paths.outputs.swift-path }} package init
132+
${{ steps.info.outputs.swift-path }} --version
133+
${{ steps.info.outputs.swift-path }} package init
131134
echo 'import Foundation' >> Sources/DemoProject/DemoProject.swift
132135
echo 'import FoundationEssentials' >> Sources/DemoProject/DemoProject.swift
133136
echo 'import FoundationXML' >> Sources/DemoProject/DemoProject.swift
134137
echo 'import FoundationNetworking' >> Sources/DemoProject/DemoProject.swift
135138
echo 'import Dispatch' >> Sources/DemoProject/DemoProject.swift
136139
echo 'import Android' >> Sources/DemoProject/DemoProject.swift
137-
${{ steps.paths.outputs.swift-path }} build --build-tests --swift-sdk x86_64-unknown-linux-android28
140+
${{ steps.info.outputs.swift-path }} build --build-tests --swift-sdk ${{ steps.info.outputs.sdk-id }}
138141
- name: Test Demo Project on Android
139142
uses: skiptools/swift-android-action@main
140143
with:
141144
package-path: ${{ runner.temp }}/DemoProject
142-
installed-sdk: x86_64-unknown-linux-android28
143-
installed-swift: ${{ steps.paths.outputs.swift-root }}
145+
installed-sdk: ${{ steps.info.outputs.sdk-id }}
146+
installed-swift: ${{ steps.info.outputs.swift-root }}
144147
- name: Build swift-algorithms
145148
run: |
146149
cd ${{ runner.temp }}
147150
git clone https://github.com/apple/swift-algorithms.git
148151
cd swift-algorithms
149-
${{ steps.paths.outputs.swift-path }} build --build-tests --swift-sdk x86_64-unknown-linux-android28
152+
${{ steps.info.outputs.swift-path }} build --build-tests --swift-sdk ${{ steps.info.outputs.sdk-id }}
150153
- name: Test swift-algorithms on Android
151154
uses: skiptools/swift-android-action@main
152155
with:
153156
#package-path: ${{ runner.temp }}/DemoProject
154157
package-path: ${{ runner.temp }}/swift-algorithms
155-
installed-sdk: x86_64-unknown-linux-android28
156-
installed-swift: ${{ steps.paths.outputs.swift-root }}
158+
installed-sdk: ${{ steps.info.outputs.sdk-id }}
159+
installed-swift: ${{ steps.info.outputs.swift-root }}

0 commit comments

Comments
 (0)