@@ -21,195 +21,3 @@ jobs:
2121 name : docker-logs
2222 path : |
2323 *.log
24-
25- android-build :
26- name : Android ${{ matrix.build-type }} ${{ matrix.swift-version }} ${{ matrix.arch }} ${{ matrix.runner }} (compiler=${{ matrix.build-compiler }})
27- strategy :
28- fail-fast : false
29- matrix :
30- include :
31- - swift-version : ' tag:swift-DEVELOPMENT-SNAPSHOT-2025-10-16-a'
32- build-type : ' docker'
33- runner : ' ubuntu-24.04'
34- - swift-version : ' tag:swift-DEVELOPMENT-SNAPSHOT-2025-10-16-a'
35- build-type : ' local'
36- runner : ' ubuntu-24.04'
37- runs-on : ${{ matrix.runner }}
38- # 16 hour timeout
39- timeout-minutes : 960
40- steps :
41- - name : Free Disk Space
42- if : ${{ matrix.runner != 'self-hosted' }}
43- run : |
44- df -h
45- # brings available space from 25G to 32G
46- # otherwise we sometimes run out of space during the build
47- sudo rm -rf /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/share/chromium /usr/local/share/powershell /usr/share/dotnet /opt/ghc /opt/hostedtoolcache /usr/local/graalvm/ /usr/local/.ghcup/ /usr/local/lib/node_modules /usr/local/share/boost
48- sudo docker image prune --all --force
49- sudo docker builder prune -a
50- df -h
51- - name : Setup
52- id : config
53- run : |
54- # these variabes are used by build-docker and build-local
55- # to determine which Swift version to build for
56- echo "SWIFT_VERSION=${{ matrix.swift-version }}" >> $GITHUB_ENV
57- # pass the build-compiler matrix through to the build script
58- echo "BUILD_COMPILER=${{ matrix.build-compiler }}" >> $GITHUB_ENV
59- echo "TARGET_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
60- echo "WORKDIR=${{ runner.temp }}/swift-android-sdk" >> $GITHUB_ENV
61- - name : Checkout repository
62- uses : actions/checkout@v4
63- - name : Build Android SDK (Local)
64- if : ${{ matrix.build-type == 'local' }}
65- working-directory : swift-ci/sdks/android
66- run : |
67- sudo apt install -q patchelf build-essential cmake ninja-build python3 golang git gnupg2 libcurl4-openssl-dev libedit-dev libicu-dev libncurses5-dev libpython3-dev libsqlite3-dev libxml2-dev rsync uuid-dev uuid-runtime tzdata curl unzip
68- ./build-local ${SWIFT_VERSION} ${WORKDIR}
69- - name : Build Android SDK (Docker)
70- if : ${{ matrix.build-type == 'docker' }}
71- working-directory : swift-ci/sdks/android
72- run : |
73- ./build-docker ${SWIFT_VERSION} ${WORKDIR}
74- - name : Install Host Toolchain
75- if : ${{ matrix.build-type == 'docker' }}
76- working-directory : swift-ci/sdks/android
77- run : |
78- # when building in a Docker container, we don't have a local host toolchain,
79- # but we need one in order to run the SDK validation tests, so we install it now
80- HOST_OS=ubuntu$(lsb_release -sr)
81- source ./scripts/toolchain-vars.sh
82- mkdir -p ${WORKDIR}/host-toolchain
83- ./scripts/install-swift.sh ${WORKDIR}/host-toolchain/$SWIFT_BASE/usr
84- ls ${WORKDIR}/host-toolchain
85- ${WORKDIR}/host-toolchain/*/usr/bin/swift --version
86- - name : Get artifact info
87- id : info
88- shell : bash
89- run : |
90- set -ex
91- SWIFT_ROOT=$(dirname ${WORKDIR}/host-toolchain/*/usr)
92- echo "swift-root=${SWIFT_ROOT}" >> $GITHUB_OUTPUT
93- echo "swift-path=${SWIFT_ROOT}/usr/bin/swift" >> $GITHUB_OUTPUT
94-
95- ARTIFACT_PATH=$(realpath ${WORKDIR}/products/*.artifactbundle.tar.gz)
96- echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
97- echo "sdk-id=x86_64-unknown-linux-android23" >> $GITHUB_OUTPUT
98-
99- ARTIFACT_EXT=".artifactbundle.tar.gz"
100- ARTIFACT_NAME="$(basename ${ARTIFACT_PATH} ${ARTIFACT_EXT})"
101- # depending on whether we are building locally or in a container, add a maker to the name
102- if [[ "${{ matrix.build-type }}" == 'local' ]]; then
103- ARTIFACT_NAME="${ARTIFACT_NAME}-local"
104- fi
105- if [[ "${{ matrix.build-compiler }}" == '1' ]]; then
106- ARTIFACT_NAME="${ARTIFACT_NAME}-hostbuild"
107- fi
108- # artifacts need a unique name so we suffix with the matrix arch(s)
109- if [[ ! -z "${{ matrix.arch }}" ]]; then
110- ARTIFACT_NAME="${ARTIFACT_NAME}-$(echo ${{ matrix.arch }} | tr ',' '-')"
111- fi
112- ARTIFACT_NAME="${ARTIFACT_NAME}${ARTIFACT_EXT}"
113-
114- # There is no way to prevent even a single-file artifact from being zipped:
115- # https://github.com/actions/upload-artifact?tab=readme-ov-file#zip-archives
116- # so the actual artifact download will look like:
117- # swift-6.1-RELEASE_android-0.1-x86_64.artifactbundle.tar.gz.zip
118- echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
119- - name : Upload SDK artifactbundle
120- uses : actions/upload-artifact@v4
121- with :
122- compression-level : 0
123- name : ${{ steps.info.outputs.artifact-name }}
124- path : ${{ steps.info.outputs.artifact-path }}
125- - name : Cleanup
126- if : ${{ matrix.runner != 'self-hosted' }}
127- run : |
128- # need to free up some space or else when installing we get: No space left on device
129- df -h
130- rm -rf ${WORKDIR}/{build,source}
131- sudo docker image prune --all --force
132- sudo docker builder prune -a
133- df -h
134- - name : Install artifactbundle
135- if : ${{ matrix.runner != 'self-hosted' }}
136- shell : bash
137- run : |
138- set -ex
139- ${{ steps.info.outputs.swift-path }} sdk install ${{ steps.info.outputs.artifact-path }}
140- ${{ steps.info.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.info.outputs.swift-path }} sdk list | head -n 1) ${{ steps.info.outputs.sdk-id }}
141- # recent releases require that ANDROID_NDK_ROOT *not* be set
142- # see https://github.com/swiftlang/swift-driver/pull/1879
143- echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV
144-
145- - name : Create Demo Project
146- if : ${{ matrix.runner != 'self-hosted' }}
147- run : |
148- cd ${{ runner.temp }}
149- mkdir DemoProject
150- cd DemoProject
151- ${{ steps.info.outputs.swift-path }} --version
152- ${{ steps.info.outputs.swift-path }} package init
153- echo 'import Foundation' >> Sources/DemoProject/DemoProject.swift
154- echo 'import FoundationEssentials' >> Sources/DemoProject/DemoProject.swift
155- echo 'import FoundationXML' >> Sources/DemoProject/DemoProject.swift
156- echo 'import FoundationNetworking' >> Sources/DemoProject/DemoProject.swift
157- echo 'import Dispatch' >> Sources/DemoProject/DemoProject.swift
158- echo 'import Android' >> Sources/DemoProject/DemoProject.swift
159-
160- - name : Test Demo Project on Android
161- uses : skiptools/swift-android-action@main
162- if : ${{ matrix.runner != 'self-hosted' }}
163- with :
164- # only test for the complete arch SDK build to speed up CI
165- # run-tests: ${{ matrix.arch == '' }}
166- package-path : ${{ runner.temp }}/DemoProject
167- installed-sdk : ${{ steps.info.outputs.sdk-id }}
168- installed-swift : ${{ steps.info.outputs.swift-root }}
169- android-api-level : 23
170-
171- - name : Checkout swift-algorithms
172- if : ${{ matrix.runner != 'self-hosted' }}
173- uses : actions/checkout@v4
174- with :
175- repository : apple/swift-algorithms
176- path : swift-algorithms
177- - name : Test swift-algorithms
178- if : ${{ matrix.runner != 'self-hosted' }}
179- uses : skiptools/swift-android-action@main
180- with :
181- package-path : swift-algorithms
182- installed-sdk : ${{ steps.info.outputs.sdk-id }}
183- installed-swift : ${{ steps.info.outputs.swift-root }}
184- android-api-level : 23
185-
186- - name : Checkout swift-system
187- if : ${{ matrix.runner != 'self-hosted' }}
188- uses : actions/checkout@v4
189- with :
190- repository : apple/swift-system
191- path : swift-system
192- - name : Test swift-system
193- if : ${{ matrix.runner != 'self-hosted' }}
194- uses : skiptools/swift-android-action@main
195- with :
196- package-path : swift-system
197- installed-sdk : ${{ steps.info.outputs.sdk-id }}
198- installed-swift : ${{ steps.info.outputs.swift-root }}
199- android-api-level : 23
200-
201- - name : Checkout swift-collections
202- if : ${{ matrix.runner != 'self-hosted' }}
203- uses : actions/checkout@v4
204- with :
205- repository : apple/swift-collections
206- path : swift-collections
207- - name : Test swift-collections
208- if : ${{ matrix.runner != 'self-hosted' }}
209- uses : skiptools/swift-android-action@main
210- with :
211- package-path : swift-collections
212- installed-sdk : ${{ steps.info.outputs.sdk-id }}
213- installed-swift : ${{ steps.info.outputs.swift-root }}
214- android-api-level : 23
215-
0 commit comments