8
8
jobs :
9
9
build :
10
10
name : Build Docker images
11
- # disabled for CI testing
12
- if : false
13
11
runs-on : ubuntu-latest
14
12
steps :
15
13
- name : Checkout repository
26
24
27
25
static-linux-build :
28
26
name : Build Static Linux image
29
- # disabled for CI testing
30
- if : false
31
27
runs-on : ubuntu-latest
32
28
steps :
33
29
- name : Checkout repository
@@ -37,16 +33,18 @@ jobs:
37
33
run : ./build
38
34
39
35
android-build :
40
- name : Build Android ${{ matrix.swift-version }} ${{ matrix.arch }} SDK
36
+ name : Build Android ${{ matrix.build-type }} ${{ matrix. swift-version }} ${{ matrix.arch }} SDK
41
37
strategy :
42
38
fail-fast : false
43
39
matrix :
40
+ build-type : ['docker']
41
+ # build-type: ['docker', 'local']
44
42
# blank arch builds all (aarch64,x86_64,armv7)
45
- # arch: ['']
43
+ arch : ['']
46
44
# builds only x86_64 to speed up the validation
47
45
# arch: ['x86_64']
48
46
# build both the quick (x86_64) and complete (aarch64,x86_64,armv7) SDKs
49
- arch : ['x86_64', '']
47
+ # arch: ['x86_64', '']
50
48
swift-version : ['release', 'devel', 'trunk']
51
49
runs-on : ubuntu-24.04
52
50
steps :
@@ -59,31 +57,60 @@ jobs:
59
57
sudo docker image prune --all --force
60
58
sudo docker builder prune -a
61
59
df -h
60
+ - name : Setup
61
+ id : config
62
+ run : |
63
+ # these variabes are used by build-docker and build-local
64
+ # to determine which Swift version to build for
65
+ echo "BUILD_VERSION=${{ matrix.swift-version }}" >> $GITHUB_ENV
66
+ echo "TARGET_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
67
+ echo "WORKDIR=${{ runner.temp }}/swift-android-sdk" >> $GITHUB_ENV
62
68
- name : Checkout repository
63
69
uses : actions/checkout@v4
64
- - name : Install Dependencies
70
+ with :
71
+ submodules : ' true'
72
+ - name : Build Android SDK (Local)
73
+ if : ${{ matrix.build-type == 'local' }}
74
+ working-directory : swift-ci/sdks/android
65
75
run : |
66
76
sudo apt install -q ninja-build patchelf
67
- - name : Build Android SDK
77
+ ./build-local ${BUILD_VERSION} ${WORKDIR}
78
+ - name : Build Android SDK (Docker)
79
+ if : ${{ matrix.build-type == 'docker' }}
80
+ working-directory : swift-ci/sdks/android
81
+ run : |
82
+ ./build-docker ${BUILD_VERSION} ${WORKDIR}
83
+ - name : Install Host Toolchain
84
+ if : ${{ matrix.build-type == 'docker' }}
68
85
working-directory : swift-ci/sdks/android
69
86
run : |
70
- BUILD_VERSION=${{ matrix.swift-version }} TARGET_ARCHS=${{ matrix.arch }} ./build
87
+ # when building in a Docker container, we don't have a local host toolchain,
88
+ # but we need one in order to run the SDK validation tests, so we install it now
89
+ HOST_OS=ubuntu$(lsb_release -sr)
90
+ source ./scripts/toolchain-vars.sh
91
+ mkdir -p ${WORKDIR}/host-toolchain
92
+ ./scripts/install-swift.sh ${WORKDIR}/host-toolchain/$SWIFT_BASE/usr
93
+ ls ${WORKDIR}/host-toolchain
94
+ ${WORKDIR}/host-toolchain/*/usr/bin/swift --version
71
95
- name : Get artifact info
72
96
id : info
73
97
shell : bash
74
98
run : |
75
99
set -ex
76
- SWIFT_ROOT=$(dirname ${{ runner.temp }}/swift-android-sdk /host-toolchain/*/usr)
100
+ SWIFT_ROOT=$(dirname ${WORKDIR} /host-toolchain/*/usr)
77
101
echo "swift-root=${SWIFT_ROOT}" >> $GITHUB_OUTPUT
78
102
echo "swift-path=${SWIFT_ROOT}/usr/bin/swift" >> $GITHUB_OUTPUT
79
103
80
- ARTIFACT_BUILD=$(realpath ${{ runner.temp }}/swift-android-sdk/build/*.artifactbundle)
81
- ARTIFACT_PATH=$(realpath ${{ runner.temp }}/swift-android-sdk/products/*.artifactbundle.tar.gz)
104
+ ARTIFACT_PATH=$(realpath ${WORKDIR}/products/*.artifactbundle.tar.gz)
82
105
echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
83
106
echo "sdk-id=x86_64-unknown-linux-android28" >> $GITHUB_OUTPUT
84
107
85
108
ARTIFACT_EXT=".artifactbundle.tar.gz"
86
109
ARTIFACT_NAME="$(basename ${ARTIFACT_PATH} ${ARTIFACT_EXT})"
110
+ # depending on whether we are building locally or in a container, add a maker to the name
111
+ if [[ "${{ matrix.build-type }}" == 'local' ]]; then
112
+ ARTIFACT_NAME="${ARTIFACT_NAME}-local"
113
+ fi
87
114
# artifacts need a unique name so we suffix with the matrix arch(s)
88
115
if [[ ! -z "${{ matrix.arch }}" ]]; then
89
116
ARTIFACT_NAME="${ARTIFACT_NAME}-$(echo ${{ matrix.arch }} | tr ',' '-')"
95
122
# so the actual artifact download will look like:
96
123
# swift-6.1-RELEASE_android-0.1-x86_64.artifactbundle.tar.gz.zip
97
124
echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
98
-
99
- # show an abridged tree
100
- 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'
101
125
- name : Upload SDK artifactbundle
102
126
uses : actions/upload-artifact@v4
103
127
with :
@@ -108,7 +132,9 @@ jobs:
108
132
run : |
109
133
# need to free up some space or else when installing we get: No space left on device
110
134
df -h
111
- rm -rf ${{ runner.temp }}/swift-android-sdk/{build,src}
135
+ rm -rf ${WORKDIR}/{build,source}
136
+ sudo docker image prune --all --force
137
+ sudo docker builder prune -a
112
138
df -h
113
139
- name : Install artifactbundle
114
140
shell : bash
@@ -117,7 +143,7 @@ jobs:
117
143
${{ steps.info.outputs.swift-path }} sdk install ${{ steps.info.outputs.artifact-path }}
118
144
${{ steps.info.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.info.outputs.swift-path }} sdk list | head -n 1) ${{ steps.info.outputs.sdk-id }}
119
145
# recent releases require that ANDROID_NDK_ROOT *not* be set
120
- # see https://github.com/finagolfin /swift-android-sdk/issues/207
146
+ # see https://github.com/swiftlang /swift-driver/pull/1879
121
147
echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV
122
148
123
149
- name : Create Demo Project
0 commit comments