Skip to content

Commit 889fbc3

Browse files
committed
1 parent fec3c9c commit 889fbc3

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

.github/workflows/pull_request.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ jobs:
6060
sudo docker image prune --all --force
6161
sudo docker builder prune -a
6262
df -h
63+
- name: Setup
64+
run: |
65+
# these variabes are used by build-docker and build-local
66+
# to determine which Swift version to build for
67+
echo "BUILD_VERSION=${{ matrix.swift-version }}" >> $GITHUB_ENV
68+
echo "TARGET_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
6369
- name: Checkout repository
6470
uses: actions/checkout@v4
6571
with:
@@ -69,12 +75,22 @@ jobs:
6975
working-directory: swift-ci/sdks/android
7076
run: |
7177
sudo apt install -q ninja-build patchelf
72-
BUILD_VERSION=${{ matrix.swift-version }} TARGET_ARCHS=${{ matrix.arch }} ./build-local
78+
./build-local
7379
- name: Build Android SDK (Docker)
7480
if: ${{ matrix.build-type == 'docker' }}
7581
working-directory: swift-ci/sdks/android
7682
run: |
77-
BUILD_VERSION=${{ matrix.swift-version }} TARGET_ARCHS=${{ matrix.arch }} ./build-docker
83+
./build-docker
84+
- name: Install Host Toolchain
85+
if: ${{ matrix.build-type == 'docker' }}
86+
working-directory: swift-ci/sdks/android
87+
run: |
88+
# when building in a Docker container, we don't have a host toolchain
89+
# locally, but we need one in order to run the SDK validation tests
90+
source ./scripts/toolchain-vars.sh
91+
mkdir -p ${{ runner.temp }}/swift-android-sdk/host-toolchain
92+
./scripts/install-swift.sh ${{ runner.temp }}/swift-android-sdk/host-toolchain/swift
93+
${{ runner.temp }}/swift-android-sdk/host-toolchain/swift/bin/swift --version
7894
- name: Get artifact info
7995
id: info
8096
shell: bash
@@ -87,7 +103,6 @@ jobs:
87103
echo "swift-root=${SWIFT_ROOT}" >> $GITHUB_OUTPUT
88104
echo "swift-path=${SWIFT_ROOT}/usr/bin/swift" >> $GITHUB_OUTPUT
89105
90-
#ARTIFACT_BUILD=$(realpath ${{ runner.temp }}/swift-android-sdk/build/*.artifactbundle)
91106
ARTIFACT_PATH=$(realpath ${{ runner.temp }}/swift-android-sdk/products/*.artifactbundle.tar.gz)
92107
echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
93108
echo "sdk-id=x86_64-unknown-linux-android28" >> $GITHUB_OUTPUT
@@ -109,9 +124,6 @@ jobs:
109124
# so the actual artifact download will look like:
110125
# swift-6.1-RELEASE_android-0.1-x86_64.artifactbundle.tar.gz.zip
111126
echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
112-
113-
# show an abridged tree
114-
#tree ${ARTIFACT_BUILD} --filesfirst --prune -P 'Android.swiftmodule' -P 'libswiftAndroid.*' -P 'libFoundation.*' -P 'swiftrt.o' -P 'swift*.json' -P 'info.json' -P 'api-level.h' -P 'android.modulemap' -P 'SwiftAndroidNDK.h' -P 'bridging.modulemap' -P 'linux' -P 'libclang*.a' -P 'libunwind.a' -P 'libclang_rt.builtins-*-android.a'
115127
- name: Upload SDK artifactbundle
116128
uses: actions/upload-artifact@v4
117129
with:

swift-ci/sdks/android/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
5454

5555
COPY scripts/install-swift.sh /scripts/install-swift.sh
5656
RUN chmod ugo+x /scripts/install-swift.sh
57-
RUN /scripts/install-swift.sh
57+
RUN /scripts/install-swift.sh /usr/local/swift
5858
ENV PATH="/usr/local/swift/bin:${PATH}"
5959

6060
ARG ANDROID_NDK_VERSION=

swift-ci/sdks/android/scripts/install-swift.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ if [[ "${SWIFT_TOOLCHAIN_URL}" == "" ]]; then
1313
exit 1
1414
fi
1515

16-
echo "Installing Swift from: ${SWIFT_TOOLCHAIN_URL}"
16+
destination=$1
17+
if [[ "${destination}" == "" ]]; then
18+
echo "$0: Usage: $(basename $0) <swift installation directory>"
19+
exit 1
20+
fi
21+
22+
echo "Installing Swift from: ${SWIFT_TOOLCHAIN_URL} into: ${destination}"
1723

1824
# Make a temporary directory
1925
tmpdir=$(mktemp -d)
@@ -45,9 +51,9 @@ gpg --batch --verify toolchain.sig toolchain.tar.gz
4551
# Extract and install the toolchain
4652
echo "Extracting Swift"
4753

48-
mkdir -p /usr/local/swift
49-
tar -xzf toolchain.tar.gz --directory /usr/local/swift --strip-components=2
50-
chmod -R o+r /usr/local/swift/lib/swift
54+
mkdir -p ${destination}
55+
tar -xzf toolchain.tar.gz --directory ${destination} --strip-components=2
56+
chmod -R o+r ${destination}/lib/swift
5157

5258
popd >/dev/null
5359

0 commit comments

Comments
 (0)