88jobs :
99   build :
1010     name : Build Docker images 
11-      #  disabled for CI testing
12-      if : false 
1311     runs-on : ubuntu-latest 
1412     steps :
1513      - name : Checkout repository 
2624
2725    static-linux-build :
2826     name : Build Static Linux image 
29-      #  disabled for CI testing
30-      if : false 
3127     runs-on : ubuntu-latest 
3228     steps :
3329      - name : Checkout repository 
@@ -37,16 +33,18 @@ jobs:
3733        run : ./build 
3834
3935   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 
4137     strategy :
4238       fail-fast : false 
4339       matrix :
40+          build-type : ['docker'] 
41+          # build-type: ['docker', 'local']
4442         #  blank arch builds all (aarch64,x86_64,armv7)
45-          # arch: ['']
43+          arch : [''] 
4644         #  builds only x86_64 to speed up the validation
4745         # arch: ['x86_64']
4846         #  build both the quick (x86_64) and complete (aarch64,x86_64,armv7) SDKs
49-          arch : ['x86_64', ''] 
47+          # arch: ['x86_64', '']
5048         swift-version : ['release', 'devel', 'trunk'] 
5149     runs-on : ubuntu-24.04 
5250     steps :
@@ -59,31 +57,60 @@ jobs:
5957          sudo docker image prune --all --force 
6058          sudo docker builder prune -a 
6159          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 
6268       - name : Checkout repository 
6369        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 
6575        run : | 
6676          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' }} 
6885        working-directory : swift-ci/sdks/android 
6986        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 
7195       - name : Get artifact info 
7296        id : info 
7397        shell : bash 
7498        run : | 
7599          set -ex 
76-           SWIFT_ROOT=$(dirname ${{ runner.temp }}/swift-android-sdk /host-toolchain/*/usr) 
100+           SWIFT_ROOT=$(dirname ${WORKDIR} /host-toolchain/*/usr) 
77101          echo "swift-root=${SWIFT_ROOT}" >> $GITHUB_OUTPUT 
78102          echo "swift-path=${SWIFT_ROOT}/usr/bin/swift" >> $GITHUB_OUTPUT 
79103
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) 
82105          echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT 
83106          echo "sdk-id=x86_64-unknown-linux-android28" >> $GITHUB_OUTPUT 
84107
85108          ARTIFACT_EXT=".artifactbundle.tar.gz" 
86109          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 
87114          # artifacts need a unique name so we suffix with the matrix arch(s) 
88115          if [[ ! -z "${{ matrix.arch }}" ]]; then 
89116            ARTIFACT_NAME="${ARTIFACT_NAME}-$(echo ${{ matrix.arch }} | tr ',' '-')" 
95122          # so the actual artifact download will look like: 
96123          # swift-6.1-RELEASE_android-0.1-x86_64.artifactbundle.tar.gz.zip 
97124          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' 
101125       - name : Upload SDK artifactbundle 
102126        uses : actions/upload-artifact@v4 
103127        with :
@@ -108,7 +132,9 @@ jobs:
108132        run : | 
109133          # need to free up some space or else when installing we get: No space left on device 
110134          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 
112138          df -h 
113139       - name : Install artifactbundle 
114140        shell : bash 
@@ -117,7 +143,7 @@ jobs:
117143          ${{ steps.info.outputs.swift-path }} sdk install ${{ steps.info.outputs.artifact-path }} 
118144          ${{ steps.info.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.info.outputs.swift-path }} sdk list | head -n 1) ${{ steps.info.outputs.sdk-id }} 
119145          # 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  
121147          echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV 
122148
123149       - name : Create Demo Project 
0 commit comments