android.yml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: Build (Android)
  2. on: [push, pull_request]
  3. concurrency:
  4. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
  5. cancel-in-progress: true
  6. jobs:
  7. android:
  8. name: ${{ matrix.platform.name }}
  9. runs-on: ubuntu-latest
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. platform:
  14. - { name: Android.mk }
  15. - { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64" }
  16. steps:
  17. - uses: actions/checkout@v3
  18. - uses: nttld/setup-ndk@v1
  19. id: setup_ndk
  20. with:
  21. ndk-version: r21e
  22. - name: Build (Android.mk)
  23. if: ${{ matrix.platform.name == 'Android.mk' }}
  24. run: |
  25. ./build-scripts/androidbuildlibs.sh
  26. - name: Setup (CMake)
  27. if: ${{ matrix.platform.name == 'CMake' }}
  28. run: |
  29. sudo apt-get update
  30. sudo apt-get install ninja-build pkg-config
  31. - name: Configure (CMake)
  32. if: ${{ matrix.platform.name == 'CMake' }}
  33. run: |
  34. cmake -S . -B build \
  35. -Wdeprecated -Wdev -Werror \
  36. -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
  37. -DSDL_WERROR=ON \
  38. -DSDL_CLANG_TIDY=ON \
  39. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  40. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  41. -DSDL_SHARED=ON \
  42. -DSDL_STATIC=ON \
  43. -DSDL_STATIC_PIC=ON \
  44. -DSDL_VENDOR_INFO="Github Workflow" \
  45. -DCMAKE_INSTALL_PREFIX=prefix \
  46. -DCMAKE_BUILD_TYPE=Release \
  47. -GNinja
  48. - name: Build (CMake)
  49. if: ${{ matrix.platform.name == 'CMake' }}
  50. run: |
  51. cmake --build build --config Release --parallel --verbose
  52. - name: Install (CMake)
  53. if: ${{ matrix.platform.name == 'CMake' }}
  54. run: |
  55. cmake --install build --config Release
  56. echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  57. ( cd prefix; find ) | LC_ALL=C sort -u
  58. - name: Package (CPack)
  59. if: ${{ matrix.platform.name == 'CMake' }}
  60. run: |
  61. cmake --build build/ --config Release --target package
  62. - name: Verify CMake configuration files
  63. if: ${{ matrix.platform.name == 'CMake' }}
  64. run: |
  65. cmake -S cmake/test -B cmake_config_build -G Ninja \
  66. -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
  67. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  68. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  69. -DCMAKE_BUILD_TYPE=Release \
  70. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
  71. cmake --build cmake_config_build --verbose
  72. - name: Verify sdl3.pc
  73. if: ${{ matrix.platform.name == 'CMake' }}
  74. run: |
  75. 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 }}"
  76. export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
  77. cmake/test/test_pkgconfig.sh
  78. - uses: actions/upload-artifact@v3
  79. if: ${{ matrix.platform.name == 'CMake' }}
  80. with:
  81. if-no-files-found: error
  82. name: ${{ matrix.platform.artifact }}
  83. path: build/dist/SDL3*