diff options
author | Daniel Stone <daniels@collabora.com> | 2023-08-15 12:46:22 +0100 |
---|---|---|
committer | David Faure <faure@kde.org> | 2023-08-15 12:08:21 +0000 |
commit | 607b3ca18978abef90e331a1eb31b787d2b74773 (patch) | |
tree | bcf4ef4e5ac2dfdbd97e5ad0ff5e9cce06120dec | |
parent | 4eaf8a69f9969d1c3cc88f425393b023331f4782 (diff) |
ci: Use ci-templates to build image
Everyone should use ci-templates, and shared-mime-info is not different.
Signed-off-by: Daniel Stone <daniels@collabora.com>
-rw-r--r-- | .gitlab-ci.yml | 115 |
1 files changed, 98 insertions, 17 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 45841ca..0ef643c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,29 +1,104 @@ -image: fedora:rawhide +# This file uses the freedesktop ci-templates to build shared-mime-info and +# run our tests in CI. +# +# ci-templates uses a multi-stage build process. First, the base container +# image is built which contains the core distribution, the toolchain, and +# all our build dependencies. This container is aggressively cached; if a +# container image matching $FDO_DISTRIBUTION_TAG is found in either the +# upstream repo (wayland/weston) or the user's downstream repo, it is +# reused for the build. This gives us predictability of build and far +# quicker runtimes, however it means that any changes to the base container +# must also change $FDO_DISTRIBUTION_TAG. When changing this, please use +# the current date as well as a unique build identifier. +# +# After the container is either rebuilt (tag mismatch) or reused (tag +# previously used), the build stage executes within this container. +# +# Apart from the 'variables', 'include', and 'stages' top-level anchors, +# everything not beginning with a dot ('.') is the name of a job which will +# be executed as part of CI, unless the rules specify that it should not be +# run. +# +# Variables prefixed with CI_ are generally provided by GitLab itself; +# variables prefixed with FDO_ and templates prefixed by .fdo are provided +# by the ci-templates. +# +# For more information on GitLab CI, including the YAML syntax, see: +# https://docs.gitlab.com/ee/ci/yaml/README.html +# +# Note that freedesktop.org uses the 'Community Edition' of GitLab, so features +# marked as 'premium' or 'ultimate' are not available to us. +# +# For more information on ci-templates, see: +# - documentation at https://freedesktop.pages.freedesktop.org/ci-templates/ +# - repo at https://gitlab.freedesktop.org/freedesktop/ci-templates/ +# These are used to make sure that we execute 'detached pipelines' on merge +# requests. workflow: rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'push' +stages: + - "Base container" + - "Build and test" + +# Here we use a fixed ref in order to isolate ourselves from ci-templates +# API changes. If you need new features from ci-templates you must bump +# this to the current SHA you require from the ci-templates repo, however +# be aware that you may need to account for API changes when doing so. +.templates_sha: &template_sha b791bd48996e3ced9ca13f1c5ee82be8540b8adb # see https://docs.gitlab.com/ee/ci/yaml/#includefile + +include: + - project: 'freedesktop/ci-templates' + ref: *template_sha + file: + - '/templates/fedora.yml' + variables: - DEPENDENCIES: gcc - gcc-c++ - glibc-devel - make - libxml2-devel - glib2-devel - gettext - git - xmlto - findutils - gettext-devel - meson + FDO_UPSTREAM_REPO: "xdg/shared-mime-info" + FDO_REPO_SUFFIX: "$BUILD_OS/$BUILD_ARCH" GIT_SUBMODULE_STRATEGY: normal -build:meson: - before_script: - - dnf5 update -y --nogpgcheck - - dnf5 install -y --nogpgcheck $DEPENDENCIES + +# Per-OS environment definitions +.os-fedora: + variables: + # bump this tag every time you change something which requires rebuilding + # the base image (e.g. changing dependencies) + FDO_DISTRIBUTION_TAG: "2022-08-15.0" + BUILD_OS: fedora + FDO_DISTRIBUTION_VERSION: 38 + FDO_DISTRIBUTION_PACKAGES: "gcc gcc-c++ glibc-devel make libxml2-devel glib2-devel gettext git xmlto findutils gettext-devel meson" + +.fedora-x86_64: + extends: + - .os-fedora + variables: + BUILD_ARCH: "x86-64" + +.build-env-fedora-x86_64: + extends: + - .fdo.suffixed-image@fedora + - .fedora-x86_64 + needs: + - job: fedora-x86_64-container_prep + artifacts: false + +# Real container build job (mostly a no-op) +fedora-x86_64-container_prep: + extends: + - .fedora-x86_64 + - .fdo.container-build@fedora + stage: "Base container" + variables: + GIT_STRATEGY: none + + +# Build job template +.do-build: + stage: "Build and test" script: # Compile xdgmime - make -C xdgmime @@ -38,3 +113,9 @@ build:meson: paths: - _build/meson-logs/*.txt - _build/meson-dist/*.* + +# Real build job +fedora-x86_64-build: + extends: + - .build-env-fedora-x86_64 + - .do-build |