build.yml 7.2 KB

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