build.yml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. # This is our minor gcc compiler
  32. gcc_6:
  33. runs-on: ubuntu-18.04
  34. steps:
  35. - uses: actions/checkout@v2
  36. - name: Install deps
  37. run: |
  38. source ./util/ci/common.sh
  39. install_linux_deps g++-6
  40. - name: Build
  41. run: |
  42. ./util/ci/build.sh
  43. env:
  44. CC: gcc-6
  45. CXX: g++-6
  46. - name: Test
  47. run: |
  48. ./bin/minetest --run-unittests
  49. # This is the current gcc compiler (available in bionic)
  50. gcc_8:
  51. runs-on: ubuntu-18.04
  52. steps:
  53. - uses: actions/checkout@v2
  54. - name: Install deps
  55. run: |
  56. source ./util/ci/common.sh
  57. install_linux_deps g++-8
  58. - name: Build
  59. run: |
  60. ./util/ci/build.sh
  61. env:
  62. CC: gcc-8
  63. CXX: g++-8
  64. - name: Test
  65. run: |
  66. ./bin/minetest --run-unittests
  67. # This is our minor clang compiler
  68. clang_3_9:
  69. runs-on: ubuntu-18.04
  70. steps:
  71. - uses: actions/checkout@v2
  72. - name: Install deps
  73. run: |
  74. source ./util/ci/common.sh
  75. install_linux_deps clang-3.9
  76. - name: Build
  77. run: |
  78. ./util/ci/build.sh
  79. env:
  80. CC: clang-3.9
  81. CXX: clang++-3.9
  82. - name: Test
  83. run: |
  84. ./bin/minetest --run-unittests
  85. # This is the current clang version
  86. clang_9:
  87. runs-on: ubuntu-18.04
  88. steps:
  89. - uses: actions/checkout@v2
  90. - name: Install deps
  91. run: |
  92. source ./util/ci/common.sh
  93. install_linux_deps clang-9 valgrind libluajit-5.1-dev
  94. - name: Build
  95. run: |
  96. ./util/ci/build.sh
  97. env:
  98. CC: clang-9
  99. CXX: clang++-9
  100. CMAKE_FLAGS: "-DREQUIRE_LUAJIT=1"
  101. - name: Test
  102. run: |
  103. ./bin/minetest --run-unittests
  104. - name: Valgrind
  105. run: |
  106. valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests
  107. # Build with prometheus-cpp (server-only)
  108. clang_9_prometheus:
  109. name: "clang_9 (PROMETHEUS=1)"
  110. runs-on: ubuntu-18.04
  111. steps:
  112. - uses: actions/checkout@v2
  113. - name: Install deps
  114. run: |
  115. source ./util/ci/common.sh
  116. install_linux_deps --old-irr clang-9
  117. - name: Build prometheus-cpp
  118. run: |
  119. ./util/ci/build_prometheus_cpp.sh
  120. - name: Build
  121. run: |
  122. ./util/ci/build.sh
  123. env:
  124. CC: clang-9
  125. CXX: clang++-9
  126. CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0"
  127. - name: Test
  128. run: |
  129. ./bin/minetestserver --run-unittests
  130. # Build without freetype (client-only)
  131. clang_9_no_freetype:
  132. name: "clang_9 (FREETYPE=0)"
  133. runs-on: ubuntu-18.04
  134. steps:
  135. - uses: actions/checkout@v2
  136. - name: Install deps
  137. run: |
  138. source ./util/ci/common.sh
  139. install_linux_deps clang-9
  140. - name: Build
  141. run: |
  142. ./util/ci/build.sh
  143. env:
  144. CC: clang-9
  145. CXX: clang++-9
  146. CMAKE_FLAGS: "-DENABLE_FREETYPE=0 -DBUILD_SERVER=0"
  147. - name: Test
  148. run: |
  149. ./bin/minetest --run-unittests
  150. docker:
  151. name: "Docker image"
  152. runs-on: ubuntu-18.04
  153. steps:
  154. - uses: actions/checkout@v2
  155. - name: Build docker image
  156. run: |
  157. docker build .
  158. win32:
  159. name: "MinGW cross-compiler (32-bit)"
  160. runs-on: ubuntu-18.04
  161. steps:
  162. - uses: actions/checkout@v2
  163. - name: Install compiler
  164. run: |
  165. sudo apt-get update -q && sudo apt-get install gettext -qyy
  166. wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.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/buildwin32.sh winbuild
  171. env:
  172. NO_MINETEST_GAME: 1
  173. NO_PACKAGE: 1
  174. win64:
  175. name: "MinGW cross-compiler (64-bit)"
  176. runs-on: ubuntu-18.04
  177. steps:
  178. - uses: actions/checkout@v2
  179. - name: Install compiler
  180. run: |
  181. sudo apt-get update -q && sudo apt-get install gettext -qyy
  182. wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
  183. sudo tar -xaf mingw.tar.xz -C /usr
  184. - name: Build
  185. run: |
  186. EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh winbuild
  187. env:
  188. NO_MINETEST_GAME: 1
  189. NO_PACKAGE: 1
  190. msvc:
  191. name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
  192. runs-on: windows-2019
  193. #### Disabled due to Irrlicht switch
  194. if: false
  195. #### Disabled due to Irrlicht switch
  196. env:
  197. VCPKG_VERSION: 0bf3923f9fab4001c00f0f429682a0853b5749e0
  198. # 2020.11
  199. vcpkg_packages: irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit
  200. strategy:
  201. fail-fast: false
  202. matrix:
  203. config:
  204. - {
  205. arch: x86,
  206. generator: "-G'Visual Studio 16 2019' -A Win32",
  207. vcpkg_triplet: x86-windows
  208. }
  209. - {
  210. arch: x64,
  211. generator: "-G'Visual Studio 16 2019' -A x64",
  212. vcpkg_triplet: x64-windows
  213. }
  214. type: [portable]
  215. # type: [portable, installer]
  216. # The installer type is working, but disabled, to save runner jobs.
  217. # Enable it, when working on the installer.
  218. steps:
  219. - name: Checkout
  220. uses: actions/checkout@v2
  221. - name: Restore from cache and run vcpkg
  222. uses: lukka/run-vcpkg@v5
  223. with:
  224. vcpkgArguments: ${{env.vcpkg_packages}}
  225. vcpkgDirectory: '${{ github.workspace }}\vcpkg'
  226. appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
  227. vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
  228. vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
  229. - name: CMake
  230. run: |
  231. cmake ${{matrix.config.generator}} `
  232. -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
  233. -DCMAKE_BUILD_TYPE=Release `
  234. -DENABLE_POSTGRESQL=OFF `
  235. -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
  236. - name: Build
  237. run: cmake --build . --config Release
  238. - name: CPack
  239. run: |
  240. If ($env:TYPE -eq "installer")
  241. {
  242. cpack -G WIX -B "$env:GITHUB_WORKSPACE\Package"
  243. }
  244. ElseIf($env:TYPE -eq "portable")
  245. {
  246. cpack -G ZIP -B "$env:GITHUB_WORKSPACE\Package"
  247. }
  248. env:
  249. TYPE: ${{matrix.type}}
  250. - name: Package Clean
  251. run: rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
  252. - uses: actions/upload-artifact@v1
  253. with:
  254. name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
  255. path: .\Package\