diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2021-07-26 11:13:17 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-07-28 12:50:11 +1000 |
commit | 833e49ce017f976c8bd6177c8c948d876f7d5113 (patch) | |
tree | 0efe82065d2cddd3da69a0e40debb0b1d3334cb5 /.gitlab-ci | |
parent | 21824bc6ff9a9601d1e2f58b71b0e03c31408cec (diff) | |
download | libinput-833e49ce017f976c8bd6177c8c948d876f7d5113.tar.gz |
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>
Diffstat (limited to '.gitlab-ci')
-rw-r--r-- | .gitlab-ci/ci.template | 105 | ||||
-rw-r--r-- | .gitlab-ci/config.yml | 18 | ||||
-rwxr-xr-x | .gitlab-ci/meson-build.sh | 2 |
3 files changed, 43 insertions, 82 deletions
diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index 6a6c437f..3e2dd164 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -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 %} ################################################################# # # diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 52adec5d..8d42abc9 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -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 diff --git a/.gitlab-ci/meson-build.sh b/.gitlab-ci/meson-build.sh index 59a371a1..41bd8394 100755 --- a/.gitlab-ci/meson-build.sh +++ b/.gitlab-ci/meson-build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ -f .meson_environment ]]; then . .meson_environment |