android.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_TESTS=ON \
  39. -DSDL_INSTALL_TESTS=ON \
  40. -DSDL_CLANG_TIDY=ON \
  41. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  42. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  43. -DSDL_SHARED=ON \
  44. -DSDL_STATIC=ON \
  45. -DSDL_STATIC_PIC=ON \
  46. -DSDL_VENDOR_INFO="Github Workflow" \
  47. -DCMAKE_INSTALL_PREFIX=prefix \
  48. -DCMAKE_BUILD_TYPE=Release \
  49. -GNinja
  50. - name: Build (CMake)
  51. if: ${{ matrix.platform.name == 'CMake' }}
  52. run: |
  53. cmake --build build --config Release --parallel --verbose
  54. - name: Install (CMake)
  55. if: ${{ matrix.platform.name == 'CMake' }}
  56. run: |
  57. cmake --install build --config Release
  58. echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  59. ( cd prefix; find ) | LC_ALL=C sort -u
  60. - name: Package (CPack)
  61. if: ${{ matrix.platform.name == 'CMake' }}
  62. run: |
  63. cmake --build build/ --config Release --target package
  64. - name: Verify CMake configuration files
  65. if: ${{ matrix.platform.name == 'CMake' }}
  66. run: |
  67. cmake -S cmake/test -B cmake_config_build -G Ninja \
  68. -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
  69. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  70. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  71. -DCMAKE_BUILD_TYPE=Release \
  72. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
  73. cmake --build cmake_config_build --verbose
  74. - name: Verify sdl3.pc
  75. if: ${{ matrix.platform.name == 'CMake' }}
  76. run: |
  77. 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 }}"
  78. export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
  79. cmake/test/test_pkgconfig.sh
  80. - uses: actions/upload-artifact@v3
  81. if: ${{ matrix.platform.name == 'CMake' }}
  82. with:
  83. if-no-files-found: error
  84. name: ${{ matrix.platform.artifact }}
  85. path: build/dist/SDL3*