.gitlab-ci.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. cache:
  2. key: "${CI_JOB_NAME}"
  3. paths:
  4. - .ccache/
  5. variables:
  6. USE_CCACHE: "true"
  7. CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
  8. CCACHE_DIR: "${CI_PROJECT_DIR}/.ccache"
  9. CCACHE_COMPILERCHECK: "content"
  10. DEBIAN_FRONTEND: 'noninteractive'
  11. stages:
  12. - build
  13. - advanced_build
  14. - test
  15. .debian_build: &debian_build
  16. script:
  17. - apt update && apt -y install --no-install-recommends eatmydata
  18. - eatmydata -- apt -y dist-upgrade
  19. - eatmydata -- apt -y install --no-install-recommends ${PACKAGES}
  20. - if [ -n "${EXPERIMENTAL_PACKAGES}" ]; then apt -y install --no-install-recommends -t experimental ${EXPERIMENTAL_PACKAGES}; fi
  21. - eatmydata -- .ci-build/build.sh
  22. debian-stable:
  23. image: debian:latest
  24. stage: build
  25. variables:
  26. SCONSOPTS: 'qt=yes xgps=yes'
  27. PACKAGES: 'build-essential ccache debhelper po-debconf
  28. python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  29. <<: *debian_build
  30. debian-unstable:gcc:
  31. image: debian:unstable
  32. stage: advanced_build
  33. variables:
  34. SCONSOPTS: 'qt=yes xgps=yes'
  35. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  36. <<: *debian_build
  37. debian-experimental:gcc:
  38. allow_failure: true
  39. image: debian:experimental
  40. stage: advanced_build
  41. variables:
  42. SCONSOPTS: 'qt=yes xgps=yes'
  43. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  44. EXPERIMENTAL_PACKAGES: 'gcc g++'
  45. <<: *debian_build
  46. debian-unstable:clang:
  47. image: debian:unstable
  48. stage: advanced_build
  49. variables:
  50. SCONSOPTS: 'qt=yes xgps=yes'
  51. CC: 'clang'
  52. CXX: 'clang++'
  53. PACKAGES: 'clang build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  54. <<: *debian_build
  55. debian-experimental:clang:
  56. allow_failure: true
  57. image: debian:experimental
  58. stage: advanced_build
  59. variables:
  60. SCONSOPTS: 'qt=yes xgps=yes'
  61. CC: 'clang'
  62. CXX: 'clang++'
  63. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  64. EXPERIMENTAL_PACKAGES: 'clang'
  65. <<: *debian_build
  66. debian-unstable:minimal:
  67. image: debian:unstable
  68. stage: advanced_build
  69. variables:
  70. SCONSOPTS: 'aivdm=no ashtech=no bluez=no control_socket=no controlsend=no coveraging=no dbus_export=no debug=no earthmate=no evermore=no force_global=no fury=no fv18=no garmin=no garmintxt=no geostar=no gpsclock=no gpsdclients=no greis=no implicit_link=no isync=no itrax=no leapfetch=no libgpsmm=no magic_hat=no manbuild=no minimal=no mtk3301=no navcom=no ncurses=no netfeed=no nmea0183=no nmea2000=no nostrip=no ntrip=no oceanserver=no oncore=no oscillator=no passthrough=no profiling=no python=no qt=no reconfigure=no rtcm104v2=no rtcm104v3=no shared=no shm_export=no sirf=no skytraq=no slow=no socket_export=yes squelch=no superstar2=no systemd=no timeservice=no tnt=no tripmate=no tsip=no ublox=no usb=no xgps=no'
  71. NOCHECK: 'true'
  72. PACKAGES: 'build-essential ccache scons chrpath lsb-release python3-all-dev'
  73. <<: *debian_build
  74. # the latest tag should match the last Ubuntu LTS release.
  75. ubuntu-latest:gcc:
  76. image: ubuntu:latest
  77. stage: advanced_build
  78. variables:
  79. SCONSOPTS: 'qt=yes xgps=yes'
  80. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  81. before_script:
  82. - apt update && apt -y install scons
  83. - sed -i "s/os.environ.has_key('DH_INTERNAL_OPTIONS')/'DH_INTERNAL_OPTIONS' in os.environ/" /usr/lib/scons/SCons/Script/Main.py
  84. <<: *debian_build
  85. # the "rolling" release
  86. ubuntu-rolling:gcc:
  87. image: ubuntu:rolling
  88. stage: advanced_build
  89. variables:
  90. SCONSOPTS: 'qt=yes xgps=yes'
  91. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  92. <<: *debian_build
  93. # the devel tag should point to the docker image of the next, upcoming Ubuntu release
  94. ubuntu-devel:gcc:
  95. image: ubuntu:devel
  96. stage: advanced_build
  97. variables:
  98. SCONSOPTS: 'qt=yes xgps=yes'
  99. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  100. <<: *debian_build
  101. fedora-latest:
  102. image: fedora:latest
  103. stage: advanced_build
  104. variables:
  105. SCONSOPTS: 'qt=yes xgps=yes'
  106. script:
  107. - dnf install -y ccache diffutils bluez-libs-devel chrpath dbus-devel desktop-file-utils gcc-c++ libXaw-devel ncurses-devel python-devel qt5-qtbase-devel scons xmlto pps-tools-devel
  108. - .ci-build/build.sh
  109. centos-7-latest:
  110. allow_failure: true
  111. interruptible: true
  112. when: on_success
  113. image: centos:centos7
  114. stage: advanced_build
  115. variables:
  116. SCONSOPTS: 'qt=yes xgps=yes'
  117. script:
  118. - yum -y update
  119. - yum -y install epel-release
  120. - yum -y install diffutils python2-scons bc gcc gcc-c++ bluez-libs-devel dbus-devel ncurses-devel python-devel pps-tools-devel libusbx-devel qt-devel gtk3-devel pyserial pycairo libxslt docbook-style-xsl rubygem-asciidoctor ccache
  121. - .ci-build/build.sh
  122. centos-8-latest:
  123. allow_failure: true
  124. interruptible: true
  125. when: manual
  126. image: centos:centos8
  127. stage: advanced_build
  128. variables:
  129. SCONSOPTS: 'qt=yes xgps=yes'
  130. script:
  131. - dnf -y install dnf-plugins-core epel-release python3
  132. - dnf config-manager --set-enabled PowerTools
  133. - dnf -y update
  134. - dnf -y install diffutils python3-scons bc ncurses-devel qt5-qtbase-devel pps-tools-devel libnsl2-devel bluez-libs-devel platform-python-devel dbus-devel libusbx-devel gtk3-devel python3-pyserial python3-cairo python3-gobject-base libxslt docbook-style-xsl ccache
  135. - .ci-build/build.sh
  136. # to avoid failed builds on MRs/forks where no builder with the
  137. # tag `freebsd` is available, run this job only if
  138. # $HAVE_FREEBSD == "true"
  139. # set this in your CI environment settings in gitlab.
  140. freebsd:
  141. only:
  142. variables:
  143. - $HAVE_FREEBSD == "true"
  144. stage: advanced_build
  145. variables:
  146. # 1 Oct 20, 0.01250, 0.02, are too short
  147. WRITE_PAD: '0.05'
  148. tags:
  149. - freebsd
  150. script:
  151. - .ci-build/build.sh
  152. timeout: 1 h 10m
  153. # to avoid failed builds on MRs/forks where no builder with the
  154. # tag `sparc64` is available, run this job only if
  155. # $HAVE_SPARC64_LINUX == "true"
  156. # set this in your CI environment settings in gitlab.
  157. sparc64-linux:
  158. # sparc64 gitlab-runner broken 7 Nov 2020
  159. # fatal: unable to access 'https://gitlab.com/gpsd/gpsd.git/':
  160. # gnutls_handshake() failed: The TLS connection was non-properly terminated.
  161. allow_failure: true
  162. only:
  163. variables:
  164. - $HAVE_SPARC64_LINUX == "true"
  165. stage: advanced_build
  166. tags:
  167. - sparc64
  168. - linux
  169. script:
  170. - .ci-build/build.sh
  171. timeout: 1 h 10m
  172. # to avoid failed builds on MRs/forks where no builder with the
  173. # tag `mips64le` is available, run this job only if
  174. # $HAVE_MIPS64LE_LINUX == "true"
  175. # set this in your CI environment settings in gitlab.
  176. mips64le-linux:
  177. only:
  178. variables:
  179. - $HAVE_MIPS64LE_LINUX == "true"
  180. stage: advanced_build
  181. tags:
  182. - mips64le
  183. - linux
  184. script:
  185. - .ci-build/build.sh
  186. scan-build:
  187. allow_failure: true
  188. image: debian:unstable
  189. stage: test
  190. needs: ["debian-unstable:gcc"]
  191. variables:
  192. SCONSOPTS: 'qt=yes xgps=yes'
  193. SCAN_BUILD: 'scan-build -o scan_build'
  194. NOCHECK: 'true'
  195. PACKAGES: 'clang clang-tools build-essential debhelper po-debconf python3-all-dev python3-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  196. artifacts:
  197. paths:
  198. - scan_build
  199. expire_in: 1 week
  200. <<: *debian_build
  201. # https://www.synopsys.com/blogs/software-security/integrating-coverity-scan-with-gitlab-ci/
  202. coverity:
  203. allow_failure: true
  204. image: debian:latest
  205. stage: test
  206. needs: ["debian-stable"]
  207. only:
  208. refs:
  209. - master
  210. variables:
  211. - $COVERITY_SCAN_TOKEN != null
  212. variables:
  213. SCONSOPTS: 'qt=yes xgps=yes'
  214. SCAN_BUILD: 'cov-analysis-linux64-*/bin/cov-build --dir cov-int'
  215. NOCHECK: 'true'
  216. PACKAGES: 'clang clang-tools build-essential debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd'
  217. before_script:
  218. - apt update && apt -y install curl git
  219. - curl -o /tmp/cov-analysis-linux64.tgz https://scan.coverity.com/download/linux64 --form project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN
  220. - tar xfz /tmp/cov-analysis-linux64.tgz
  221. after_script:
  222. - tar cfz cov-int.tar.gz cov-int
  223. - curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
  224. --form token=$COVERITY_SCAN_TOKEN --form email=$COVERITY_USER_EMAIL
  225. --form file=@cov-int.tar.gz --form version="`git describe --tags`"
  226. --form description="`git describe --tags` / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID "
  227. artifacts:
  228. paths:
  229. - cov-int
  230. <<: *debian_build
  231. # as long as sconstruct has so many options, this does not make sense
  232. # needs a better / faster way to test
  233. #
  234. #test-options:
  235. # image: debian:unstable
  236. # stage: test
  237. # needs: ["debian-unstable:gcc"]
  238. # variables:
  239. # DEBIAN_FRONTEND: 'noninteractive'
  240. # when: manual
  241. # script:
  242. # - apt update && apt -y install build-essential debhelper po-debconf python3-all-dev python3-all-dbg xsltproc docbook-xsl docbook-xml asciidoctor libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev libqt5network5 lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd
  243. # - .ci-build/test_options.sh
  244. #
  245. .changes_pages: &changes_pages
  246. changes:
  247. - 'www/*'
  248. - 'www/*/*'
  249. - '*.adoc'
  250. - 'man/*.xml'
  251. .should_build_pages: &should_build_pages
  252. only:
  253. refs:
  254. - master
  255. <<: *changes_pages
  256. pages:
  257. image: alpine:latest
  258. stage: build
  259. script:
  260. - apk update && apk add python3 xmlto asciidoctor scons rsync musl-dev gcc
  261. - mkdir .pages; WEBSITE=.public scons website=.pages website; mv .public public
  262. - find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
  263. - ls -lR public
  264. artifacts:
  265. paths:
  266. - public
  267. <<: *should_build_pages
  268. dist-1f33:
  269. image: fedora:33
  270. stage: advanced_build
  271. script:
  272. - dnf install -y gcc-c++ python3-devel scons xmlto asciidoctor bzip2 xz git dnf-plugins-core
  273. - scons dist
  274. - dnf builddep -y packaging/rpm/gpsd.spec
  275. - dnf install -y chrpath fedora-packager rpmdevtools
  276. - rpmdev-setuptree
  277. - cp gpsd-*.tar.* ~/rpmbuild/SOURCES/
  278. - rpmbuild -ba packaging/rpm/gpsd.spec
  279. - dnf install -y createrepo_c
  280. - mkdir -pv .pages .public/repos/Fedora/33/gpsd/x86_64/RPMS
  281. - mv -v /root/rpmbuild/RPMS/x86_64/*.rpm .public/repos/Fedora/33/gpsd/x86_64/RPMS
  282. - createrepo_c -v --deltas --retain-old-md 1 .public/repos/Fedora/33/gpsd/x86_64/RPMS
  283. artifacts:
  284. paths:
  285. - .public/repos/Fedora/33/gpsd/x86_64/RPMS/
  286. - gpsd-*.tar.*
  287. - packaging/rpm/gpsd.spec
  288. expire_in: 2 weeks
  289. only:
  290. - schedules
  291. - tags
  292. - web