Skip to content

Commit f472e9e

Browse files
committed
Try running Docker build on macOS host
1 parent e4a96b2 commit f472e9e

File tree

6 files changed

+41
-21
lines changed

6 files changed

+41
-21
lines changed

.github/workflows/pull_request.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ jobs:
3636
# build-type: 'docker'
3737
# build-compiler: '1'
3838
# runner: 'self-hosted'
39+
- swift-version: 'swift-6.2-branch'
40+
build-type: 'docker'
41+
build-compiler: '0'
42+
# Intel macOS
43+
runner: 'macos-13'
44+
- swift-version: 'swift-6.2-branch'
45+
build-type: 'docker'
46+
build-compiler: '0'
47+
# ARM macOS
48+
runner: 'macos-15'
3949
- swift-version: 'swift-6.2-branch'
4050
build-type: 'docker'
4151
build-compiler: '0'

swift-ci/sdks/android/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,4 @@ RUN groupadd -g 998 build-user && \
8585
USER build-user
8686

8787
WORKDIR /home/build-user
88+

swift-ci/sdks/android/build-docker

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64,armv7}
1212
ANDROID_NDK_VERSION=android-ndk-r27c
1313
ANDROID_API=28
1414

15+
BASEPATH=$(dirname $(realpath $0))
16+
cd ${BASEPATH}
17+
1518
export BUILD_SCHEME=${1}
1619
# note that WORKDIR must not be under the current checkout or the patches will fail to apply
1720
WORKDIR=${2}
@@ -27,13 +30,13 @@ source ./scripts/toolchain-vars.sh
2730

2831
# Check-out and patch the sources
2932
if [[ "${BUILD_COMPILER}" != "1" ]]; then
30-
./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-tag ${SWIFT_TAG}
31-
else
32-
if [[ "${BUILD_SCHEME}" == "development" ]]; then
33-
./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme main
33+
./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-tag ${SWIFT_TAG}
3434
else
35-
./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme release/6.2
36-
fi
35+
if [[ "${BUILD_SCHEME}" == "development" ]]; then
36+
./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme main
37+
else
38+
./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme release/6.2
39+
fi
3740
fi
3841
./patches/apply-patches.sh ${WORKDIR}/source/swift-project
3942

@@ -44,19 +47,6 @@ if [[ "$DOCKER" == "" ]]; then
4447
DOCKER=docker
4548
fi
4649

47-
case $(arch) in
48-
arm64|aarch64)
49-
OS_ARCH_SUFFIX=-aarch64
50-
;;
51-
amd64|x86_64)
52-
OS_ARCH_SUFFIX=
53-
;;
54-
*)
55-
echo "Unknown architecture $(arch)"
56-
exit 1
57-
;;
58-
esac
59-
6050
CONTAINER_NAME="swift-android"
6151

6252
# Build the Docker image

swift-ci/sdks/android/build-local

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64,armv7}
1212
ANDROID_NDK_VERSION=android-ndk-r27c
1313
ANDROID_API=28
1414

15+
BASEPATH=$(dirname $(realpath $0))
16+
cd ${BASEPATH}
17+
1518
export BUILD_SCHEME=${1}
1619
# note that WORKDIR must not be under the current checkout or the patches will fail to apply
1720
WORKDIR=${2}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ header "Swift Android SDK build script"
217217

218218
swift_dir=$(realpath $(dirname "$swiftc")/..)
219219
HOST=linux-x86_64
220+
# The Linux NDK only supports x86
220221
#HOST=$(uname -s -m | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
221222

222223
# in a Docker container, the pre-installed NDK is read-only,

swift-ci/sdks/android/scripts/toolchain-vars.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,26 @@ case "${BUILD_SCHEME}" in
3737
esac
3838

3939
SWIFT_BASE=$SWIFT_TAG-$HOST_OS
40+
41+
case $(arch) in
42+
arm64|aarch64)
43+
export OS_ARCH_SUFFIX=-aarch64
44+
;;
45+
amd64|x86_64)
46+
export OS_ARCH_SUFFIX=
47+
;;
48+
*)
49+
echo "Unknown architecture $(arch)"
50+
exit 1
51+
;;
52+
esac
53+
54+
4055
case $BUILD_COMPILER in
4156
1|true|yes|YES)
42-
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$RELEASE_BRANCH/$OS/$RELEASE_TAG/$RELEASE_TAG-$HOST_OS.tar.gz"
57+
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$RELEASE_BRANCH/$OS$OS_ARCH_SUFFIX/$RELEASE_TAG/$RELEASE_TAG-$HOST_OS$OS_ARCH_SUFFIX.tar.gz"
4358
;;
4459
*)
45-
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS/$SWIFT_TAG/$SWIFT_BASE.tar.gz"
60+
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS$OS_ARCH_SUFFIX/$SWIFT_TAG/$SWIFT_BASE$OS_ARCH_SUFFIX.tar.gz"
4661
;;
4762
esac

0 commit comments

Comments
 (0)