gitlab CI: update to use the fdo ci templates
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 4 Jun 2020 05:40:49 +0000 (15:40 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 4 Jun 2020 23:33:31 +0000 (09:33 +1000)
Instead of building a new debian image every time we build the repo, let's build
it once and re-use it. This way we're more  likely to spot actual bugs vs issues
with the distribution (or mirrors). This is the same approach mesa, gstreamer,
libinput, etc. already use.

The pipeline consists of two parts: container-build and distribution-image. Both
use the FDO_DISTRIBUTION_... variables to do their thing, the former to build an
image, the latter to use that image. The container-build step is a noop if an
image with that tag already exists in the registry, the templates take care of
all that.

The .debian.buster section groups the variables needed to easily extend all jobs
requiring buster. Not all variables are used by all jobs but meh.

The grouping is slightly odd because some debian-specific variables are in
the global variables and others in the .debian.buster section. This grouping
will make things easier if we extend to build on other distributions - then we
have all packages and tags in one place.

Because buster doesn't have a recent-enough version of meson, we install that
from pip.

Fixes #79

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
.gitlab-ci.yml

index 1037fee..b2e174f 100644 (file)
@@ -1,19 +1,50 @@
-image: debian:buster
+.templates_sha: &template_sha bd8010dd0123d3f0dda4ef691078566af2842613 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
+
+
+include:
+  # Debian container builder template
+  - project: 'freedesktop/ci-templates'
+    ref: *template_sha
+    file: '/templates/debian.yml'
+
 
 stages:
+  - prep
   - build
 
-before_script:
-  - echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
-  - echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
-  - echo '#!/bin/sh' > /usr/sbin/policy-rc.d
-  - echo 'exit 101' >> /usr/sbin/policy-rc.d
-  - chmod +x /usr/sbin/policy-rc.d
-  - echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list
-  - apt-get update
-  - apt-get -y --no-install-recommends install build-essential automake autoconf libtool pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl meson/buster-backports
+
+variables:
+  DEBIAN_PACKAGES: 'build-essential automake autoconf libtool pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl python3-pip python3-setuptools ninja-build'
+  DEBIAN_EXEC: 'pip3 install meson==0.52.1'
+  # these tags should be updated each time the list of packages is updated
+  # changing these will force rebuilding the associated image
+  # Note: these tags have no meaning and are not tied to a particular
+  # wayland version
+  DEBIAN_TAG: '2020-06-05.1'
+  FDO_UPSTREAM_REPO: wayland/wayland
+
+
+.debian.buster:
+  variables:
+    FDO_DISTRIBUTION_PACKAGES: $DEBIAN_PACKAGES
+    FDO_DISTRIBUTION_TAG: $DEBIAN_TAG
+    FDO_DISTRIBUTION_VERSION: 'buster'
+    FDO_DISTRIBUTION_EXEC: $DEBIAN_EXEC
+
+
+debian:buster@container-prep:
+  extends:
+    - .debian.buster
+    - .fdo.container-build@debian
+  stage: prep
+  variables:
+    GIT_STRATEGY: none
+
 
 build-native-autotools:
+  extends:
+    - .debian.buster
+    - .fdo.distribution-image@debian
   stage: build
   script:
   - export BUILD_ID="wayland-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
@@ -36,7 +67,11 @@ build-native-autotools:
     - build-*/*.log
     - prefix-*
 
+
 build-native-meson:
+  extends:
+    - .debian.buster
+    - .fdo.distribution-image@debian
   stage: build
   script:
   - export BUILD_ID="wayland-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"