main.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. wayland-protocols \
  37. pkg-config \
  38. ninja-build \
  39. libasound2-dev \
  40. libdbus-1-dev \
  41. libegl1-mesa-dev \
  42. libgl1-mesa-dev \
  43. libgles2-mesa-dev \
  44. libglu1-mesa-dev \
  45. libibus-1.0-dev \
  46. libpulse-dev \
  47. libsdl2-2.0-0 \
  48. libsndio-dev \
  49. libudev-dev \
  50. libwayland-dev \
  51. libwayland-client++0 \
  52. wayland-scanner++ \
  53. libwayland-cursor++0 \
  54. libx11-dev \
  55. libxcursor-dev \
  56. libxext-dev \
  57. libxi-dev \
  58. libxinerama-dev \
  59. libxkbcommon-dev \
  60. libxrandr-dev \
  61. libxss-dev \
  62. libxt-dev \
  63. libxv-dev \
  64. libxxf86vm-dev \
  65. libdrm-dev \
  66. libgbm-dev\
  67. libpulse-dev \
  68. libpango1.0-dev
  69. sudo apt install meson
  70. git clone --depth 1 https://gitlab.gnome.org/jadahl/libdecor.git --branch 0.1.0
  71. cd libdecor
  72. meson build --buildtype release -Ddemo=false -Ddbus=disabled
  73. ninja -v -C build
  74. sudo meson install -C build
  75. - uses: actions/checkout@v2
  76. - name: Check that versioning is consistent
  77. # We only need to run this once: arbitrarily use the Linux/CMake build
  78. if: "runner.os == 'Linux' && ! matrix.platform.autotools"
  79. run: ./test/versioning.sh
  80. - name: Configure CMake
  81. if: "! matrix.platform.autotools"
  82. run: cmake -B build -DSDL_TEST=ON -DCMAKE_VERBOSE_MAKEFILE=ON ${{ matrix.platform.flags }}
  83. - name: Build
  84. if: "! matrix.platform.autotools"
  85. run: cmake --build build/ --config Release
  86. - name: Run build-time tests
  87. if: "matrix.platform.shell == 'sh' && ! matrix.platform.autotools"
  88. run: |
  89. set -eu
  90. export SDL_TESTS_QUICK=1
  91. ctest -VV --test-dir build/
  92. - name: Install
  93. if: "matrix.platform.shell == 'sh' && ! matrix.platform.autotools"
  94. run: |
  95. set -eu
  96. rm -fr DESTDIR-cmake
  97. DESTDIR=$(pwd)/DESTDIR-cmake cmake --install build/ --config Release
  98. ( cd DESTDIR-cmake; find ) | LC_ALL=C sort -u
  99. - name: Configure Autotools
  100. if: matrix.platform.autotools
  101. run: |
  102. set -eu
  103. rm -fr build-autotools
  104. mkdir build-autotools
  105. ./autogen.sh
  106. ( cd build-autotools && ../configure )
  107. curdir="$(pwd)"
  108. multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
  109. (
  110. mkdir -p build-autotools/test
  111. cd build-autotools/test
  112. ../../test/configure \
  113. --x-includes=/usr/include \
  114. --x-libraries="/usr/lib/${multiarch}" \
  115. SDL_CFLAGS="-I${curdir}/include" \
  116. SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \
  117. ac_cv_lib_SDL2_ttf_TTF_Init=no \
  118. ${NULL+}
  119. )
  120. - name: Build with Autotools
  121. if: matrix.platform.autotools
  122. run: |
  123. set -eu
  124. parallel="$(getconf _NPROCESSORS_ONLN)"
  125. make -j"${parallel}" -C build-autotools V=1
  126. make -j"${parallel}" -C build-autotools/test V=1
  127. - name: Run build-time tests with Autotools
  128. if: matrix.platform.autotools
  129. run: |
  130. set -eu
  131. curdir="$(pwd)"
  132. parallel="$(getconf _NPROCESSORS_ONLN)"
  133. export SDL_TESTS_QUICK=1
  134. make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
  135. - name: Install with Autotools
  136. if: matrix.platform.autotools
  137. run: |
  138. set -eu
  139. curdir="$(pwd)"
  140. parallel="$(getconf _NPROCESSORS_ONLN)"
  141. rm -fr DESTDIR-autotools
  142. mkdir DESTDIR-autotools
  143. make -j"${parallel}" -C build-autotools install DESTDIR="${curdir}/DESTDIR-autotools" V=1
  144. ( cd DESTDIR-autotools; find ) | LC_ALL=C sort -u
  145. make -j"${parallel}" -C build-autotools dist V=1