CI: in b2c, compile on the host, then test in qemu

Looks like we are having clock skew issues on qemu, so given that
we just need qemu in the image, we can compile on the host (reliable)
and then only start the tests in qemu.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires 2022-08-11 07:19:14 +02:00
parent a034a9f66b
commit 24956221b9
7 changed files with 77 additions and 13 deletions

View file

@ -76,7 +76,7 @@ variables:
# See the documentation here: #
# https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html #
###############################################################################
FEDORA_PACKAGES: 'git-core gcc gcc-c++ pkgconf-pkg-config meson check-devel libudev-devel libevdev-devel doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx_rtd_theme python3-pytest-xdist libwacom-devel cairo-devel gtk4-devel glib2-devel mtdev-devel diffutils wayland-protocols-devel valgrind systemd-udev'
FEDORA_PACKAGES: 'git-core gcc gcc-c++ pkgconf-pkg-config meson check-devel libudev-devel libevdev-devel doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx_rtd_theme python3-pytest-xdist libwacom-devel cairo-devel gtk4-devel glib2-devel mtdev-devel diffutils wayland-protocols-devel valgrind systemd-udev qemu-img qemu-system-x86-core qemu-system-aarch64-core jq python3-click python3-rich'
DEBIAN_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 curl'
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 gtk4 mtdev diffutils wayland-protocols'
@ -88,12 +88,12 @@ variables:
# 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: '2022-08-08.0'
DEBIAN_TAG: '2022-08-08.0'
UBUNTU_TAG: '2022-08-08.0'
ARCH_TAG: '2022-08-08.0'
ALPINE_TAG: '2022-08-08.0'
FREEBSD_TAG: '2022-08-08.0'
FEDORA_TAG: '2022-09-02.0'
DEBIAN_TAG: '2022-09-02.0'
UBUNTU_TAG: '2022-09-02.0'
ARCH_TAG: '2022-09-02.0'
ALPINE_TAG: '2022-09-02.0'
FREEBSD_TAG: '2022-09-02.0'
FDO_UPSTREAM_REPO: libinput/libinput
@ -397,7 +397,6 @@ freebsd:13.0@container-clean:
.build-in-b2c@template:
extends:
- .policy
- .fdo.b2c-image@fedora
- .default_artifacts
tags:
- kvm
@ -408,9 +407,14 @@ freebsd:13.0@container-clean:
B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE
B2C_COMMAND: .gitlab-ci/start-in-systemd.sh
script:
# first build in the host container
- .gitlab-ci/meson-build.sh --skip-test
# pull b2c
- curl -L -o /app/boot2container https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/v0.9.8/vm2c.py
- chmod +x /app/boot2container
# runs the test suite only
- /app/boot2container
#
@ -490,6 +494,7 @@ freebsd:13.0@container-clean:
.fedora:36@test-suite-vm:
extends:
- .fdo.distribution-image@fedora
- .test-suite-vm
variables:
FDO_DISTRIBUTION_VERSION: 36

View file

@ -273,7 +273,6 @@ check-commit:
.build-in-b2c@template:
extends:
- .policy
- .fdo.b2c-image@fedora
- .default_artifacts
tags:
- kvm
@ -284,9 +283,14 @@ check-commit:
B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE
B2C_COMMAND: .gitlab-ci/start-in-systemd.sh
script:
# first build in the host container
- .gitlab-ci/meson-build.sh --skip-test
# pull b2c
- curl -L -o /app/boot2container https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/{{b2c.version}}/vm2c.py
- chmod +x /app/boot2container
# runs the test suite only
- /app/boot2container
#
@ -369,6 +373,7 @@ check-commit:
{% set version = "{}".format(distro.versions|last()) %}
.{{distro.name}}:{{version}}@test-suite-vm:
extends:
- .fdo.distribution-image@{{distro.name}}
- .test-suite-vm
variables:
FDO_DISTRIBUTION_VERSION: {{version}}

View file

@ -3,7 +3,7 @@
#
# We're happy to rebuild all containers when one changes.
.default_tag: &default_tag '2022-08-08.0'
.default_tag: &default_tag '2022-09-02.0'
distributions:
- name: fedora
@ -36,7 +36,14 @@ distributions:
- diffutils
- wayland-protocols-devel
- valgrind # for the valgrind run, optional
- systemd-udev # for the qemu run, optional
# below packages are for the qemu runs, so optional
- systemd-udev # for the qemu run
- qemu-img
- qemu-system-x86-core
- qemu-system-aarch64-core
- jq
- python3-click
- python3-rich
- name: debian
tag: *default_tag
versions:

View file

@ -76,4 +76,3 @@ fi
if [[ -n "$MESON_RUN_TEST" ]]; then
meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs
fi

36
.gitlab-ci/meson-prep.sh Normal file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -x
if [[ -f .meson_environment ]]; then
. .meson_environment
fi
if [[ -z "$MESON_BUILDDIR" ]]; then
echo "\$MESON_BUILDDIR undefined."
exit 1
fi
# emulate a few gitlab variables to make it easier to
# run and debug locally.
if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]]; then
echo "Missing \$CI_JOB_ID or \$CI_JOB_NAME".
CI_JOB_ID=$(date +%s)
CI_JOB_NAME='libinput-job-local'
echo "Simulating gitlab environment: "
echo " CI_JOB_ID=$CI_JOB_ID"
echo " CI_JOB_NAME=$CI_JOB_NAME"
fi
if [[ -n "$FDO_CI_CONCURRENT" ]]; then
NINJA_ARGS="-j$FDO_CI_CONCURRENT $NINJA_ARGS"
MESON_TESTTHREADS="$FDO_CI_CONCURRENT"
fi
echo "*************************************************"
echo "builddir: $MESON_BUILDDIR"
echo "meson args: $MESON_ARGS"
echo "ninja args: $NINJA_ARGS"
echo "meson test args: $MESON_TEST_ARGS"
echo "*************************************************"
set -e

12
.gitlab-ci/meson-test.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. $DIR/meson-prep.sh
if [[ -z "$MESON_TEST_ARGS" ]]; then
echo "\$MESON_TEST_ARGS undefined."
exit 1
fi
meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs

View file

@ -37,7 +37,7 @@ Type=simple
StandardOutput=journal+console
EnvironmentFile=$B2C_WORKDIR/.b2c_env
WorkingDirectory=$WORKDIR
ExecStart=$WORKDIR/.gitlab-ci/meson-build.sh
ExecStart=$WORKDIR/.gitlab-ci/meson-build.sh --skip-setup --skip-build
# exit the container on termination
ExecStopPost=$post_command