.gitlab-ci.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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 python3-all-dev python3-all-dbg 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 python3-lib2to3 python3'
  28. <<: *debian_build
  29. debian-unstable:gcc:
  30. image: debian:unstable
  31. stage: advanced_build
  32. variables:
  33. SCONSOPTS: 'qt=yes xgps=yes'
  34. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg 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 python3-lib2to3 python3'
  35. <<: *debian_build
  36. debian-experimental:gcc:
  37. allow_failure: true
  38. image: debian:experimental
  39. stage: advanced_build
  40. variables:
  41. SCONSOPTS: 'qt=yes xgps=yes'
  42. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg 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 python3-lib2to3 python3'
  43. EXPERIMENTAL_PACKAGES: 'gcc g++'
  44. <<: *debian_build
  45. debian-unstable:clang:
  46. image: debian:unstable
  47. stage: advanced_build
  48. variables:
  49. SCONSOPTS: 'qt=yes xgps=yes'
  50. CC: 'clang'
  51. CXX: 'clang++'
  52. PACKAGES: 'clang build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg 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 python3-lib2to3 python3'
  53. <<: *debian_build
  54. debian-experimental:clang:
  55. allow_failure: true
  56. image: debian:experimental
  57. stage: advanced_build
  58. variables:
  59. SCONSOPTS: 'qt=yes xgps=yes'
  60. CC: 'clang'
  61. CXX: 'clang++'
  62. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg 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 python3-lib2to3 python3'
  63. EXPERIMENTAL_PACKAGES: 'clang'
  64. <<: *debian_build
  65. debian-unstable:minimal:
  66. image: debian:unstable
  67. stage: advanced_build
  68. variables:
  69. 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'
  70. NOCHECK: 'true'
  71. PACKAGES: 'build-essential ccache scons chrpath lsb-release python3-all-dev python3-lib2to3 python3'
  72. <<: *debian_build
  73. # the latest tag should match the last Ubuntu LTS release.
  74. ubuntu-latest:gcc:
  75. image: ubuntu:latest
  76. stage: advanced_build
  77. variables:
  78. SCONSOPTS: 'qt=yes xgps=yes'
  79. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg 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'
  80. before_script:
  81. - apt update && apt -y install scons
  82. - sed -i "s/os.environ.has_key('DH_INTERNAL_OPTIONS')/'DH_INTERNAL_OPTIONS' in os.environ/" /usr/lib/scons/SCons/Script/Main.py
  83. <<: *debian_build
  84. # the "rolling" release
  85. ubuntu-rolling:gcc:
  86. # Broken 19 April 2021
  87. allow_failure: true
  88. image: ubuntu:rolling
  89. stage: advanced_build
  90. variables:
  91. SCONSOPTS: 'qt=yes xgps=yes'
  92. # package gone April 2021
  93. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg 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'
  94. <<: *debian_build
  95. # the devel tag should point to the docker image of the next, upcoming Ubuntu release
  96. ubuntu-devel:gcc:
  97. # Broken 20 Nov 2020
  98. allow_failure: true
  99. image: ubuntu:devel
  100. stage: advanced_build
  101. variables:
  102. SCONSOPTS: 'qt=yes xgps=yes'
  103. PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg 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 python3-setuptools'
  104. <<: *debian_build
  105. fedora-latest:
  106. # Broken 8 Feb 2022
  107. allow_failure: true
  108. image: fedora:latest
  109. stage: advanced_build
  110. variables:
  111. SCONSOPTS: 'qt=yes xgps=yes'
  112. script:
  113. - 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 pps-tools-devel
  114. - .ci-build/build.sh
  115. centos-7-latest:
  116. allow_failure: true
  117. interruptible: true
  118. when: on_success
  119. image: centos:centos7
  120. stage: advanced_build
  121. variables:
  122. SCONSOPTS: 'qt=yes xgps=yes'
  123. script:
  124. - yum -y update
  125. - yum -y install epel-release
  126. - 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 rubygem-asciidoctor ccache
  127. - .ci-build/build.sh
  128. centos-8-latest:
  129. allow_failure: true
  130. interruptible: true
  131. when: manual
  132. image: centos:centos8
  133. stage: advanced_build
  134. variables:
  135. SCONSOPTS: 'qt=yes xgps=yes'
  136. script:
  137. - dnf -y install dnf-plugins-core epel-release python3
  138. - dnf config-manager --set-enabled powertools
  139. - dnf -y update
  140. - 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 ccache
  141. - .ci-build/build.sh
  142. # to avoid failed builds on MRs/forks where no builder with the
  143. # tag `freebsd` is available, run this job only if
  144. # $HAVE_FREEBSD == "true"
  145. # set this in your CI environment settings in gitlab.
  146. freebsd:
  147. # FreeBSD jobe keeps timing out
  148. allow_failure: true
  149. only:
  150. variables:
  151. - $HAVE_FREEBSD == "true"
  152. stage: advanced_build
  153. variables:
  154. # 1 Oct 20, 0.01250, 0.02, are too short
  155. WRITE_PAD: '0.05'
  156. tags:
  157. - freebsd
  158. script:
  159. - .ci-build/build.sh
  160. timeout: 2 h
  161. # to avoid failed builds on MRs/forks where no builder with the
  162. # tag `sparc64` is available, run this job only if
  163. # $HAVE_SPARC64_LINUX == "true"
  164. # set this in your CI environment settings in gitlab.
  165. sparc64-linux:
  166. # sparc64 gitlab-runner broken 7 Nov 2020
  167. # fatal: unable to access 'https://gitlab.com/gpsd/gpsd.git/':
  168. # gnutls_handshake() failed: The TLS connection was non-properly terminated.
  169. allow_failure: true
  170. only:
  171. variables:
  172. - $HAVE_SPARC64_LINUX == "true"
  173. stage: advanced_build
  174. tags:
  175. - sparc64
  176. - linux
  177. script:
  178. - .ci-build/build.sh
  179. timeout: 1 h 10m
  180. # to avoid failed builds on MRs/forks where no builder with the
  181. # tag `mips64le` is available, run this job only if
  182. # $HAVE_MIPS64LE_LINUX == "true"
  183. # set this in your CI environment settings in gitlab.
  184. mips64le-linux:
  185. only:
  186. variables:
  187. - $HAVE_MIPS64LE_LINUX == "true"
  188. stage: advanced_build
  189. tags:
  190. - mips64le
  191. - linux
  192. script:
  193. - .ci-build/build.sh
  194. scan-build:
  195. allow_failure: true
  196. image: debian:unstable
  197. stage: test
  198. needs: ["debian-unstable:gcc"]
  199. variables:
  200. SCONSOPTS: 'qt=yes xgps=yes'
  201. SCAN_BUILD: 'scan-build -o scan_build'
  202. NOCHECK: 'true'
  203. PACKAGES: 'clang clang-tools build-essential debhelper po-debconf python3-all-dev python3-all-dbg 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'
  204. artifacts:
  205. paths:
  206. - scan_build
  207. expire_in: 1 week
  208. <<: *debian_build
  209. # https://www.synopsys.com/blogs/software-security/integrating-coverity-scan-with-gitlab-ci/
  210. coverity:
  211. allow_failure: true
  212. image: debian:latest
  213. stage: test
  214. needs: ["debian-stable"]
  215. only:
  216. refs:
  217. - master
  218. variables:
  219. - $COVERITY_SCAN_TOKEN != null
  220. variables:
  221. SCONSOPTS: 'qt=yes xgps=yes'
  222. SCAN_BUILD: 'cov-analysis-linux64-*/bin/cov-build --dir cov-int'
  223. NOCHECK: 'true'
  224. PACKAGES: 'clang clang-tools build-essential debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg 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'
  225. before_script:
  226. - apt update && apt -y install curl git
  227. - curl -o /tmp/cov-analysis-linux64.tgz https://scan.coverity.com/download/linux64 --form project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN
  228. - tar xfz /tmp/cov-analysis-linux64.tgz
  229. after_script:
  230. - tar cfz cov-int.tar.gz cov-int
  231. - curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
  232. --form token=$COVERITY_SCAN_TOKEN --form email=$COVERITY_USER_EMAIL
  233. --form file=@cov-int.tar.gz --form version="`git describe --tags`"
  234. --form description="`git describe --tags` / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID "
  235. artifacts:
  236. paths:
  237. - cov-int
  238. <<: *debian_build
  239. # as long as sconstruct has so many options, this does not make sense
  240. # needs a better / faster way to test
  241. #
  242. #test-options:
  243. # image: debian:unstable
  244. # stage: test
  245. # needs: ["debian-unstable:gcc"]
  246. # variables:
  247. # DEBIAN_FRONTEND: 'noninteractive'
  248. # when: manual
  249. # script:
  250. # - apt update && apt -y install build-essential debhelper po-debconf python3-all-dev python3-all-dbg 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
  251. # - .ci-build/test_options.sh
  252. #
  253. .changes_pages: &changes_pages
  254. changes:
  255. - '.gitlab-ci.yml'
  256. - 'SCons*'
  257. - 'www/*'
  258. - 'www/*/*'
  259. - '*.adoc'
  260. - 'NEWS'
  261. .should_build_pages: &should_build_pages
  262. only:
  263. refs:
  264. - master
  265. <<: *changes_pages
  266. pages:
  267. image: alpine:latest
  268. stage: build
  269. script:
  270. - apk update && apk add python3 asciidoctor scons rsync musl-dev gcc
  271. - gem install rouge
  272. - mkdir .pages; WEBSITE=.public scons website=.pages website; mv .public public
  273. - find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
  274. - ls -lR public
  275. artifacts:
  276. paths:
  277. - public
  278. <<: *should_build_pages
  279. .frpm_build: &frpm_build
  280. stage: advanced_build
  281. before_script:
  282. - dnf install -y bluez-libs-devel bzip2 chrpath createrepo_c dbus-devel dbus-glib-devel desktop-file-utils dnf-plugins-core gcc-c++ git ncurses-devel qt-devel pps-tools-devel python3-devel rpmdevtools systemd xz
  283. - dnf install -y asciidoctor libusb1-devel python3-devel python3-scons fedora-packager
  284. script:
  285. - python3 $(command -v scons) -c
  286. - python3 $(command -v scons) build
  287. - python3 $(command -v scons) dist
  288. - python3 $(command -v scons) distrpm
  289. after_script:
  290. - ls -laR /root/rpmbuild/RPMS/
  291. - mkdir -pv .pages .public/repos/$REPOPATH/gpsd/x86_64/RPMS
  292. - mv -v /root/rpmbuild/RPMS/x86_64/*.rpm .public/repos/$REPOPATH/gpsd/x86_64/RPMS
  293. - createrepo_c -v --deltas --retain-old-md 1 .public/repos/$REPOPATH/gpsd/x86_64/RPMS
  294. artifacts:
  295. paths:
  296. - .public/repos/*/*/gpsd/x86_64/RPMS/
  297. - gpsd-*.tar.*
  298. - gpsd-*/packaging/rpm/gpsd.spec
  299. expire_in: 2 weeks
  300. only:
  301. - schedules
  302. - tags
  303. - web
  304. dist-f35:
  305. variables:
  306. REPOPATH: "Fedora/35"
  307. image: fedora:35
  308. <<: *frpm_build
  309. dist-f36:
  310. variables:
  311. REPOPATH: "Fedora/36"
  312. image: fedora:36
  313. <<: *frpm_build
  314. dist-f34:
  315. variables:
  316. REPOPATH: "Fedora/34"
  317. image: fedora:34
  318. <<: *frpm_build