.gitlab-ci.yml 7.6 KB

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