2021-07-11 10:38:33 -06:00
|
|
|
name: Build (Android)
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
2022-12-04 10:06:06 -07:00
|
|
|
concurrency:
|
2022-12-28 14:06:46 -07:00
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
2022-12-04 10:06:06 -07:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-07-11 10:38:33 -06:00
|
|
|
jobs:
|
|
|
|
android:
|
2022-06-14 22:10:25 -06:00
|
|
|
name: ${{ matrix.platform.name }}
|
2021-07-11 10:38:33 -06:00
|
|
|
runs-on: ubuntu-latest
|
2022-06-14 22:10:25 -06:00
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform:
|
2024-03-11 13:16:20 -06:00
|
|
|
- { name: "Android.mk" }
|
|
|
|
- { name: "CMake", cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64", apk-artifact: "SDL-android-apks-arm64" }
|
|
|
|
- { name: "CMake (lean and mean)", cmake: 1, cppflags: "-DSDL_LEAN_AND_MEAN=1", android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-lean-android-arm64", apk-artifact: "SDL-lean-android-apks-arm64" }
|
2022-06-14 22:10:25 -06:00
|
|
|
|
2021-07-11 10:38:33 -06:00
|
|
|
steps:
|
2024-01-25 18:33:20 -07:00
|
|
|
- uses: actions/checkout@v4
|
2021-07-11 10:38:33 -06:00
|
|
|
- uses: nttld/setup-ndk@v1
|
2022-06-14 22:10:25 -06:00
|
|
|
id: setup_ndk
|
2021-07-11 10:38:33 -06:00
|
|
|
with:
|
2023-11-22 11:22:31 -07:00
|
|
|
local-cache: true
|
2022-07-23 09:29:08 -06:00
|
|
|
ndk-version: r21e
|
2022-06-14 22:10:25 -06:00
|
|
|
- name: Build (Android.mk)
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'Android.mk') }}
|
2022-06-14 22:10:25 -06:00
|
|
|
run: |
|
|
|
|
./build-scripts/androidbuildlibs.sh
|
2024-02-23 13:20:30 -07:00
|
|
|
- uses: actions/setup-java@v4
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2023-03-27 04:03:42 -06:00
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '11'
|
2022-06-14 22:10:25 -06:00
|
|
|
- name: Setup (CMake)
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2022-06-14 22:10:25 -06:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2022-06-16 08:38:58 -06:00
|
|
|
sudo apt-get install ninja-build pkg-config
|
2022-06-14 22:10:25 -06:00
|
|
|
- name: Configure (CMake)
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2022-06-14 22:10:25 -06:00
|
|
|
run: |
|
2023-01-23 21:30:24 -07:00
|
|
|
cmake -S . -B build \
|
2024-03-11 13:16:20 -06:00
|
|
|
-DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" \
|
|
|
|
-DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" \
|
2023-01-23 21:30:24 -07:00
|
|
|
-Wdeprecated -Wdev -Werror \
|
2022-06-14 22:10:25 -06:00
|
|
|
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
|
2022-10-05 21:27:37 -06:00
|
|
|
-DSDL_WERROR=ON \
|
2023-03-27 16:38:07 -06:00
|
|
|
-DSDL_TESTS=ON \
|
|
|
|
-DSDL_INSTALL_TESTS=ON \
|
2022-10-25 21:26:42 -06:00
|
|
|
-DSDL_CLANG_TIDY=ON \
|
2022-06-16 08:38:58 -06:00
|
|
|
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
|
|
|
|
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
|
2023-02-16 12:15:59 -07:00
|
|
|
-DSDL_SHARED=ON \
|
|
|
|
-DSDL_STATIC=ON \
|
2022-06-14 22:10:25 -06:00
|
|
|
-DSDL_STATIC_PIC=ON \
|
2022-10-20 13:02:21 -06:00
|
|
|
-DSDL_VENDOR_INFO="Github Workflow" \
|
2022-06-14 22:10:25 -06:00
|
|
|
-DCMAKE_INSTALL_PREFIX=prefix \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-GNinja
|
|
|
|
- name: Build (CMake)
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2022-06-14 22:10:25 -06:00
|
|
|
run: |
|
|
|
|
cmake --build build --config Release --parallel --verbose
|
2023-03-27 04:03:42 -06:00
|
|
|
- name: Build test apk's (CMake)
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2023-03-27 04:03:42 -06:00
|
|
|
run: |
|
2024-04-04 19:09:15 -06:00
|
|
|
cmake --build build --config Release --parallel --verbose --target testautomation-apk testaudiocapture-apk testcontroller-apk testmultiaudio-apk testsprite-apk
|
2022-06-14 22:10:25 -06:00
|
|
|
- name: Install (CMake)
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2022-06-14 22:10:25 -06:00
|
|
|
run: |
|
|
|
|
cmake --install build --config Release
|
2022-11-21 22:36:19 -07:00
|
|
|
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
|
2022-06-14 22:10:25 -06:00
|
|
|
( cd prefix; find ) | LC_ALL=C sort -u
|
2023-01-28 22:12:40 -07:00
|
|
|
- name: Package (CPack)
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2023-01-28 22:12:40 -07:00
|
|
|
run: |
|
|
|
|
cmake --build build/ --config Release --target package
|
2022-06-14 22:10:25 -06:00
|
|
|
- name: Verify CMake configuration files
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2022-06-14 22:10:25 -06:00
|
|
|
run: |
|
|
|
|
cmake -S cmake/test -B cmake_config_build -G Ninja \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
|
2022-06-16 08:38:58 -06:00
|
|
|
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
|
|
|
|
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
|
2022-06-14 22:10:25 -06:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2022-11-21 22:36:19 -07:00
|
|
|
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
|
2022-06-14 22:10:25 -06:00
|
|
|
cmake --build cmake_config_build --verbose
|
2022-11-21 22:36:19 -07:00
|
|
|
- name: Verify sdl3.pc
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2022-06-16 08:38:58 -06:00
|
|
|
run: |
|
2022-07-25 07:08:33 -06:00
|
|
|
export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
|
2022-11-21 22:36:19 -07:00
|
|
|
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
|
2022-06-16 08:38:58 -06:00
|
|
|
cmake/test/test_pkgconfig.sh
|
2024-01-25 18:33:20 -07:00
|
|
|
- uses: actions/upload-artifact@v4
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2023-01-28 22:12:40 -07:00
|
|
|
with:
|
|
|
|
if-no-files-found: error
|
|
|
|
name: ${{ matrix.platform.artifact }}
|
|
|
|
path: build/dist/SDL3*
|
2024-01-25 18:33:20 -07:00
|
|
|
- uses: actions/upload-artifact@v4
|
2024-03-11 13:16:20 -06:00
|
|
|
if: ${{ contains(matrix.platform.name, 'CMake') }}
|
2023-03-27 04:03:42 -06:00
|
|
|
with:
|
|
|
|
if-no-files-found: error
|
|
|
|
name: ${{ matrix.platform.apk-artifact }}
|
|
|
|
path: build/test/*.apk
|