.gitlab-ci.yml 7.0 KB

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