main.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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: Linux (CMake), os: ubuntu-20.04, shell: sh, flags: -GNinja }
  17. - { name: Linux (autotools), os: ubuntu-20.04, shell: sh, autotools: 'true' }
  18. - { name: MacOS, os: macos-latest, shell: sh }
  19. steps:
  20. - name: Set up MSYS2
  21. if: matrix.platform.shell == 'msys2 {0}'
  22. uses: msys2/setup-msys2@v2
  23. with:
  24. msystem: ${{ matrix.platform.msystem }}
  25. install: >-
  26. ${{ matrix.platform.msys-env }}-gcc
  27. ${{ matrix.platform.msys-env }}-cmake
  28. ${{ matrix.platform.msys-env }}-ninja
  29. ${{ matrix.platform.msys-env }}-pkg-config
  30. - name: Setup Linux dependencies
  31. if: runner.os == 'Linux'
  32. run: |
  33. sudo apt-get update
  34. sudo apt-get install \
  35. autoconf \
  36. gnome-desktop-testing \
  37. wayland-protocols \
  38. pkg-config \
  39. ninja-build \
  40. libasound2-dev \
  41. libdbus-1-dev \
  42. libegl1-mesa-dev \
  43. libgl1-mesa-dev \
  44. libgles2-mesa-dev \
  45. libglu1-mesa-dev \
  46. libibus-1.0-dev \
  47. libpulse-dev \
  48. libsdl2-2.0-0 \
  49. libsndio-dev \
  50. libudev-dev \
  51. libwayland-dev \
  52. libwayland-client++0 \
  53. wayland-scanner++ \
  54. libwayland-cursor++0 \
  55. libx11-dev \
  56. libxcursor-dev \
  57. libxext-dev \
  58. libxi-dev \
  59. libxinerama-dev \
  60. libxkbcommon-dev \
  61. libxrandr-dev \
  62. libxss-dev \
  63. libxt-dev \
  64. libxv-dev \
  65. libxxf86vm-dev \
  66. libdrm-dev \
  67. libgbm-dev\
  68. libpulse-dev \
  69. libpango1.0-dev
  70. sudo apt install meson
  71. git clone --depth 1 https://gitlab.gnome.org/jadahl/libdecor.git --branch 0.1.0
  72. cd libdecor
  73. meson build --buildtype release -Ddemo=false -Ddbus=disabled
  74. ninja -v -C build
  75. sudo meson install -C build
  76. - uses: actions/checkout@v2
  77. - name: Check that versioning is consistent
  78. # We only need to run this once: arbitrarily use the Linux/CMake build
  79. if: "runner.os == 'Linux' && ! matrix.platform.autotools"
  80. run: ./test/versioning.sh
  81. - name: Configure CMake
  82. if: "! matrix.platform.autotools"
  83. run: cmake -B build -DSDL_TEST=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DSDL_INSTALL_TESTS=ON ${{ matrix.platform.flags }}
  84. - name: Build
  85. if: "! matrix.platform.autotools"
  86. run: cmake --build build/ --config Release
  87. - name: Run build-time tests
  88. if: "matrix.platform.shell == 'sh' && ! matrix.platform.autotools"
  89. run: |
  90. set -eu
  91. export SDL_TESTS_QUICK=1
  92. ctest -VV --test-dir build/
  93. - name: Install
  94. if: "matrix.platform.shell == 'sh' && ! matrix.platform.autotools"
  95. run: |
  96. set -eu
  97. rm -fr DESTDIR-cmake
  98. DESTDIR=$(pwd)/DESTDIR-cmake cmake --install build/ --config Release
  99. ( cd DESTDIR-cmake; find ) | LC_ALL=C sort -u
  100. - name: Configure Autotools
  101. if: matrix.platform.autotools
  102. run: |
  103. set -eu
  104. rm -fr build-autotools
  105. mkdir build-autotools
  106. ./autogen.sh
  107. ( cd build-autotools && ../configure )
  108. curdir="$(pwd)"
  109. multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
  110. (
  111. mkdir -p build-autotools/test
  112. cd build-autotools/test
  113. ../../test/configure \
  114. --x-includes=/usr/include \
  115. --x-libraries="/usr/lib/${multiarch}" \
  116. SDL_CFLAGS="-I${curdir}/include" \
  117. SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \
  118. ac_cv_lib_SDL2_ttf_TTF_Init=no \
  119. ${NULL+}
  120. )
  121. - name: Build with Autotools
  122. if: matrix.platform.autotools
  123. run: |
  124. set -eu
  125. parallel="$(getconf _NPROCESSORS_ONLN)"
  126. make -j"${parallel}" -C build-autotools V=1
  127. make -j"${parallel}" -C build-autotools/test V=1
  128. - name: Run build-time tests with Autotools
  129. if: matrix.platform.autotools
  130. run: |
  131. set -eu
  132. curdir="$(pwd)"
  133. parallel="$(getconf _NPROCESSORS_ONLN)"
  134. export SDL_TESTS_QUICK=1
  135. make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
  136. - name: Install with Autotools
  137. if: matrix.platform.autotools
  138. run: |
  139. set -eu
  140. curdir="$(pwd)"
  141. parallel="$(getconf _NPROCESSORS_ONLN)"
  142. rm -fr DESTDIR-autotools
  143. mkdir DESTDIR-autotools
  144. make -j"${parallel}" -C build-autotools install DESTDIR="${curdir}/DESTDIR-autotools" V=1
  145. make -j"${parallel}" -C build-autotools/test install DESTDIR="${curdir}/DESTDIR-autotools" V=1
  146. ( cd DESTDIR-autotools; find ) | LC_ALL=C sort -u
  147. - name: Distcheck
  148. if: matrix.platform.autotools
  149. run: |
  150. set -eu
  151. parallel="$(getconf _NPROCESSORS_ONLN)"
  152. make -j"${parallel}" -C build-autotools dist V=1
  153. # Similar to Automake `make distcheck`: check that the tarball
  154. # release is sufficient to do a new build
  155. mkdir distcheck
  156. tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz
  157. ( cd distcheck/SDL2-* && ./configure )
  158. make -j"${parallel}" -C distcheck/SDL2-*
  159. - name: Run installed-tests from Autotools
  160. if: "runner.os == 'Linux' && matrix.platform.autotools"
  161. run: |
  162. set -eu
  163. parallel="$(getconf _NPROCESSORS_ONLN)"
  164. sudo make -j"${parallel}" -C build-autotools install
  165. sudo make -j"${parallel}" -C build-autotools/test install
  166. export SDL_TESTS_QUICK=1
  167. # We need to set LD_LIBRARY_PATH because it isn't in the default
  168. # linker search path. We don't need to set XDG_DATA_DIRS for
  169. # ginsttest-runner, because /usr/local/share *is* in the default
  170. # search path for that.
  171. env --chdir=/ \
  172. LD_LIBRARY_PATH=/usr/local/lib \
  173. SDL_AUDIODRIVER=dummy \
  174. SDL_VIDEODRIVER=dummy \
  175. ginsttest-runner --tap SDL2