ci: Make use of pre-built container images

Rather than continuously calling `dnf upgrade` and `dnf install`, let's
make use of pre-built containers that we can auto-generate thanks to the
FDO CI templates.

This should cut down on the CI time considerably.

Note that this commit drops Ubuntu as a distribution for now. With
Fedora, we should be close enough to figure out if non-Flatpak builds
are broken, without doing packaging work for every distro out there.
This commit is contained in:
Niels De Graef 2025-11-23 23:22:00 +01:00 committed by Niels De Graef
parent 91d3cfb04c
commit b7bd689bd8

View file

@ -2,9 +2,18 @@
# Geary CI config. # Geary CI config.
# #
include: 'https://gitlab.gnome.org/GNOME/citemplates/-/raw/8430bccd6150b0a2aa97d1d7028c28b6b7e5d4d0/flatpak/flatpak_ci_initiative.yml' include:
- project: Infrastructure/freedesktop-ci-templates
file: templates/fedora.yml
ref: aec7a6ce7bb38902c70641526f6611e27141784a
- project: 'GNOME/citemplates'
file: 'flatpak/flatpak_ci_initiative.yml'
# See https://gitlab.gnome.org/GNOME/geary/-/issues/1498
ref: 8430bccd6150b0a2aa97d1d7028c28b6b7e5d4d0
variables: variables:
FDO_UPSTREAM_REPO: gnome/geary
# ImapDB and other tests that touch the disk are super slow on CI # ImapDB and other tests that touch the disk are super slow on CI
# runners like gcc150.osuosl.org that use platter drives still. # runners like gcc150.osuosl.org that use platter drives still.
# See Infrastructure/Infrastructure#97. # See Infrastructure/Infrastructure#97.
@ -13,66 +22,101 @@ variables:
# Locale used for unit tests # Locale used for unit tests
TEST_LOCALE: C.UTF-8 TEST_LOCALE: C.UTF-8
# Build stages:
BUILD_DIR: build - prepare
CONFIG_CMD: meson --buildtype=debug $BUILD_DIR - build
BUILD_CMD: ninja -v -C $BUILD_DIR - deploy
TEST_CMD: xvfb-run -a dbus-run-session -- meson test -v --no-stdsplit -C $BUILD_DIR $TEST_ARGS
INSTALL_CMD: ninja -v -C $BUILD_DIR install
# Fedora packages ##
FEDORA_DEPS: # Stage: Prepare
meson vala desktop-file-utils enchant2-devel folks-devel gcr3-devel #
glib2-devel gmime30-devel gnome-online-accounts-devel gspell-devel # This mostly consists of preparing Docker iamges for re-use the CI
gsound-devel gtk3-devel iso-codes-devel json-glib-devel itstool ##
libgee-devel libhandy1-devel libicu-devel
libpeas1-devel libsecret-devel libstemmer-devel libunwind-devel
libxml2-devel libytnef-devel sqlite-devel webkit2gtk4.1-devel
git
FEDORA_TEST_DEPS: appstream dbus-daemon glibc-langpack-en gnutls-utils tar Xvfb xz
# Ubuntu packages # See also https://gitlab.gnome.org/Infrastructure/freedesktop-ci-templates
UBUNTU_DEPS: build.container.fedora@x86_64:
meson build-essential valac desktop-file-utils gettext extends:
gobject-introspection iso-codes itstool libenchant-2-dev libfolks-dev - '.fdo.container-build@fedora'
libgcr-3-dev libgee-0.8-dev libglib2.0-dev libgmime-3.0-dev - '.fedora.container.common'
libgoa-1.0-dev libgspell-1-dev libgsound-dev libgtk-3-dev stage: 'prepare'
libhandy-1-dev libicu-dev libjson-glib-dev libmessaging-menu-dev variables:
libpeas-dev libsecret-1-dev libsqlite3-dev libstemmer-dev # no need to pull the whole tree for rebuilding the image
libunwind-dev libwebkit2gtk-4.1-dev libxml2-dev libytnef0-dev GIT_STRATEGY: none
git ca-certificates # Expiry sets fdo.expires on the image
UBUNTU_TEST_DEPS: appstream gnutls-bin librsvg2-common locales xauth xvfb FDO_EXPIRES_AFTER: 8w
# Geary build dependencies (Fedora packages)
FDO_DISTRIBUTION_PACKAGES: >-
appstream
dbus-daemon
dconf
desktop-file-utils
enchant2-devel
folks-devel
gcr3-devel
git
glib-networking
glib2-devel
glibc-langpack-en
gmime30-devel
gnome-online-accounts-devel
gnutls-utils
gsettings-desktop-schemas
gsound-devel
gspell-devel
gtk3-devel
iso-codes-devel
itstool
json-glib-devel
libgee-devel
libhandy1-devel
libicu-devel
libpeas1-devel
libsecret-devel
libstemmer-devel
libunwind-devel
libxml2-devel
libytnef-devel
meson
ninja
pinentry-gnome3
sqlite-devel
vala
webkit2gtk4.1-devel
Xvfb
.fedora.container.common:
variables:
# When branching a stable release, change 'main' to the
# release branch name to ensure that a new image will
# be created, tailored for the stable branch.
BRANCH_NAME: 'main'
CONTAINER_TAG: '2025-11-23.0'
FEDORA_VERSION: latest
# Derive FDO variables from this automatically.
# DO NOT edit, instead change the variables above
FDO_REPO_SUFFIX: '${BRANCH_NAME}'
FDO_DISTRIBUTION_TAG: '${CONTAINER_TAG}-fedora-${FEDORA_VERSION}'
FDO_DISTRIBUTION_VERSION: '${FEDORA_VERSION}'
##
# Stage: Build
#
# This stage actually builds & tests Geary. It does so both in Fedora, and in Flatpak
##
fedora: fedora:
extends:
- '.fdo.suffixed-image@fedora'
- '.fedora.container.common'
stage: build stage: build
image: fedora:latest
before_script:
- dnf update -y --nogpgcheck
- dnf install -y --nogpgcheck $FEDORA_DEPS $FEDORA_TEST_DEPS
script:
- $CONFIG_CMD
- $BUILD_CMD
- $TEST_CMD
- $INSTALL_CMD
artifacts:
when: 'always'
paths:
- '$BUILD_DIR/meson-logs'
expire_in: 2 days
ubuntu: variables:
stage: build BUILD_DIR: _build
image: ubuntu:devel
before_script:
- ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime
- apt-get update
- apt-get install -q -y --no-install-recommends $UBUNTU_DEPS $UBUNTU_TEST_DEPS
- locale-gen $TEST_LOCALE
script: script:
- $CONFIG_CMD - meson setup --buildtype=debug "$BUILD_DIR"
- $BUILD_CMD - meson compile -C "$BUILD_DIR"
- $TEST_CMD - xvfb-run -a dbus-run-session -- meson test -v --no-stdsplit -C "$BUILD_DIR" "$TEST_ARGS"
- $INSTALL_CMD - meson install -C "$BUILD_DIR"
artifacts: artifacts:
when: 'always' when: 'always'
paths: paths:
@ -80,6 +124,7 @@ ubuntu:
expire_in: 2 days expire_in: 2 days
flatpak: flatpak:
stage: build
variables: variables:
APP_ID: org.gnome.Geary.Devel APP_ID: org.gnome.Geary.Devel
FLATPAK_MODULE: geary FLATPAK_MODULE: geary
@ -91,7 +136,12 @@ flatpak:
# This is broken, allow it to fail. # This is broken, allow it to fail.
allow_failure: true allow_failure: true
##
# Stage: Deploy
#
# This stage is meant for deplying any nightly (Flatpak) builds, docs, etc
##
nightly: nightly:
extends: '.publish_nightly' extends: '.publish_nightly'
dependencies: ['flatpak']
needs: ['flatpak'] needs: ['flatpak']