Skip to content

Commit 89ab51d

Browse files
compnerdhyp
authored andcommitted
GHA: begin wiring up the android builds
1 parent 125d3ea commit 89ab51d

File tree

1 file changed

+71
-8
lines changed

1 file changed

+71
-8
lines changed

.github/workflows/swift-toolchain.yml

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ on:
5555

5656
env:
5757
SCCACHE_DIRECT: yes
58+
ANDROID_API_LEVEL: 28
5859

5960
jobs:
6061
context:
@@ -89,6 +90,7 @@ jobs:
8990
swift_tools_support_core_revision: ${{ steps.context.outputs.swift_tools_support_core_revision }}
9091
yams_revision: ${{ steps.context.outputs.yams_revision }}
9192
zlib_revision: ${{ steps.context.outputs.zlib_revision }}
93+
ANDROID_API_LEVEL: ${{ steps.context.outputs.ANDROID_API_LEVEL }}
9294
CMAKE_C_FLAGS: ${{ steps.context.outputs.CMAKE_C_FLAGS }}
9395
CMAKE_CXX_FLAGS: ${{ steps.context.outputs.CMAKE_CXX_FLAGS }}
9496
CMAKE_EXE_LINKER_FLAGS: ${{ steps.context.outputs.CMAKE_EXE_LINKER_FLAGS }}
@@ -200,6 +202,8 @@ jobs:
200202
echo windows_build_runner=${{ vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
201203
echo compilers_build_runner=${{ vars.COMPILERS_BUILD_RUNNER || vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
202204
205+
echo ANDROID_API_LEVEL=${{ env.ANDROID_API_LEVEL }} >> ${GITHUB_OUTPUT}
206+
203207
- uses: actions/upload-artifact@v4
204208
with:
205209
name: stable.xml
@@ -213,7 +217,64 @@ jobs:
213217
strategy:
214218
fail-fast: false
215219
matrix:
216-
arch: ['amd64', 'arm64', 'x86']
220+
include:
221+
- arch: amd64
222+
cc: cl
223+
cflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
224+
cxx: cl
225+
cxxflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
226+
os: Windows
227+
extra_flags:
228+
229+
- arch: arm64
230+
cc: cl
231+
cflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
232+
cxx: cl
233+
cxxflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
234+
os: Windows
235+
extra_flags:
236+
237+
- arch: x86
238+
cc: cl
239+
cflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
240+
cxx: cl
241+
cxxflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
242+
os: Windows
243+
extra_flags:
244+
245+
- arch: arm64
246+
cc: clang
247+
cflags: -ffunction-sections -fdata-sections -g
248+
cxx: clang++
249+
cxxflags: -ffunction-sections -fdata-sections -g
250+
os: Android
251+
extra_flags: -D CMAKE_ANDROID_API=${{ needs.context.outputs.ANDROID_API_LEVEL }} -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a
252+
253+
- arch: armv7
254+
cc: clang
255+
cflags: -ffunction-sections -fdata-sections -g
256+
cxx: clang++
257+
cxxflags: -ffunction-sections -fdata-sections -g
258+
os: Android
259+
extra_flags: -D CMAKE_ANDROID_API=${{ needs.context.outputs.ANDROID_API_LEVEL }} -D CMAKE_ANDROID_ARCH_ABI=armeabi-v7a
260+
261+
- arch: i686
262+
cc: clang
263+
cflags: -ffunction-sections -fdata-sections -g
264+
cxx: clang++
265+
cxxflags: -ffunction-sections -fdata-sections -g
266+
os: Android
267+
extra_flags: -D CMAKE_ANDROID_API=${{ needs.context.outputs.ANDROID_API_LEVEL }} -D CMAKE_ANDROID_ARCH_ABI=x86
268+
269+
- arch: x86_64
270+
cc: clang
271+
cflags: -ffunction-sections -fdata-sections -g
272+
cxx: clang++
273+
cxxflags: -ffunction-sections -fdata-sections -g
274+
os: Android
275+
extra_flags: -D CMAKE_ANDROID_API=${{ needs.context.outputs.ANDROID_API_LEVEL }} -D CMAKE_ANDROID_ARCH_ABI=x86_64
276+
277+
name: ${{ matrix.os }} ${{ matrix.arch }} SQLite3
217278

218279
steps:
219280
- uses: actions/checkout@v4
@@ -231,6 +292,7 @@ jobs:
231292
run: Copy-Item ${{ github.workspace }}\SourceCache\swift-build\cmake\SQLite\CMakeLists.txt -destination ${{ github.workspace }}\SourceCache\sqlite-3.43.2\CMakeLists.txt
232293

233294
- uses: compnerd/gha-setup-vsdevenv@main
295+
if: matrix.os == 'Windows'
234296
with:
235297
host_arch: amd64
236298
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
@@ -240,7 +302,7 @@ jobs:
240302
uses: compnerd/[email protected]
241303
with:
242304
max-size: 100M
243-
key: windows-${{ matrix.arch }}-sqlite
305+
key: ${{ matrix.os }}-${{ matrix.arch }}-sqlite
244306
variant: sccache
245307
append-timestamp: false
246308

@@ -249,14 +311,15 @@ jobs:
249311
cmake -B ${{ github.workspace }}/BinaryCache/sqlite-3.43.2 `
250312
-D BUILD_SHARED_LIBS=NO `
251313
-D CMAKE_BUILD_TYPE=Release `
252-
-D CMAKE_C_COMPILER=cl `
314+
-D CMAKE_C_COMPILER=${{ matrix.cc }} `
253315
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
254-
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
255-
-D CMAKE_CXX_COMPILER=cl `
316+
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" `
317+
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} `
256318
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
257-
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
319+
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" `
258320
-D CMAKE_MT=mt `
259321
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/sqlite-3.43.2/usr `
322+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
260323
-G Ninja `
261324
-S ${{ github.workspace }}/SourceCache/sqlite-3.43.2
262325
- name: Build SQLite
@@ -266,7 +329,7 @@ jobs:
266329

267330
- uses: actions/upload-artifact@v4
268331
with:
269-
name: sqlite-${{ matrix.arch }}-3.43.2
332+
name: sqlite-${{ matrix.os }}-${{ matrix.arch }}-3.43.2
270333
path: ${{ github.workspace }}/BuildRoot/Library/sqlite-3.43.2/usr
271334

272335
icu_tools:
@@ -1451,7 +1514,7 @@ jobs:
14511514
steps:
14521515
- uses: actions/download-artifact@v4
14531516
with:
1454-
name: sqlite-${{ matrix.arch }}-3.43.2
1517+
name: sqlite-windows-${{ matrix.arch }}-3.43.2
14551518
path: ${{ github.workspace }}/BuildRoot/Library/sqlite-3.43.2/usr
14561519
- name: Download Compilers
14571520
uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)