.gitlab-ci.yml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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: &build_definition
  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 -DBUILD_SERVER=TRUE ..
  19. - make -j2
  20. - make install
  21. artifacts:
  22. when: on_success
  23. expire_in: 2h
  24. paths:
  25. - artifact/*
  26. .debpkg_template: &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 -Rp artifact/minetest/usr build/deb/minetest/
  34. script:
  35. - git clone $MINETEST_GAME_REPO build/deb/minetest/usr/share/minetest/games/minetest
  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. when: on_success
  42. expire_in: 90 day
  43. paths:
  44. - ./*.deb
  45. .debpkg_install: &debpkg_install
  46. stage: deploy
  47. before_script:
  48. - apt-get update -y
  49. - apt-get install -y libc6 libcurl3-gnutls libfreetype6 libirrlicht1.8 $LEVELDB_PKG liblua5.1-0 libluajit-5.1-2 libopenal1 libstdc++6 libvorbisfile3 libx11-6 zlib1g
  50. script:
  51. - dpkg -i ./*.deb
  52. ##
  53. ## Debian
  54. ##
  55. # Jessie
  56. build:debian-8:
  57. <<: *build_definition
  58. image: debian:8
  59. before_script:
  60. - echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" > /etc/apt/sources.list.d/uptodate-toolchain.list
  61. - apt-key adv --keyserver keyserver.ubuntu.com --recv BA9EF27F
  62. - apt-get update -y
  63. - apt-get -y install build-essential gcc-6 g++-6 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
  64. variables:
  65. CC: gcc-6
  66. CXX: g++-6
  67. package:debian-8:
  68. image: debian:8
  69. dependencies:
  70. - build:debian-8
  71. variables:
  72. LEVELDB_PKG: libleveldb1
  73. <<: *debpkg_template
  74. deploy:debian-8:
  75. image: debian:8
  76. dependencies:
  77. - package:debian-8
  78. variables:
  79. LEVELDB_PKG: libleveldb1
  80. <<: *debpkg_install
  81. # Stretch
  82. build:debian-9:
  83. <<: *build_definition
  84. image: debian:9
  85. before_script:
  86. - apt-get update -y
  87. - 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
  88. package:debian-9:
  89. image: debian:9
  90. dependencies:
  91. - build:debian-9
  92. variables:
  93. LEVELDB_PKG: libleveldb1v5
  94. <<: *debpkg_template
  95. deploy:debian-9:
  96. image: debian:9
  97. dependencies:
  98. - package:debian-9
  99. variables:
  100. LEVELDB_PKG: libleveldb1v5
  101. <<: *debpkg_install
  102. ##
  103. ## Ubuntu
  104. ##
  105. # Trusty
  106. build:ubuntu-14.04:
  107. <<: *build_definition
  108. image: ubuntu:trusty
  109. before_script:
  110. - echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" > /etc/apt/sources.list.d/uptodate-toolchain.list
  111. - apt-key adv --keyserver keyserver.ubuntu.com --recv BA9EF27F
  112. - apt-get update -y
  113. - apt-get -y install build-essential gcc-6 g++-6 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
  114. variables:
  115. CC: gcc-6
  116. CXX: g++-6
  117. package:ubuntu-14.04:
  118. image: ubuntu:trusty
  119. dependencies:
  120. - build:ubuntu-14.04
  121. variables:
  122. LEVELDB_PKG: libleveldb1
  123. <<: *debpkg_template
  124. deploy:ubuntu-14.04:
  125. image: ubuntu:trusty
  126. dependencies:
  127. - package:ubuntu-14.04
  128. variables:
  129. LEVELDB_PKG: libleveldb1
  130. <<: *debpkg_install
  131. # Xenial
  132. build:ubuntu-16.04:
  133. <<: *build_definition
  134. image: ubuntu:xenial
  135. before_script:
  136. - apt-get update -y
  137. - 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
  138. package:ubuntu-16.04:
  139. image: ubuntu:xenial
  140. dependencies:
  141. - build:ubuntu-16.04
  142. variables:
  143. LEVELDB_PKG: libleveldb1v5
  144. <<: *debpkg_template
  145. deploy:ubuntu-16.04:
  146. image: ubuntu:xenial
  147. dependencies:
  148. - package:ubuntu-16.04
  149. variables:
  150. LEVELDB_PKG: libleveldb1v5
  151. <<: *debpkg_install
  152. # Yakkety
  153. #build:ubuntu-16.10:
  154. # <<: *build_definition
  155. # image: ubuntu:yakkety
  156. # before_script:
  157. # - apt-get update -y
  158. # - 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
  159. #package:ubuntu-16.10:
  160. # image: ubuntu:yakkety
  161. # dependencies:
  162. # - build:ubuntu-16.10
  163. # variables:
  164. # LEVELDB_PKG: libleveldb1v5
  165. # <<: *debpkg_template
  166. #deploy:ubuntu-16.10:
  167. # image: ubuntu:yakkety
  168. # dependencies:
  169. # - package:ubuntu-16.10
  170. # variables:
  171. # LEVELDB_PKG: libleveldb1v5
  172. # <<: *debpkg_install
  173. # Zesty
  174. #build:ubuntu-17.04:
  175. # <<: *build_definition
  176. # image: ubuntu:zesty
  177. # before_script:
  178. # - apt-get update -y
  179. # - 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
  180. #package:ubuntu-17.04:
  181. # image: ubuntu:zesty
  182. # dependencies:
  183. # - build:ubuntu-17.04
  184. # variables:
  185. # LEVELDB_PKG: libleveldb1v5
  186. # <<: *debpkg_template
  187. #deploy:ubuntu-17.04:
  188. # image: ubuntu:zesty
  189. # dependencies:
  190. # - package:ubuntu-17.04
  191. # variables:
  192. # LEVELDB_PKG: libleveldb1v5
  193. # <<: *debpkg_install
  194. ##
  195. ## Fedora
  196. ##
  197. build:fedora-24:
  198. <<: *build_definition
  199. image: fedora:24
  200. before_script:
  201. - dnf -y install make automake gcc gcc-c++ kernel-devel cmake libcurl* openal* libvorbis* libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel
  202. ##
  203. ## Mingw for Windows
  204. ##
  205. .generic_win_template: &generic_win_template
  206. image: ubuntu:xenial
  207. before_script:
  208. - apt-get update -y
  209. - apt-get install -y p7zip-full wget unzip git cmake gettext
  210. - wget http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_7.1.1_ubuntu14.04.7z -O mingw.7z > /dev/null
  211. - sed -e "s|%PREFIX%|${WIN_ARCH}-w64-mingw32|" -e "s|%ROOTPATH%|/usr/${WIN_ARCH}-w64-mingw32|" < util/travis/toolchain_mingw.cmake.in > ${TOOLCHAIN_OUTPUT}
  212. - 7z x -y -o/usr mingw.7z > /dev/null
  213. .build_win_template: &build_win_template
  214. <<: *generic_win_template
  215. stage: build
  216. artifacts:
  217. when: on_success
  218. expire_in: 2h
  219. paths:
  220. - build/*
  221. .package_win_template: &package_win_template
  222. <<: *generic_win_template
  223. stage: package
  224. script:
  225. - cd build/minetest/_build
  226. - make package
  227. - cd ../../../
  228. - mkdir minetest-win-${WIN_ARCH}
  229. - unzip build/minetest/_build/minetest-*-win*.zip -d minetest-win-${WIN_ARCH}
  230. - cp /usr/${WIN_ARCH}-w64-mingw32/bin/libgcc*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin
  231. - cp /usr/${WIN_ARCH}-w64-mingw32/bin/libstdc++*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin
  232. - cp /usr/${WIN_ARCH}-w64-mingw32/bin/libwinpthread*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin
  233. artifacts:
  234. when: on_success
  235. expire_in: 90 day
  236. paths:
  237. - minetest-win-*/*
  238. build:win32:
  239. <<: *build_win_template
  240. script:
  241. - ./util/buildbot/buildwin32.sh build
  242. variables:
  243. NO_PACKAGE: "1"
  244. WIN_ARCH: "i686"
  245. TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake"
  246. package:win32:
  247. <<: *package_win_template
  248. dependencies:
  249. - build:win32
  250. variables:
  251. NO_PACKAGE: "1"
  252. WIN_ARCH: "i686"
  253. TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake"
  254. build:win64:
  255. <<: *build_win_template
  256. script:
  257. - ./util/buildbot/buildwin64.sh build
  258. variables:
  259. NO_PACKAGE: "1"
  260. WIN_ARCH: "x86_64"
  261. TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake"
  262. package:win64:
  263. <<: *package_win_template
  264. dependencies:
  265. - build:win64
  266. variables:
  267. NO_PACKAGE: "1"
  268. WIN_ARCH: "x86_64"
  269. TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake"
  270. package:docker:
  271. stage: package
  272. image: docker:stable
  273. services:
  274. - docker:dind
  275. before_script:
  276. - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
  277. script:
  278. - docker build . -t ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA -t ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME -t ${CONTAINER_IMAGE}/server:latest
  279. - docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA
  280. - docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME
  281. - docker push ${CONTAINER_IMAGE}/server:latest
  282. pages:
  283. stage: deploy
  284. image: python:3.7
  285. before_script:
  286. - pip install pip==18.1
  287. - pip install git+https://github.com/Python-Markdown/markdown.git
  288. - pip install git+https://github.com/mkdocs/mkdocs.git
  289. - pip install pygments
  290. script:
  291. - cd doc/mkdocs && ./build.sh
  292. artifacts:
  293. paths:
  294. - public
  295. only:
  296. - master