build.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. name: build
  2. # build on c/cpp changes or workflow changes
  3. on:
  4. push:
  5. paths:
  6. - 'lib/**.[ch]'
  7. - 'lib/**.cpp'
  8. - 'src/**.[ch]'
  9. - 'src/**.cpp'
  10. - '**/CMakeLists.txt'
  11. - 'cmake/Modules/**'
  12. - 'util/buildbot/**'
  13. - 'util/ci/**'
  14. - '.github/workflows/**.yml'
  15. - 'Dockerfile'
  16. - '.dockerignore'
  17. pull_request:
  18. paths:
  19. - 'lib/**.[ch]'
  20. - 'lib/**.cpp'
  21. - 'src/**.[ch]'
  22. - 'src/**.cpp'
  23. - '**/CMakeLists.txt'
  24. - 'cmake/Modules/**'
  25. - 'util/buildbot/**'
  26. - 'util/ci/**'
  27. - '.github/workflows/**.yml'
  28. - 'Dockerfile'
  29. - '.dockerignore'
  30. jobs:
  31. # Older gcc version (should be close to our minimum supported version)
  32. gcc_5:
  33. runs-on: ubuntu-18.04
  34. steps:
  35. - uses: actions/checkout@v3
  36. - name: Install deps
  37. run: |
  38. source ./util/ci/common.sh
  39. install_linux_deps g++-5
  40. - name: Build
  41. run: |
  42. ./util/ci/build.sh
  43. env:
  44. CC: gcc-5
  45. CXX: g++-5
  46. - name: Test
  47. run: |
  48. ./bin/minetest --run-unittests
  49. # Current gcc version
  50. gcc_10:
  51. runs-on: ubuntu-20.04
  52. steps:
  53. - uses: actions/checkout@v3
  54. - name: Install deps
  55. run: |
  56. source ./util/ci/common.sh
  57. install_linux_deps g++-10
  58. - name: Build
  59. run: |
  60. ./util/ci/build.sh
  61. env:
  62. CC: gcc-10
  63. CXX: g++-10
  64. - name: Test
  65. run: |
  66. ./bin/minetest --run-unittests
  67. # Older clang version (should be close to our minimum supported version)
  68. clang_3_9:
  69. runs-on: ubuntu-18.04
  70. steps:
  71. - uses: actions/checkout@v3
  72. - name: Install deps
  73. run: |
  74. source ./util/ci/common.sh
  75. install_linux_deps clang-3.9 gdb
  76. - name: Build
  77. run: |
  78. ./util/ci/build.sh
  79. env:
  80. CC: clang-3.9
  81. CXX: clang++-3.9
  82. - name: Unittest
  83. run: |
  84. ./bin/minetest --run-unittests
  85. - name: Integration test + devtest
  86. run: |
  87. ./util/test_multiplayer.sh
  88. # Current clang version
  89. clang_10:
  90. runs-on: ubuntu-20.04
  91. steps:
  92. - uses: actions/checkout@v3
  93. - name: Install deps
  94. run: |
  95. source ./util/ci/common.sh
  96. install_linux_deps clang-10 valgrind libluajit-5.1-dev
  97. - name: Build
  98. run: |
  99. ./util/ci/build.sh
  100. env:
  101. CC: clang-10
  102. CXX: clang++-10
  103. CMAKE_FLAGS: "-DREQUIRE_LUAJIT=1"
  104. - name: Test
  105. run: |
  106. ./bin/minetest --run-unittests
  107. - name: Valgrind
  108. run: |
  109. valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests
  110. # Build with prometheus-cpp (server-only)
  111. clang_9_prometheus:
  112. name: "clang_9 (PROMETHEUS=1)"
  113. runs-on: ubuntu-20.04
  114. steps:
  115. - uses: actions/checkout@v3
  116. - name: Install deps
  117. run: |
  118. source ./util/ci/common.sh
  119. install_linux_deps clang-9
  120. - name: Build prometheus-cpp
  121. run: |
  122. ./util/ci/build_prometheus_cpp.sh
  123. - name: Build
  124. run: |
  125. ./util/ci/build.sh
  126. env:
  127. CC: clang-9
  128. CXX: clang++-9
  129. CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0"
  130. - name: Test
  131. run: |
  132. ./bin/minetestserver --run-unittests
  133. docker:
  134. name: "Docker image"
  135. runs-on: ubuntu-20.04
  136. steps:
  137. - uses: actions/checkout@v3
  138. - name: Build docker image
  139. run: |
  140. docker build . -t minetest:latest
  141. docker run --rm minetest:latest /usr/local/bin/minetestserver --version
  142. win32:
  143. name: "MinGW cross-compiler (32-bit)"
  144. runs-on: ubuntu-20.04
  145. steps:
  146. - uses: actions/checkout@v3
  147. - name: Install compiler
  148. run: |
  149. sudo apt-get update && sudo apt-get install -y gettext
  150. wget http://minetest.kitsunemimi.pw/mingw-w64-i686_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
  151. sudo tar -xaf mingw.tar.xz -C /usr
  152. - name: Build
  153. run: |
  154. EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh winbuild
  155. env:
  156. NO_MINETEST_GAME: 1
  157. NO_PACKAGE: 1
  158. win64:
  159. name: "MinGW cross-compiler (64-bit)"
  160. runs-on: ubuntu-20.04
  161. steps:
  162. - uses: actions/checkout@v3
  163. - name: Install compiler
  164. run: |
  165. sudo apt-get update && sudo apt-get install -y gettext
  166. wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
  167. sudo tar -xaf mingw.tar.xz -C /usr
  168. - name: Build
  169. run: |
  170. EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh winbuild
  171. env:
  172. NO_MINETEST_GAME: 1
  173. NO_PACKAGE: 1
  174. msvc:
  175. name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
  176. runs-on: windows-2019
  177. env:
  178. VCPKG_VERSION: 5cf60186a241e84e8232641ee973395d4fde90e1
  179. # 2022.02
  180. vcpkg_packages: zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp opengl-registry
  181. strategy:
  182. fail-fast: false
  183. matrix:
  184. config:
  185. - {
  186. arch: x86,
  187. generator: "-G'Visual Studio 16 2019' -A Win32",
  188. vcpkg_triplet: x86-windows
  189. }
  190. - {
  191. arch: x64,
  192. generator: "-G'Visual Studio 16 2019' -A x64",
  193. vcpkg_triplet: x64-windows
  194. }
  195. type: [portable]
  196. # type: [portable, installer]
  197. # The installer type is working, but disabled, to save runner jobs.
  198. # Enable it, when working on the installer.
  199. steps:
  200. - uses: actions/checkout@v3
  201. - name: Checkout IrrlichtMt
  202. uses: actions/checkout@v3
  203. with:
  204. repository: minetest/irrlicht
  205. path: lib/irrlichtmt/
  206. ref: "1.9.0mt6"
  207. - name: Restore from cache and run vcpkg
  208. uses: lukka/run-vcpkg@v7
  209. with:
  210. vcpkgArguments: ${{env.vcpkg_packages}}
  211. vcpkgDirectory: '${{ github.workspace }}\vcpkg'
  212. appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
  213. vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
  214. vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
  215. - name: Minetest CMake
  216. run: |
  217. cmake ${{matrix.config.generator}} `
  218. -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
  219. -DCMAKE_BUILD_TYPE=Release `
  220. -DENABLE_POSTGRESQL=OFF `
  221. -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
  222. - name: Build Minetest
  223. run: cmake --build . --config Release
  224. - name: CPack
  225. run: |
  226. If ($env:TYPE -eq "installer")
  227. {
  228. cpack -G WIX -B "$env:GITHUB_WORKSPACE\Package"
  229. }
  230. ElseIf($env:TYPE -eq "portable")
  231. {
  232. cpack -G ZIP -B "$env:GITHUB_WORKSPACE\Package"
  233. }
  234. env:
  235. TYPE: ${{matrix.type}}
  236. - name: Package Clean
  237. run: rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
  238. - uses: actions/upload-artifact@v3
  239. with:
  240. name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
  241. path: .\Package\