🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

206 lines
8.3 KiB

  1. name: Build
  2. on: [push, pull_request]
  3. jobs:
  4. Build:
  5. name: ${{ matrix.platform.name }}
  6. runs-on: ${{ matrix.platform.os }}
  7. defaults:
  8. run:
  9. shell: ${{ matrix.platform.shell }}
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. platform:
  14. - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
  15. - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
  16. - { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
  17. - { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
  18. - { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 }
  19. - { name: Ubuntu 20.04 (CMake), os: ubuntu-20.04, shell: sh }
  20. - { name: Ubuntu 20.04 (autotools), os: ubuntu-20.04, shell: sh, autotools: true }
  21. - { name: Ubuntu 22.04 (CMake), os: ubuntu-22.04, shell: sh }
  22. - { name: Ubuntu 22.04 (autotools), os: ubuntu-22.04, shell: sh, autotools: true }
  23. - { name: MacOS (CMake), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
  24. - { name: MacOS (autotools), os: macos-latest, shell: sh, autotools: true }
  25. steps:
  26. - name: Set up MSYS2
  27. if: matrix.platform.shell == 'msys2 {0}'
  28. uses: msys2/setup-msys2@v2
  29. with:
  30. msystem: ${{ matrix.platform.msystem }}
  31. install: >-
  32. ${{ matrix.platform.msys-env }}-cc
  33. ${{ matrix.platform.msys-env }}-cmake
  34. ${{ matrix.platform.msys-env }}-ninja
  35. ${{ matrix.platform.msys-env }}-pkg-config
  36. - name: Setup Linux dependencies
  37. if: runner.os == 'Linux'
  38. run: |
  39. sudo apt-get update
  40. sudo apt-get install build-essential git make autoconf automake libtool \
  41. pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
  42. libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
  43. libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
  44. libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
  45. libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
  46. - name: Setup extra Ubuntu 22.04 dependencies
  47. if: matrix.platform.os == 'ubuntu-22.04'
  48. run: |
  49. sudo apt-get install libpipewire-0.3-dev libdecor-0-dev
  50. - name: Setup Macos dependencies
  51. if: runner.os == 'macOS'
  52. run: |
  53. brew install \
  54. ninja
  55. - uses: actions/checkout@v3
  56. - name: Check that versioning is consistent
  57. # We only need to run this once: arbitrarily use the Linux/CMake build
  58. if: "runner.os == 'Linux' && ! matrix.platform.autotools"
  59. run: ./build-scripts/test-versioning.sh
  60. - name: Configure (CMake)
  61. if: "! matrix.platform.autotools"
  62. run: |
  63. cmake -S . -B build -G Ninja \
  64. -DSDL_TESTS=ON \
  65. -DSDL_WERROR=ON \
  66. -DSDL_INSTALL_TESTS=ON \
  67. -DSDL_VENDOR_INFO="Github Workflow" \
  68. -DCMAKE_INSTALL_PREFIX=cmake_prefix \
  69. -DCMAKE_BUILD_TYPE=Release \
  70. ${{ matrix.platform.cmake }}
  71. - name: Build (CMake)
  72. if: "! matrix.platform.autotools"
  73. run: |
  74. cmake --build build/ --config Release --verbose --parallel
  75. - name: Run build-time tests (CMake)
  76. if: "! matrix.platform.autotools"
  77. run: |
  78. set -eu
  79. export SDL_TESTS_QUICK=1
  80. ctest -VV --test-dir build/
  81. if test "${{ runner.os }}" = "Linux"; then
  82. # This should show us the SDL_REVISION
  83. strings build/libSDL2-2.0.so.0 | grep SDL-
  84. fi
  85. - name: Install (CMake)
  86. if: "! matrix.platform.autotools"
  87. run: |
  88. set -eu
  89. cmake --install build/ --config Release
  90. echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
  91. ( cd cmake_prefix; find ) | LC_ALL=C sort -u
  92. - name: Configure (Autotools)
  93. if: matrix.platform.autotools
  94. run: |
  95. set -eu
  96. rm -fr build-autotools
  97. mkdir build-autotools
  98. ./autogen.sh
  99. (
  100. cd build-autotools
  101. ${{ github.workspace }}/configure \
  102. --enable-vendor-info="Github Workflow" \
  103. --enable-werror \
  104. --prefix=${{ github.workspace }}/autotools_prefix \
  105. )
  106. if test "${{ runner.os }}" != "macOS" ; then
  107. curdir="$(pwd)"
  108. multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
  109. (
  110. mkdir -p build-autotools/test
  111. cd build-autotools/test
  112. ${{ github.workspace }}/test/configure \
  113. --enable-werror \
  114. --x-includes=/usr/include \
  115. --x-libraries="/usr/lib/${multiarch}" \
  116. --prefix=${{ github.workspace }}/autotools_prefix \
  117. SDL_CFLAGS="-I${curdir}/include" \
  118. SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \
  119. ac_cv_lib_SDL2_ttf_TTF_Init=no \
  120. ${NULL+}
  121. )
  122. fi
  123. - name: Build (Autotools)
  124. if: matrix.platform.autotools
  125. run: |
  126. set -eu
  127. parallel="$(getconf _NPROCESSORS_ONLN)"
  128. make -j"${parallel}" -C build-autotools V=1
  129. if test "${{ runner.os }}" != "macOS" ; then
  130. make -j"${parallel}" -C build-autotools/test V=1
  131. fi
  132. - name: Run build-time tests (Autotools)
  133. if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }}
  134. run: |
  135. set -eu
  136. curdir="$(pwd)"
  137. parallel="$(getconf _NPROCESSORS_ONLN)"
  138. export SDL_TESTS_QUICK=1
  139. make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
  140. if test "${{ runner.os }}" = "Linux"; then
  141. # This should show us the SDL_REVISION
  142. strings "${curdir}/build-autotools/build/.libs/libSDL2-2.0.so.0" | grep SDL-
  143. fi
  144. - name: Install (Autotools)
  145. if: matrix.platform.autotools
  146. run: |
  147. set -eu
  148. curdir="$(pwd)"
  149. parallel="$(getconf _NPROCESSORS_ONLN)"
  150. make -j"${parallel}" -C build-autotools install V=1
  151. if test "${{ runner.os }}" != "macOS" ; then
  152. make -j"${parallel}" -C build-autotools/test install V=1
  153. fi
  154. ( cd autotools_prefix; find . ) | LC_ALL=C sort -u
  155. echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV
  156. - name: Verify CMake configuration files
  157. run: |
  158. cmake -S cmake/test -B cmake_config_build -G Ninja \
  159. -DCMAKE_BUILD_TYPE=Release \
  160. -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
  161. cmake --build cmake_config_build --verbose
  162. - name: Verify sdl2-config
  163. run: |
  164. export PATH=${{ env.SDL2_DIR }}/bin:$PATH
  165. cmake/test/test_sdlconfig.sh
  166. - name: Verify sdl2.pc
  167. run: |
  168. export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
  169. cmake/test/test_pkgconfig.sh
  170. - name: Distcheck (Autotools)
  171. if: matrix.platform.autotools
  172. run: |
  173. set -eu
  174. parallel="$(getconf _NPROCESSORS_ONLN)"
  175. make -j"${parallel}" -C build-autotools dist V=1
  176. # Similar to Automake `make distcheck`: check that the tarball
  177. # release is sufficient to do a new build
  178. mkdir distcheck
  179. tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz
  180. ( cd distcheck/SDL2-* && ./configure )
  181. make -j"${parallel}" -C distcheck/SDL2-*
  182. - name: Run installed-tests (Autotools)
  183. if: "runner.os == 'Linux' && matrix.platform.autotools"
  184. run: |
  185. set -eu
  186. parallel="$(getconf _NPROCESSORS_ONLN)"
  187. sudo make -j"${parallel}" -C build-autotools install
  188. sudo make -j"${parallel}" -C build-autotools/test install
  189. export SDL_TESTS_QUICK=1
  190. # We need to set LD_LIBRARY_PATH because it isn't in the default
  191. # linker search path. We don't need to set XDG_DATA_DIRS for
  192. # ginsttest-runner, because /usr/local/share *is* in the default
  193. # search path for that.
  194. env --chdir=/ \
  195. LD_LIBRARY_PATH=/usr/local/lib \
  196. SDL_AUDIODRIVER=dummy \
  197. SDL_VIDEODRIVER=dummy \
  198. ginsttest-runner --tap SDL2