🛠️🐜 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.

236 lines
9.9 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: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true,
  22. source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'}
  23. - { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF',
  24. source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; '}
  25. - { name: Ubuntu 22.04 (CMake), os: ubuntu-22.04, shell: sh }
  26. - { name: Ubuntu 22.04 (autotools), os: ubuntu-22.04, shell: sh, autotools: true }
  27. - { name: MacOS (CMake), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
  28. - { name: MacOS (autotools), os: macos-latest, shell: sh, autotools: true }
  29. steps:
  30. - name: Set up MSYS2
  31. if: matrix.platform.shell == 'msys2 {0}'
  32. uses: msys2/setup-msys2@v2
  33. with:
  34. msystem: ${{ matrix.platform.msystem }}
  35. install: >-
  36. ${{ matrix.platform.msys-env }}-cc
  37. ${{ matrix.platform.msys-env }}-cmake
  38. ${{ matrix.platform.msys-env }}-ninja
  39. ${{ matrix.platform.msys-env }}-pkg-config
  40. - name: Setup Linux dependencies
  41. if: runner.os == 'Linux'
  42. run: |
  43. sudo apt-get update
  44. sudo apt-get install build-essential git make autoconf automake libtool \
  45. pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
  46. libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
  47. libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
  48. libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
  49. libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
  50. - name: Setup extra Ubuntu 22.04 dependencies
  51. if: matrix.platform.os == 'ubuntu-22.04'
  52. run: |
  53. sudo apt-get install libpipewire-0.3-dev libdecor-0-dev
  54. - name: Setup Macos dependencies
  55. if: runner.os == 'macOS'
  56. run: |
  57. brew install \
  58. ninja \
  59. pkg-config
  60. - name: Setup Intel oneAPI
  61. if: matrix.platform.intel
  62. run: |
  63. # Setup oneAPI repo
  64. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
  65. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
  66. sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
  67. sudo apt-get update -y
  68. # Install oneAPI
  69. sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
  70. - uses: actions/checkout@v3
  71. - name: Check that versioning is consistent
  72. # We only need to run this once: arbitrarily use the Linux/CMake build
  73. if: "runner.os == 'Linux' && ! matrix.platform.autotools"
  74. run: ./build-scripts/test-versioning.sh
  75. - name: Configure (CMake)
  76. if: "! matrix.platform.autotools"
  77. run: |
  78. ${{ matrix.platform.source_cmd }}
  79. cmake -S . -B build -G Ninja \
  80. -DSDL_TESTS=ON \
  81. -DSDL_WERROR=ON \
  82. -DSDL_INSTALL_TESTS=ON \
  83. -DSDL_VENDOR_INFO="Github Workflow" \
  84. -DCMAKE_INSTALL_PREFIX=cmake_prefix \
  85. -DCMAKE_BUILD_TYPE=Release \
  86. ${{ matrix.platform.cmake }}
  87. - name: Build (CMake)
  88. if: "! matrix.platform.autotools"
  89. run: |
  90. ${{ matrix.platform.source_cmd }}
  91. cmake --build build/ --config Release --verbose --parallel
  92. - name: Run build-time tests (CMake)
  93. if: "! matrix.platform.autotools"
  94. run: |
  95. ${{ matrix.platform.source_cmd }}
  96. set -eu
  97. export SDL_TESTS_QUICK=1
  98. ctest -VV --test-dir build/
  99. if test "${{ runner.os }}" = "Linux"; then
  100. # This should show us the SDL_REVISION
  101. strings build/libSDL2-2.0.so.0 | grep SDL-
  102. fi
  103. - name: Install (CMake)
  104. if: "! matrix.platform.autotools"
  105. run: |
  106. set -eu
  107. cmake --install build/ --config Release
  108. echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
  109. ( cd cmake_prefix; find ) | LC_ALL=C sort -u
  110. - name: Configure (Autotools)
  111. if: matrix.platform.autotools
  112. run: |
  113. ${{ matrix.platform.source_cmd }}
  114. set -eu
  115. rm -fr build-autotools
  116. mkdir build-autotools
  117. ./autogen.sh
  118. (
  119. cd build-autotools
  120. ${{ github.workspace }}/configure \
  121. --enable-vendor-info="Github Workflow" \
  122. --enable-werror \
  123. --prefix=${{ github.workspace }}/autotools_prefix \
  124. )
  125. if test "${{ runner.os }}" != "macOS" ; then
  126. curdir="$(pwd)"
  127. multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
  128. (
  129. mkdir -p build-autotools/test
  130. cd build-autotools/test
  131. ${{ github.workspace }}/test/configure \
  132. --enable-werror \
  133. --x-includes=/usr/include \
  134. --x-libraries="/usr/lib/${multiarch}" \
  135. --prefix=${{ github.workspace }}/autotools_prefix \
  136. SDL_CFLAGS="-I${curdir}/include" \
  137. SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \
  138. ac_cv_lib_SDL2_ttf_TTF_Init=no \
  139. ${NULL+}
  140. )
  141. fi
  142. - name: Build (Autotools)
  143. if: matrix.platform.autotools
  144. run: |
  145. ${{ matrix.platform.source_cmd }}
  146. set -eu
  147. parallel="$(getconf _NPROCESSORS_ONLN)"
  148. make -j"${parallel}" -C build-autotools V=1
  149. if test "${{ runner.os }}" != "macOS" ; then
  150. make -j"${parallel}" -C build-autotools/test V=1
  151. fi
  152. - name: Run build-time tests (Autotools)
  153. if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }}
  154. run: |
  155. ${{ matrix.platform.source_cmd }}
  156. set -eu
  157. curdir="$(pwd)"
  158. parallel="$(getconf _NPROCESSORS_ONLN)"
  159. export SDL_TESTS_QUICK=1
  160. make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
  161. if test "${{ runner.os }}" = "Linux"; then
  162. # This should show us the SDL_REVISION
  163. strings "${curdir}/build-autotools/build/.libs/libSDL2-2.0.so.0" | grep SDL-
  164. fi
  165. - name: Install (Autotools)
  166. if: matrix.platform.autotools
  167. run: |
  168. ${{ matrix.platform.source_cmd }}
  169. set -eu
  170. curdir="$(pwd)"
  171. parallel="$(getconf _NPROCESSORS_ONLN)"
  172. make -j"${parallel}" -C build-autotools install V=1
  173. if test "${{ runner.os }}" != "macOS" ; then
  174. make -j"${parallel}" -C build-autotools/test install V=1
  175. fi
  176. ( cd autotools_prefix; find . ) | LC_ALL=C sort -u
  177. echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV
  178. - name: Verify CMake configuration files
  179. run: |
  180. ${{ matrix.platform.source_cmd }}
  181. cmake -S cmake/test -B cmake_config_build -G Ninja \
  182. -DCMAKE_BUILD_TYPE=Release \
  183. -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
  184. cmake --build cmake_config_build --verbose
  185. - name: Verify sdl2-config
  186. run: |
  187. ${{ matrix.platform.source_cmd }}
  188. export PATH=${{ env.SDL2_DIR }}/bin:$PATH
  189. cmake/test/test_sdlconfig.sh
  190. - name: Verify sdl2.pc
  191. run: |
  192. ${{ matrix.platform.source_cmd }}
  193. export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
  194. cmake/test/test_pkgconfig.sh
  195. - name: Distcheck (Autotools)
  196. if: matrix.platform.autotools
  197. run: |
  198. set -eu
  199. parallel="$(getconf _NPROCESSORS_ONLN)"
  200. make -j"${parallel}" -C build-autotools dist V=1
  201. # Similar to Automake `make distcheck`: check that the tarball
  202. # release is sufficient to do a new build
  203. mkdir distcheck
  204. tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz
  205. ( cd distcheck/SDL2-* && ./configure )
  206. make -j"${parallel}" -C distcheck/SDL2-*
  207. - name: Run installed-tests (Autotools)
  208. if: "runner.os == 'Linux' && matrix.platform.autotools"
  209. run: |
  210. ${{ matrix.platform.source_cmd }}
  211. set -eu
  212. parallel="$(getconf _NPROCESSORS_ONLN)"
  213. sudo make -j"${parallel}" -C build-autotools install
  214. sudo make -j"${parallel}" -C build-autotools/test install
  215. export SDL_TESTS_QUICK=1
  216. # We need to set LD_LIBRARY_PATH because it isn't in the default
  217. # linker search path. We don't need to set XDG_DATA_DIRS for
  218. # ginsttest-runner, because /usr/local/share *is* in the default
  219. # search path for that.
  220. env --chdir=/ \
  221. LD_LIBRARY_PATH=/usr/local/lib \
  222. SDL_AUDIODRIVER=dummy \
  223. SDL_VIDEODRIVER=dummy \
  224. ginsttest-runner --tap SDL2