android.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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", apk-artifact: "SDL-android-apks-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. - uses: actions/setup-java@v3
  27. if: ${{ matrix.platform.name == 'CMake' }}
  28. with:
  29. distribution: 'temurin'
  30. java-version: '11'
  31. - name: Setup (CMake)
  32. if: ${{ matrix.platform.name == 'CMake' }}
  33. run: |
  34. sudo apt-get update
  35. sudo apt-get install ninja-build pkg-config
  36. - name: Configure (CMake)
  37. if: ${{ matrix.platform.name == 'CMake' }}
  38. run: |
  39. cmake -S . -B build \
  40. -Wdeprecated -Wdev -Werror \
  41. -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
  42. -DSDL_WERROR=ON \
  43. -DSDL_TESTS=ON \
  44. -DSDL_INSTALL_TESTS=ON \
  45. -DSDL_CLANG_TIDY=ON \
  46. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  47. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  48. -DSDL_SHARED=ON \
  49. -DSDL_STATIC=ON \
  50. -DSDL_STATIC_PIC=ON \
  51. -DSDL_VENDOR_INFO="Github Workflow" \
  52. -DCMAKE_INSTALL_PREFIX=prefix \
  53. -DCMAKE_BUILD_TYPE=Release \
  54. -GNinja
  55. - name: Build (CMake)
  56. if: ${{ matrix.platform.name == 'CMake' }}
  57. run: |
  58. cmake --build build --config Release --parallel --verbose
  59. - name: Build test apk's (CMake)
  60. if: ${{ matrix.platform.name == 'CMake' }}
  61. run: |
  62. cmake --build build --config Release --parallel --verbose --target testaudiocapture-apk testcontroller-apk testmultiaudio-apk testsprite-apk
  63. - name: Install (CMake)
  64. if: ${{ matrix.platform.name == 'CMake' }}
  65. run: |
  66. cmake --install build --config Release
  67. echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  68. ( cd prefix; find ) | LC_ALL=C sort -u
  69. - name: Package (CPack)
  70. if: ${{ matrix.platform.name == 'CMake' }}
  71. run: |
  72. cmake --build build/ --config Release --target package
  73. - name: Verify CMake configuration files
  74. if: ${{ matrix.platform.name == 'CMake' }}
  75. run: |
  76. cmake -S cmake/test -B cmake_config_build -G Ninja \
  77. -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
  78. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  79. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  80. -DCMAKE_BUILD_TYPE=Release \
  81. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
  82. cmake --build cmake_config_build --verbose
  83. - name: Verify sdl3.pc
  84. if: ${{ matrix.platform.name == 'CMake' }}
  85. run: |
  86. 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 }}"
  87. export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
  88. cmake/test/test_pkgconfig.sh
  89. - uses: actions/upload-artifact@v3
  90. if: ${{ matrix.platform.name == 'CMake' }}
  91. with:
  92. if-no-files-found: error
  93. name: ${{ matrix.platform.artifact }}
  94. path: build/dist/SDL3*
  95. - uses: actions/upload-artifact@v3
  96. if: ${{ matrix.platform.name == 'CMake' }}
  97. with:
  98. if-no-files-found: error
  99. name: ${{ matrix.platform.apk-artifact }}
  100. path: build/test/*.apk