.gitlab-ci.yml 7.0 KB

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