gitlab CI: use the ci-templates FreeBSD templates

Replace our cross-compilation for FreeBSD with a proper template.
FreeBSD doesn't do normal containers so we need a bunch of if/else to
skip the container builds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2021-07-26 11:13:17 +10:00
parent 21824bc6ff
commit 833e49ce01
4 changed files with 80 additions and 166 deletions

View file

@ -53,6 +53,10 @@ include:
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/fedora.yml'
# Freebsd container builder template
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/freebsd.yml'
# Ubuntu container builder template
- project: 'freedesktop/ci-templates'
ref: *template_sha
@ -88,23 +92,22 @@ variables:
UBUNTU_PACKAGES: 'git gcc g++ pkg-config meson check libudev-dev libevdev-dev doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx-rtd-theme python3-pytest-xdist libwacom-dev libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev'
ARCH_PACKAGES: 'git gcc pkgconfig meson check libsystemd libevdev doxygen graphviz python-sphinx python-recommonmark python-sphinx_rtd_theme python-pytest-xdist libwacom gtk3 mtdev diffutils'
ALPINE_PACKAGES: 'git gcc build-base pkgconfig meson check-dev eudev-dev libevdev-dev libwacom-dev cairo-dev gtk+3.0-dev mtdev-dev bash'
FREEBSD_PACKAGES: 'libepoll-shim libudev-devd libevdev libwacom gtk3 libmtdev'
FREEBSD_BUILD_PKGS: 'meson'
FREEBSD_PACKAGES: 'git pkgconf meson libepoll-shim libudev-devd libevdev libwacom gtk3 libmtdev bash'
############################ end of package lists #############################
# 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
# libinput version
FEDORA_TAG: '2021-07-28.0'
DEBIAN_TAG: '2021-07-28.0'
UBUNTU_TAG: '2021-07-28.0'
ARCH_TAG: '2021-07-28.0'
ALPINE_TAG: '2021-07-28.0'
FREEBSD_TAG: '2021-07-28.0'
FEDORA_QEMU_TAG: 'fedora-qemu-vm-2021-07-28.0'
FEDORA_TAG: '2021-07-28.1'
DEBIAN_TAG: '2021-07-28.1'
UBUNTU_TAG: '2021-07-28.1'
ARCH_TAG: '2021-07-28.1'
ALPINE_TAG: '2021-07-28.1'
FREEBSD_TAG: '2021-07-28.1'
FEDORA_QEMU_TAG: 'fedora-qemu-vm-2021-07-28.1'
FREEBSD_QEMU_TAG: 'freebsd-qemu-vm-2021-07-28.1'
FREEBSD_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/freebsd/11.2:$FREEBSD_TAG
FDO_UPSTREAM_REPO: libinput/libinput
MESON_BUILDDIR: "build dir"
@ -192,10 +195,24 @@ fedora:34@qemu-prep:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_VERSION: 34
FDO_DISTRIBUTION_VERSION: "34"
FDO_DISTRIBUTION_TAG: $FEDORA_QEMU_TAG
FDO_DISTRIBUTION_PACKAGES: $FEDORA_PACKAGES
freebsd:13.0@qemu-prep:
extends:
- .fdo.qemu-build@freebsd
- .policy
stage: prep
tags:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_VERSION: "13.0"
FDO_DISTRIBUTION_TAG: $FREEBSD_QEMU_TAG
FDO_DISTRIBUTION_PACKAGES: $FREEBSD_PACKAGES
fedora:33@container-prep:
extends:
- .fdo.container-build@fedora
@ -275,57 +292,6 @@ alpine:latest@container-prep:
# Note that we want to use the latest buildah image, and for that
# we use one of the .fdo.container-build@distribution by replacing the
# `script`.
.freebsd@container-prep:
extends:
- .policy
- .fdo.container-build@fedora
stage: prep
script:
# log in to the registry
- podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# get the full container image name
- export IMAGE=freebsd/$FREEBSD_VERSION:$FREEBSD_TAG
- if [[ x"$FDO_FORCE_REBUILD" != x ]] ; then touch .rebuild; fi
# pull the latest upstream image if it exists
- test -e .rebuild || skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE
docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
# check if our image is already in the current registry
- test -e .rebuild || skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
- export BUILDAH_RUN="buildah run --isolation chroot"
- export BUILDAH_COMMIT="buildah commit --format docker"
- buildcntr=$(buildah from --quiet myfreeweb/freebsd-cross:latest)
- $BUILDAH_RUN $buildcntr apk add --no-cache $FREEBSD_BUILD_PKGS
- $BUILDAH_RUN $buildcntr pkg -r /freebsd update -f
- $BUILDAH_RUN $buildcntr pkg -r /freebsd install -y $FREEBSD_PACKAGES
- buildah config --workingdir /app $buildcntr
# tag the current container
- $BUILDAH_COMMIT $buildcntr $FREEBSD_CONTAINER_IMAGE
# clean up the working container
- buildah rm $buildcntr
# push the container image to the libinput registry
- podman push --quiet $FREEBSD_CONTAINER_IMAGE
- skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
docker://$FREEBSD_CONTAINER_IMAGE
docker://$CI_REGISTRY_IMAGE/freebsd/$FREEBSD_VERSION:$CI_JOB_ID
freebsd:11.2@container-prep:
extends:
- .freebsd@container-prep
variables:
GIT_STRATEGY: none
FREEBSD_VERSION: "11.2"
#################################################################
# #
# container clean stage #
@ -421,13 +387,6 @@ alpine:latest@container-clean:
FDO_DISTRIBUTION_TAG: $ALPINE_TAG
freebsd:11.2@container-clean:
extends:
- .container-clean
variables:
GIT_STRATEGY: none
CURRENT_CONTAINER_IMAGE: $FREEBSD_CONTAINER_IMAGE
#################################################################
# #
# build stage #
@ -1014,25 +973,19 @@ alpine:latest@default-build:
- "alpine:latest@container-prep"
#
# FreeBSD
#
.freebsd@template:
freebsd:13.0@default-build:
stage: distro
extends:
- .build@template
image: $FREEBSD_CONTAINER_IMAGE
- .build-in-qemu@template
- .fdo.distribution-image@freebsd
variables:
MESON_ARGS: '--cross-file freebsd -Ddocumentation=false -Dtests=false -Depoll-dir=/freebsd/usr/local/'
# Can't run FreeBSD tests on Linux machine, so MESON_TEST_ARGS shouldn't be "test"
MESON_TEST_ARGS: ''
freebsd:11.2@default-build:
extends:
- .freebsd@template
FDO_DISTRIBUTION_VERSION: '13.0'
FDO_DISTRIBUTION_TAG: $FREEBSD_QEMU_TAG
MESON_ARGS: '-Dtests=false -Ddocumentation=false' # doxygen drags down too many deps
MESON_TEST_ARGS: '' # test suite doesn't work on BSD yet
needs:
- "freebsd:11.2@container-prep"
- "freebsd:13.0@qemu-prep"
#################################################################
# #

View file

@ -40,12 +40,10 @@
include:
{% for distro in distributions|sort(attribute="name") %}
{% if not distro.does_not_have_ci_templates %}
# {{ distro.name.capitalize() }} container builder template
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/{{distro.name}}.yml'
{% endif %}
{% endfor %}
- project: 'freedesktop/ci-templates'
ref: *template_sha
@ -76,7 +74,6 @@ variables:
{% for distro in distributions %}
{{"%-17s" | format(distro.name.upper() + '_PACKAGES:')}} '{{ distro.packages|join(' ')}}'
{% endfor %}
FREEBSD_BUILD_PKGS: 'meson'
############################ end of package lists #############################
# these tags should be updated each time the list of packages is updated
@ -92,7 +89,6 @@ variables:
{% endif %}
{% endfor %}
FREEBSD_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/freebsd/11.2:$FREEBSD_TAG
FDO_UPSTREAM_REPO: libinput/libinput
MESON_BUILDDIR: "build dir"
@ -183,12 +179,14 @@ check-commit:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_VERSION: {{version}}
FDO_DISTRIBUTION_VERSION: "{{version}}"
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_QEMU_TAG
FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_PACKAGES
{% endfor %}
{% for distro in distributions %}
{% if not distro.skip_container %}
{% for version in distro.versions %}
{{distro.name}}:{{version}}@container-prep:
extends:
@ -202,60 +200,10 @@ check-commit:
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
{% endfor %}
{% endif %}
{% endfor %}
# Note that we want to use the latest buildah image, and for that
# we use one of the .fdo.container-build@distribution by replacing the
# `script`.
.freebsd@container-prep:
extends:
- .policy
- .fdo.container-build@fedora
stage: prep
script:
# log in to the registry
- podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# get the full container image name
- export IMAGE=freebsd/$FREEBSD_VERSION:$FREEBSD_TAG
- if [[ x"$FDO_FORCE_REBUILD" != x ]] ; then touch .rebuild; fi
# pull the latest upstream image if it exists
- test -e .rebuild || skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE
docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
# check if our image is already in the current registry
- test -e .rebuild || skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
- export BUILDAH_RUN="buildah run --isolation chroot"
- export BUILDAH_COMMIT="buildah commit --format docker"
- buildcntr=$(buildah from --quiet myfreeweb/freebsd-cross:latest)
- $BUILDAH_RUN $buildcntr apk add --no-cache $FREEBSD_BUILD_PKGS
- $BUILDAH_RUN $buildcntr pkg -r /freebsd update -f
- $BUILDAH_RUN $buildcntr pkg -r /freebsd install -y $FREEBSD_PACKAGES
- buildah config --workingdir /app $buildcntr
# tag the current container
- $BUILDAH_COMMIT $buildcntr $FREEBSD_CONTAINER_IMAGE
# clean up the working container
- buildah rm $buildcntr
# push the container image to the libinput registry
- podman push --quiet $FREEBSD_CONTAINER_IMAGE
- skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
docker://$FREEBSD_CONTAINER_IMAGE
docker://$CI_REGISTRY_IMAGE/freebsd/$FREEBSD_VERSION:$CI_JOB_ID
freebsd:11.2@container-prep:
extends:
- .freebsd@container-prep
variables:
GIT_STRATEGY: none
FREEBSD_VERSION: "11.2"
#################################################################
# #
# container clean stage #
@ -288,6 +236,7 @@ freebsd:11.2@container-prep:
- schedules
{% for distro in distributions %}
{% if not distro.skip_container %}
{% for version in distro.versions %}
{{distro.name}}:{{version}}@container-clean:
extends:
@ -299,15 +248,9 @@ freebsd:11.2@container-prep:
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
{% endfor %}
{% endif %}
{% endfor %}
freebsd:11.2@container-clean:
extends:
- .container-clean
variables:
GIT_STRATEGY: none
CURRENT_CONTAINER_IMAGE: $FREEBSD_CONTAINER_IMAGE
#################################################################
# #
# build stage #
@ -404,6 +347,7 @@ freebsd:11.2@container-clean:
{# qemu tests are only done for the latest version of any distribution #}
{% for distro in distributions if distro.want_qemu %}
{% set version = "{}".format(distro.versions|last()) %}
{% if distro.use_for_custom_build_tests %}
.{{distro.name}}:{{version}}@test-suite-vm:
extends:
- .test-suite-vm
@ -439,6 +383,7 @@ vm-valgrind-{{suite.name}}:
MESON_TEST_ARGS: '--setup=valgrind'
{% endfor %}
{% endif %}
{% endfor %}{# for if distro.want_qemu #}
{% for distro in distributions if distro.use_for_custom_build_tests %}
@ -646,6 +591,7 @@ coverity:
#################################################################
{% for distro in distributions %}
{% if not distro.skip_container %}
{% for version in distro.versions %}
{{distro.name}}:{{version}}@default-build:
stage: distro
@ -666,26 +612,27 @@ coverity:
{% endfor %}
{% endfor %}
#
# FreeBSD
#
.freebsd@template:
{% else %}
{% set version = "{}".format(distro.versions|last()) %}
{{distro.name}}:{{version}}@default-build:
stage: distro
extends:
- .build@template
image: $FREEBSD_CONTAINER_IMAGE
- .build-in-qemu@template
- .fdo.distribution-image@{{distro.name}}
variables:
MESON_ARGS: '--cross-file freebsd -Ddocumentation=false -Dtests=false -Depoll-dir=/freebsd/usr/local/'
# Can't run FreeBSD tests on Linux machine, so MESON_TEST_ARGS shouldn't be "test"
MESON_TEST_ARGS: ''
freebsd:11.2@default-build:
extends:
- .freebsd@template
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_QEMU_TAG
{# Where we have extra_variables defined, add them to the list #}
{% if distro.build is defined and distro.build.extra_variables is defined %}
{% for var in distro.build.extra_variables %}
{{var}}
{% endfor %}
{% endif %}
needs:
- "freebsd:11.2@container-prep"
- "{{distro.name}}:{{version}}@qemu-prep"
{% endif %}
{% endfor %}
#################################################################
# #

View file

@ -3,7 +3,7 @@
#
# We're happy to rebuild all containers when one changes.
.default_tag: &default_tag '2021-07-28.0'
.default_tag: &default_tag '2021-07-28.1'
distributions:
- name: fedora
@ -13,6 +13,7 @@ distributions:
- '34' # last is picked for qemu
want_qemu: true
use_for_custom_build_tests: true
use_for_qemu_tests: true
packages:
- git-core
- gcc
@ -133,14 +134,27 @@ distributions:
- "MESON_TEST_ARGS: '' # litest-selftest fails on musl"
- name: freebsd
tag: *default_tag
want_qemu: true
skip_container: true
versions:
- '13.0'
packages:
- git
- pkgconf
- meson
- libepoll-shim
- libudev-devd
- libevdev
- libwacom
- gtk3
- libmtdev
does_not_have_ci_templates: true
- bash
build:
extra_variables:
- "MESON_ARGS: '-Dtests=false -Ddocumentation=false' # doxygen drags down too many deps"
# We don't run the tests on FreeBSD, someone would have to fix the
# test suite to work on BSD first.
- "MESON_TEST_ARGS: '' # test suite doesn't work on BSD yet"
test_suites:
- name: touchpad

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
if [[ -f .meson_environment ]]; then
. .meson_environment