@@ -22,154 +22,3 @@ jobs:
2222 path : |
2323 *.log
2424
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 : ' swift-6.2-branch'
32- build-type : ' docker'
33- build-compiler : ' 0'
34- runner : ' ubuntu-24.04'
35- - swift-version : ' development'
36- build-type : ' docker'
37- build-compiler : ' 0'
38- runner : ' ubuntu-24.04'
39- runs-on : ${{ matrix.runner }}
40- steps :
41- - name : Free Disk Space
42- run : |
43- df -h
44- # brings available space from 25G to 32G
45- # otherwise we sometimes run out of space during the build
46- 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
47- sudo docker image prune --all --force
48- sudo docker builder prune -a
49- df -h
50- - name : Setup
51- id : config
52- run : |
53- # these variabes are used by build-docker and build-local
54- # to determine which Swift version to build for
55- echo "BUILD_SCHEME=${{ matrix.swift-version }}" >> $GITHUB_ENV
56- # pass the build-compiler matrix through to the build script
57- echo "BUILD_COMPILER=${{ matrix.build-compiler }}" >> $GITHUB_ENV
58- echo "TARGET_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
59- echo "WORKDIR=${{ runner.temp }}/swift-android-sdk" >> $GITHUB_ENV
60- - name : Checkout repository
61- uses : actions/checkout@v4
62- - name : Build Android SDK (Local)
63- if : ${{ matrix.build-type == 'local' }}
64- working-directory : swift-ci/sdks/android
65- run : |
66- 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
67- ./build-local ${BUILD_SCHEME} ${WORKDIR}
68- - name : Build Android SDK (Docker)
69- if : ${{ matrix.build-type == 'docker' }}
70- working-directory : swift-ci/sdks/android
71- run : |
72- ./build-docker ${BUILD_SCHEME} ${WORKDIR}
73- - name : Install Host Toolchain
74- if : ${{ matrix.build-type == 'docker' }}
75- working-directory : swift-ci/sdks/android
76- run : |
77- # when building in a Docker container, we don't have a local host toolchain,
78- # but we need one in order to run the SDK validation tests, so we install it now
79- HOST_OS=ubuntu$(lsb_release -sr)
80- source ./scripts/toolchain-vars.sh
81- mkdir -p ${WORKDIR}/host-toolchain
82- ./scripts/install-swift.sh ${WORKDIR}/host-toolchain/$SWIFT_BASE/usr
83- ls ${WORKDIR}/host-toolchain
84- ${WORKDIR}/host-toolchain/*/usr/bin/swift --version
85- - name : Get artifact info
86- id : info
87- shell : bash
88- run : |
89- set -ex
90- SWIFT_ROOT=$(dirname ${WORKDIR}/host-toolchain/*/usr)
91- echo "swift-root=${SWIFT_ROOT}" >> $GITHUB_OUTPUT
92- echo "swift-path=${SWIFT_ROOT}/usr/bin/swift" >> $GITHUB_OUTPUT
93-
94- ARTIFACT_PATH=$(realpath ${WORKDIR}/products/*.artifactbundle.tar.gz)
95- echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
96- echo "sdk-id=x86_64-unknown-linux-android28" >> $GITHUB_OUTPUT
97-
98- ARTIFACT_EXT=".artifactbundle.tar.gz"
99- ARTIFACT_NAME="$(basename ${ARTIFACT_PATH} ${ARTIFACT_EXT})"
100- # depending on whether we are building locally or in a container, add a maker to the name
101- if [[ "${{ matrix.build-type }}" == 'local' ]]; then
102- ARTIFACT_NAME="${ARTIFACT_NAME}-local"
103- fi
104- if [[ "${{ matrix.build-compiler }}" == '1' ]]; then
105- ARTIFACT_NAME="${ARTIFACT_NAME}-hostbuild"
106- fi
107- # artifacts need a unique name so we suffix with the matrix arch(s)
108- if [[ ! -z "${{ matrix.arch }}" ]]; then
109- ARTIFACT_NAME="${ARTIFACT_NAME}-$(echo ${{ matrix.arch }} | tr ',' '-')"
110- fi
111- ARTIFACT_NAME="${ARTIFACT_NAME}${ARTIFACT_EXT}"
112-
113- # There is no way to prevent even a single-file artifact from being zipped:
114- # https://github.com/actions/upload-artifact?tab=readme-ov-file#zip-archives
115- # so the actual artifact download will look like:
116- # swift-6.1-RELEASE_android-0.1-x86_64.artifactbundle.tar.gz.zip
117- echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
118- - name : Upload SDK artifactbundle
119- uses : actions/upload-artifact@v4
120- with :
121- compression-level : 0
122- name : ${{ steps.info.outputs.artifact-name }}
123- path : ${{ steps.info.outputs.artifact-path }}
124- - name : Cleanup
125- run : |
126- # need to free up some space or else when installing we get: No space left on device
127- df -h
128- rm -rf ${WORKDIR}/{build,source}
129- sudo docker image prune --all --force
130- sudo docker builder prune -a
131- df -h
132- - name : Install artifactbundle
133- shell : bash
134- run : |
135- set -ex
136- ${{ steps.info.outputs.swift-path }} sdk install ${{ steps.info.outputs.artifact-path }}
137- ${{ steps.info.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.info.outputs.swift-path }} sdk list | head -n 1) ${{ steps.info.outputs.sdk-id }}
138- # recent releases require that ANDROID_NDK_ROOT *not* be set
139- # see https://github.com/swiftlang/swift-driver/pull/1879
140- echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV
141-
142- - name : Create Demo Project
143- run : |
144- cd ${{ runner.temp }}
145- mkdir DemoProject
146- cd DemoProject
147- ${{ steps.info.outputs.swift-path }} --version
148- ${{ steps.info.outputs.swift-path }} package init
149- echo 'import Foundation' >> Sources/DemoProject/DemoProject.swift
150- echo 'import FoundationEssentials' >> Sources/DemoProject/DemoProject.swift
151- echo 'import FoundationXML' >> Sources/DemoProject/DemoProject.swift
152- echo 'import FoundationNetworking' >> Sources/DemoProject/DemoProject.swift
153- echo 'import Dispatch' >> Sources/DemoProject/DemoProject.swift
154- echo 'import Android' >> Sources/DemoProject/DemoProject.swift
155- - name : Test Demo Project on Android
156- uses : skiptools/swift-android-action@main
157- with :
158- # only test for the complete arch SDK build to speed up CI
159- # run-tests: ${{ matrix.arch == '' }}
160- package-path : ${{ runner.temp }}/DemoProject
161- installed-sdk : ${{ steps.info.outputs.sdk-id }}
162- installed-swift : ${{ steps.info.outputs.swift-root }}
163-
164- - name : Checkout swift-algorithms
165- uses : actions/checkout@v4
166- with :
167- repository : apple/swift-algorithms
168- path : swift-algorithms
169- - name : Test swift-algorithms
170- uses : skiptools/swift-android-action@main
171- with :
172- package-path : swift-algorithms
173- installed-sdk : ${{ steps.info.outputs.sdk-id }}
174- installed-swift : ${{ steps.info.outputs.swift-root }}
175-
0 commit comments