Skip to content

Commit ab836f0

Browse files
compnerdhyp
authored andcommitted
GHA: begin wiring up the android builds
1 parent bef1c89 commit ab836f0

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
@@ -79,6 +79,7 @@ on:
7979

8080
env:
8181
SCCACHE_DIRECT: yes
82+
ANDROID_API_LEVEL: 28
8283

8384
jobs:
8485
context:
@@ -113,6 +114,7 @@ jobs:
113114
swift_tools_support_core_revision: ${{ steps.context.outputs.swift_tools_support_core_revision }}
114115
yams_revision: ${{ steps.context.outputs.yams_revision }}
115116
zlib_revision: ${{ steps.context.outputs.zlib_revision }}
117+
ANDROID_API_LEVEL: ${{ steps.context.outputs.ANDROID_API_LEVEL }}
116118
CMAKE_C_FLAGS: ${{ steps.context.outputs.CMAKE_C_FLAGS }}
117119
CMAKE_CXX_FLAGS: ${{ steps.context.outputs.CMAKE_CXX_FLAGS }}
118120
CMAKE_EXE_LINKER_FLAGS: ${{ steps.context.outputs.CMAKE_EXE_LINKER_FLAGS }}
@@ -226,6 +228,8 @@ jobs:
226228
echo windows_build_runner=${{ vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
227229
echo compilers_build_runner=${{ vars.COMPILERS_BUILD_RUNNER || vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
228230
231+
echo ANDROID_API_LEVEL=${{ env.ANDROID_API_LEVEL }} >> ${GITHUB_OUTPUT}
232+
229233
- uses: actions/upload-artifact@v4
230234
with:
231235
name: stable.xml
@@ -239,7 +243,64 @@ jobs:
239243
strategy:
240244
fail-fast: false
241245
matrix:
242-
arch: ['amd64', 'arm64', 'x86']
246+
include:
247+
- arch: amd64
248+
cc: cl
249+
cflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
250+
cxx: cl
251+
cxxflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
252+
os: Windows
253+
extra_flags:
254+
255+
- arch: arm64
256+
cc: cl
257+
cflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
258+
cxx: cl
259+
cxxflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
260+
os: Windows
261+
extra_flags:
262+
263+
- arch: x86
264+
cc: cl
265+
cflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
266+
cxx: cl
267+
cxxflags: ${{ needs.context.outputs.CMAKE_C_FLAGS }}
268+
os: Windows
269+
extra_flags:
270+
271+
- arch: arm64
272+
cc: clang
273+
cflags: -ffunction-sections -fdata-sections -g
274+
cxx: clang++
275+
cxxflags: -ffunction-sections -fdata-sections -g
276+
os: Android
277+
extra_flags: -D CMAKE_ANDROID_API=${{ needs.context.outputs.ANDROID_API_LEVEL }} -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a
278+
279+
- arch: armv7
280+
cc: clang
281+
cflags: -ffunction-sections -fdata-sections -g
282+
cxx: clang++
283+
cxxflags: -ffunction-sections -fdata-sections -g
284+
os: Android
285+
extra_flags: -D CMAKE_ANDROID_API=${{ needs.context.outputs.ANDROID_API_LEVEL }} -D CMAKE_ANDROID_ARCH_ABI=armeabi-v7a
286+
287+
- arch: i686
288+
cc: clang
289+
cflags: -ffunction-sections -fdata-sections -g
290+
cxx: clang++
291+
cxxflags: -ffunction-sections -fdata-sections -g
292+
os: Android
293+
extra_flags: -D CMAKE_ANDROID_API=${{ needs.context.outputs.ANDROID_API_LEVEL }} -D CMAKE_ANDROID_ARCH_ABI=x86
294+
295+
- arch: x86_64
296+
cc: clang
297+
cflags: -ffunction-sections -fdata-sections -g
298+
cxx: clang++
299+
cxxflags: -ffunction-sections -fdata-sections -g
300+
os: Android
301+
extra_flags: -D CMAKE_ANDROID_API=${{ needs.context.outputs.ANDROID_API_LEVEL }} -D CMAKE_ANDROID_ARCH_ABI=x86_64
302+
303+
name: ${{ matrix.os }} ${{ matrix.arch }} SQLite3
243304

244305
steps:
245306
- uses: actions/checkout@v4
@@ -257,6 +318,7 @@ jobs:
257318
run: Copy-Item ${{ github.workspace }}\SourceCache\swift-build\cmake\SQLite\CMakeLists.txt -destination ${{ github.workspace }}\SourceCache\sqlite-3.43.2\CMakeLists.txt
258319

259320
- uses: compnerd/gha-setup-vsdevenv@main
321+
if: matrix.os == 'Windows'
260322
with:
261323
host_arch: amd64
262324
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
@@ -266,7 +328,7 @@ jobs:
266328
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6
267329
with:
268330
max-size: 100M
269-
key: windows-${{ matrix.arch }}-sqlite
331+
key: ${{ matrix.os }}-${{ matrix.arch }}-sqlite
270332
variant: sccache
271333
append-timestamp: false
272334

@@ -275,14 +337,15 @@ jobs:
275337
cmake -B ${{ github.workspace }}/BinaryCache/sqlite-3.43.2 `
276338
-D BUILD_SHARED_LIBS=NO `
277339
-D CMAKE_BUILD_TYPE=Release `
278-
-D CMAKE_C_COMPILER=cl `
340+
-D CMAKE_C_COMPILER=${{ matrix.cc }} `
279341
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
280-
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
281-
-D CMAKE_CXX_COMPILER=cl `
342+
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" `
343+
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} `
282344
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
283-
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
345+
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" `
284346
-D CMAKE_MT=mt `
285347
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/sqlite-3.43.2/usr `
348+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
286349
-G Ninja `
287350
-S ${{ github.workspace }}/SourceCache/sqlite-3.43.2
288351
- name: Build SQLite
@@ -292,7 +355,7 @@ jobs:
292355

293356
- uses: actions/upload-artifact@v4
294357
with:
295-
name: sqlite-${{ matrix.arch }}-3.43.2
358+
name: sqlite-${{ matrix.os }}-${{ matrix.arch }}-3.43.2
296359
path: ${{ github.workspace }}/BuildRoot/Library/sqlite-3.43.2/usr
297360

298361
icu_tools:
@@ -1482,7 +1545,7 @@ jobs:
14821545
steps:
14831546
- uses: actions/download-artifact@v4
14841547
with:
1485-
name: sqlite-${{ matrix.arch }}-3.43.2
1548+
name: sqlite-windows-${{ matrix.arch }}-3.43.2
14861549
path: ${{ github.workspace }}/BuildRoot/Library/sqlite-3.43.2/usr
14871550
- name: Download Compilers
14881551
uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)