.gitlab-ci.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. ---
  2. # Github repository is cloned every day on Gitlab.com
  3. # https://gitlab.com/minetest/minetest
  4. # Pipelines URL: https://gitlab.com/minetest/minetest/pipelines
  5. stages:
  6. - build
  7. - package
  8. - deploy
  9. variables:
  10. IRRLICHT_TAG: "1.9.0mt5"
  11. MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git"
  12. CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH
  13. .build_template:
  14. stage: build
  15. before_script:
  16. - apt-get update
  17. - DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential git cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libleveldb-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev
  18. script:
  19. - git clone https://github.com/minetest/irrlicht -b $IRRLICHT_TAG lib/irrlichtmt
  20. - cmake -B build -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE -DBUILD_SERVER=TRUE ..
  21. - cmake --build build --parallel $(($(nproc) + 1))
  22. - cmake --install build
  23. artifacts:
  24. when: on_success
  25. expire_in: 1h
  26. paths:
  27. - artifact/*
  28. .debpkg_template:
  29. stage: package
  30. before_script:
  31. - apt-get update
  32. - apt-get install -y git
  33. - mkdir -p build/deb/minetest/DEBIAN/
  34. - cp misc/debpkg-control build/deb/minetest/DEBIAN/control
  35. - cp -a artifact/minetest/usr build/deb/minetest/
  36. script:
  37. - git clone $MINETEST_GAME_REPO build/deb/minetest/usr/share/minetest/games/minetest_game
  38. - rm -rf build/deb/minetest/usr/share/minetest/games/minetest/.git
  39. - sed -i 's/DATEPLACEHOLDER/'$(date +%y.%m.%d)'/g' build/deb/minetest/DEBIAN/control
  40. - sed -i 's/JPEG_PLACEHOLDER/'$JPEG_PKG'/g' build/deb/minetest/DEBIAN/control
  41. - sed -i 's/LEVELDB_PLACEHOLDER/'$LEVELDB_PKG'/g' build/deb/minetest/DEBIAN/control
  42. - sed -i 's/JSONCPP_PLACEHOLDER/'$JSONCPP_PKG'/g' build/deb/minetest/DEBIAN/control
  43. - cd build/deb/ && dpkg-deb -b minetest/ && mv minetest.deb ../../
  44. artifacts:
  45. expire_in: 90 day
  46. paths:
  47. - ./*.deb
  48. .debpkg_install:
  49. stage: deploy
  50. before_script:
  51. - apt-get update -qy
  52. script:
  53. - apt-get install -y ./*.deb
  54. - minetest --version
  55. ##
  56. ## Debian
  57. ##
  58. # Stretch
  59. build:debian-9:
  60. extends: .build_template
  61. image: debian:9
  62. package:debian-9:
  63. extends: .debpkg_template
  64. image: debian:9
  65. needs:
  66. - build:debian-9
  67. variables:
  68. JSONCPP_PKG: libjsoncpp1
  69. LEVELDB_PKG: libleveldb1v5
  70. JPEG_PKG: libjpeg62-turbo
  71. deploy:debian-9:
  72. extends: .debpkg_install
  73. image: debian:9
  74. needs:
  75. - package:debian-9
  76. # Buster
  77. build:debian-10:
  78. extends: .build_template
  79. image: debian:10
  80. package:debian-10:
  81. extends: .debpkg_template
  82. image: debian:10
  83. needs:
  84. - build:debian-10
  85. variables:
  86. JSONCPP_PKG: libjsoncpp1
  87. LEVELDB_PKG: libleveldb1d
  88. JPEG_PKG: libjpeg62-turbo
  89. deploy:debian-10:
  90. extends: .debpkg_install
  91. image: debian:10
  92. needs:
  93. - package:debian-10
  94. # Bullseye
  95. build:debian-11:
  96. extends: .build_template
  97. image: debian:11
  98. package:debian-11:
  99. extends: .debpkg_template
  100. image: debian:11
  101. needs:
  102. - build:debian-11
  103. variables:
  104. JSONCPP_PKG: libjsoncpp24
  105. LEVELDB_PKG: libleveldb1d
  106. JPEG_PKG: libjpeg62-turbo
  107. deploy:debian-11:
  108. extends: .debpkg_install
  109. image: debian:11
  110. needs:
  111. - package:debian-11
  112. ##
  113. ## Ubuntu
  114. ##
  115. # Bionic
  116. build:ubuntu-18.04:
  117. extends: .build_template
  118. image: ubuntu:bionic
  119. package:ubuntu-18.04:
  120. extends: .debpkg_template
  121. image: ubuntu:bionic
  122. needs:
  123. - build:ubuntu-18.04
  124. variables:
  125. JSONCPP_PKG: libjsoncpp1
  126. LEVELDB_PKG: libleveldb1v5
  127. JPEG_PKG: libjpeg-turbo8
  128. deploy:ubuntu-18.04:
  129. extends: .debpkg_install
  130. image: ubuntu:bionic
  131. needs:
  132. - package:ubuntu-18.04
  133. # Focal
  134. build:ubuntu-20.04:
  135. extends: .build_template
  136. image: ubuntu:focal
  137. package:ubuntu-20.04:
  138. extends: .debpkg_template
  139. image: ubuntu:focal
  140. needs:
  141. - build:ubuntu-20.04
  142. variables:
  143. JSONCPP_PKG: libjsoncpp1
  144. LEVELDB_PKG: libleveldb1d
  145. JPEG_PKG: libjpeg-turbo8
  146. deploy:ubuntu-20.04:
  147. extends: .debpkg_install
  148. image: ubuntu:focal
  149. needs:
  150. - package:ubuntu-20.04
  151. ##
  152. ## Fedora
  153. ##
  154. # Fedora 28 <-> RHEL 8
  155. build:fedora-28:
  156. extends: .build_template
  157. image: fedora:28
  158. before_script:
  159. - dnf -y install make git gcc gcc-c++ kernel-devel cmake libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel spatialindex-devel libzstd-devel
  160. ##
  161. ## MinGW for Windows
  162. ##
  163. .generic_win_template:
  164. image: ubuntu:focal
  165. before_script:
  166. - apt-get update
  167. - DEBIAN_FRONTEND=noninteractive apt-get install -y wget xz-utils unzip git cmake gettext
  168. - wget -nv http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
  169. - tar -xaf mingw.tar.xz -C /usr
  170. .build_win_template:
  171. extends: .generic_win_template
  172. stage: build
  173. artifacts:
  174. expire_in: 90 day
  175. paths:
  176. - minetest-*-win*/*
  177. build:win32:
  178. extends: .build_win_template
  179. script:
  180. - EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh build
  181. - unzip -q build/build/*.zip
  182. variables:
  183. WIN_ARCH: "i686"
  184. build:win64:
  185. extends: .build_win_template
  186. script:
  187. - EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh build
  188. - unzip -q build/build/*.zip
  189. variables:
  190. WIN_ARCH: "x86_64"
  191. ##
  192. ## Docker
  193. ##
  194. package:docker:
  195. stage: package
  196. image: docker:stable
  197. services:
  198. - docker:dind
  199. before_script:
  200. - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
  201. script:
  202. - docker build . -t ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA -t ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME -t ${CONTAINER_IMAGE}/server:latest
  203. - docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA
  204. - docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME
  205. - docker push ${CONTAINER_IMAGE}/server:latest
  206. ##
  207. ## Gitlab Pages (Lua API documentation)
  208. ##
  209. pages:
  210. stage: deploy
  211. image: python:3.8
  212. before_script:
  213. - pip install git+https://github.com/Python-Markdown/markdown.git
  214. - pip install git+https://github.com/mkdocs/mkdocs.git
  215. - pip install pygments
  216. script:
  217. - cd doc/mkdocs && ./build.sh
  218. artifacts:
  219. paths:
  220. - public
  221. only:
  222. - master
  223. ##
  224. ## AppImage
  225. ##
  226. package:appimage-client:
  227. stage: package
  228. image: appimagecrafters/appimage-builder
  229. needs:
  230. - build:ubuntu-18.04
  231. before_script:
  232. - apt-get update -y
  233. - apt-get install -y git
  234. # Collect files
  235. - mkdir AppDir
  236. - cp -a artifact/minetest/usr/ AppDir/usr/
  237. - rm AppDir/usr/bin/minetestserver
  238. - cp -a clientmods AppDir/usr/share/minetest
  239. script:
  240. - git clone $MINETEST_GAME_REPO AppDir/usr/share/minetest/games/minetest_game
  241. - rm -rf AppDir/usr/share/minetest/games/minetest/.git
  242. - export VERSION=$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA
  243. # Remove PrefersNonDefaultGPU property due to validation errors
  244. - sed -i '/PrefersNonDefaultGPU/d' AppDir/usr/share/applications/net.minetest.minetest.desktop
  245. - appimage-builder --skip-test
  246. artifacts:
  247. expire_in: 90 day
  248. paths:
  249. - ./*.AppImage