From 96c9a4598117f8b1ce256507726cfa274bc2ce1a Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Wed, 19 Jan 2022 17:04:44 -0600 Subject: [PATCH] ci: Switch to using ci-fairy templates to simplify, drop buster support. The CI is now mostly data driven and should be much easier to handle. --- .gitlab-ci.yml | 676 +++++++++--------- .gitlab-ci/arch_container_prep.sh | 8 - .gitlab-ci/build-and-submit-package.sh | 21 + .gitlab-ci/build-openxr-openhmd.sh | 22 - .gitlab-ci/ci-scripts.mk | 26 + .gitlab-ci/ci.template | 254 +++++++ .gitlab-ci/config.yml | 235 ++++++ .gitlab-ci/debian_buster_container_prep.sh | 12 - .gitlab-ci/distributions | 7 - .gitlab-ci/distributions.jinja | 34 + .gitlab-ci/distributions.license | 6 +- .gitlab-ci/gpg-agent.conf | 5 + .gitlab-ci/gpg.conf | 6 + ...> i386_and_proclamation_container_prep.sh} | 4 - .gitlab-ci/reprepro.sh | 63 ++ .gitlab-ci/reprepro.sh.jinja | 42 ++ .gitlab-ci/ubuntu_focal_container_prep.sh | 7 - .gitlab-ci/ubuntu_hirsute_container_prep.sh | 5 - .gitlab-ci/ubuntu_impish_container_prep.sh | 5 - 19 files changed, 1033 insertions(+), 405 deletions(-) delete mode 100644 .gitlab-ci/arch_container_prep.sh create mode 100755 .gitlab-ci/build-and-submit-package.sh delete mode 100755 .gitlab-ci/build-openxr-openhmd.sh create mode 100644 .gitlab-ci/ci-scripts.mk create mode 100644 .gitlab-ci/ci.template create mode 100644 .gitlab-ci/config.yml delete mode 100644 .gitlab-ci/debian_buster_container_prep.sh create mode 100644 .gitlab-ci/distributions.jinja create mode 100644 .gitlab-ci/gpg-agent.conf create mode 100644 .gitlab-ci/gpg.conf rename .gitlab-ci/{debian_bullseye_container_prep.sh => i386_and_proclamation_container_prep.sh} (77%) create mode 100644 .gitlab-ci/reprepro.sh create mode 100644 .gitlab-ci/reprepro.sh.jinja delete mode 100644 .gitlab-ci/ubuntu_focal_container_prep.sh delete mode 100644 .gitlab-ci/ubuntu_hirsute_container_prep.sh delete mode 100644 .gitlab-ci/ubuntu_impish_container_prep.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7d5ecbb20..9dab1a7c4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,82 +1,68 @@ # SPDX-License-Identifier: CC0-1.0 -# SPDX-FileCopyrightText: 2018-2021 Collabora, Ltd. and the Monado contributors +# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors + +###################################### +# GENERATED - DO NOT EDIT # +# see .gitlab-ci/ci.template instead # +###################################### variables: FDO_UPSTREAM_REPO: monado/monado -.templates_sha: &templates_sha 14731f78c23c7b523a85a26a068ade9ac1ecd2f3 +.templates_sha: &templates_sha 34039cd573a2df832d465bc9e4c5f543571f5241 -# Variables listing packages for Debian-based distros -.monado.variables.debian-based-packages: - variables: - # Packages required for build and some other basic jobs - CORE_REQUIRED_PACKAGES: "build-essential git wget unzip cmake meson ninja-build libeigen3-dev curl patch python3 pkg-config libx11-dev libx11-xcb-dev libxxf86vm-dev libxrandr-dev libxcb-randr0-dev libvulkan-dev glslang-tools libglvnd-dev libgl1-mesa-dev ca-certificates libusb-1.0-0-dev libudev-dev" +include: + # Debian + - project: "freedesktop/ci-templates" + ref: *templates_sha + file: "/templates/debian.yml" + # Ubuntu + - project: "freedesktop/ci-templates" + ref: *templates_sha + file: "/templates/ubuntu.yml" + # Arch + - project: "freedesktop/ci-templates" + ref: *templates_sha + file: "/templates/arch.yml" - # These are optional packages, that we're building against to ensure we build as much code as possible - FEATURE_PACKAGES: "libhidapi-dev libwayland-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libegl1-mesa-dev libdbus-1-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsystemd-dev libbsd-dev" - # Only used for building packages - PACKAGING_PACKAGES: "devscripts debhelper dput-ng gettext-base pandoc" - - # Used for ancillary "not compilation" jobs/features, like docs, changelogs, formatting, etc. - TOOLS_REQUIRED_PACKAGES: "codespell doxygen graphviz python3-pip python3-click" - - # The NDK builder uses only these packages - NDK_PACKAGES: "git wget unzip cmake meson ninja-build libeigen3-dev python3 pkg-config ca-certificates glslang-tools" - -# Variables for build and usage of Debian 10 (Buster) image -.monado.variables.debian:buster: - variables: - FDO_DISTRIBUTION_VERSION: buster - FDO_DISTRIBUTION_TAG: "2021-10-28.0" - -# Variables for build and usage of Debian 11 (Bullseye) image +# Variables for build and usage of Debian bullseye image .monado.variables.debian:bullseye: variables: - FDO_DISTRIBUTION_VERSION: bullseye - FDO_DISTRIBUTION_TAG: "2021-11-04.0" + FDO_DISTRIBUTION_VERSION: "bullseye" + FDO_DISTRIBUTION_TAG: "2022-01-19.0" -# Variables for build and usage of Ubuntu 20.04 LTS (Focal) image +# Variables for build and usage of Debian bullseye-ndk image +.monado.variables.debian:bullseye-ndk: + variables: + FDO_DISTRIBUTION_VERSION: "bullseye" + FDO_DISTRIBUTION_TAG: "2022-01-19.0" + FDO_REPO_SUFFIX: ndk + +# Variables for build and usage of Ubuntu focal image .monado.variables.ubuntu:focal: variables: FDO_DISTRIBUTION_VERSION: "20.04" FDO_DISTRIBUTION_TAG: "2021-10-27.1" -# Variables for build and usage of Ubuntu 21.04 (Hirsute) image +# Variables for build and usage of Ubuntu hirsute image .monado.variables.ubuntu:hirsute: variables: FDO_DISTRIBUTION_VERSION: "21.04" FDO_DISTRIBUTION_TAG: "2021-10-27.1" -# Variables for build and usage of Ubuntu 21.10 (Impish) image +# Variables for build and usage of Ubuntu impish image .monado.variables.ubuntu:impish: variables: FDO_DISTRIBUTION_VERSION: "21.10" FDO_DISTRIBUTION_TAG: "2021-10-28.0" -# Variables for build and usage of Debian 10 (Buster) + Android NDK image -.monado.variables.debian:buster-ndk: - variables: - FDO_DISTRIBUTION_VERSION: buster - FDO_DISTRIBUTION_TAG: "2020-05-06.0" - FDO_REPO_SUFFIX: ndk - -# Variables for build and usage of Arch Linux image +# Variables for build and usage of Arch rolling image .monado.variables.arch:rolling: variables: + FDO_DISTRIBUTION_VERSION: "rolling" FDO_DISTRIBUTION_TAG: "2021-09-14.0" -include: - - project: "freedesktop/ci-templates" - ref: *templates_sha - file: "/templates/debian.yml" - - project: "freedesktop/ci-templates" - ref: *templates_sha - file: "/templates/ubuntu.yml" - - project: "freedesktop/ci-templates" - ref: *templates_sha - file: "/templates/arch.yml" - stages: - container_prep - build @@ -87,105 +73,112 @@ stages: ### # Container prep jobs - -# Base for all container prep -.monado.variables.container-prep-base: - # "stage" set here doesn't work, for some reason - variables: - # no need to pull the whole tree for rebuilding the image - is this still needed? - GIT_STRATEGY: none - # Each most-derived container prep job has a script to set up stuff for it. - FDO_DISTRIBUTION_EXEC: "bash .gitlab-ci/$(echo ${CI_JOB_NAME} | sed 's/:/_/g').sh" - -# Debian Buster (x64 + i386) -debian:buster:container_prep: - stage: container_prep - extends: - - .monado.variables.debian:buster - - .monado.variables.container-prep-base - - .monado.variables.debian-based-packages - - .fdo.container-build@debian # from ci-templates - variables: - # a list of packages to install - assembled from .monado.variables.debian-based-packages, plus clang-format-7 (which we don't actually need anymore) - FDO_DISTRIBUTION_PACKAGES: "${CORE_REQUIRED_PACKAGES} ${FEATURE_PACKAGES} ${PACKAGING_PACKAGES} ${TOOLS_REQUIRED_PACKAGES} clang-format-7" - -# Debian Bullseye (x64 + i386) +# Make Debian bullseye image debian:bullseye:container_prep: stage: container_prep extends: - .monado.variables.debian:bullseye - - .monado.variables.container-prep-base - - .monado.variables.debian-based-packages - .fdo.container-build@debian # from ci-templates variables: - # a list of packages to install - assembled from .monado.variables.debian-based-packages, plus clang-format. - FDO_DISTRIBUTION_PACKAGES: "${CORE_REQUIRED_PACKAGES} ${FEATURE_PACKAGES} ${PACKAGING_PACKAGES} ${TOOLS_REQUIRED_PACKAGES} clang-format" + FDO_DISTRIBUTION_PACKAGES: 'build-essential ca-certificates clang-format cmake codespell curl debhelper devscripts doxygen dput-ng gettext-base git glslang-tools graphviz libavcodec-dev libbsd-dev libcjson-dev libdbus-1-dev libegl1-mesa-dev libeigen3-dev libgl1-mesa-dev libglvnd-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libhidapi-dev libopencv-dev libsdl2-dev libsystemd-dev libudev-dev libusb-1.0-0-dev libuvc-dev libv4l-dev libvulkan-dev libwayland-dev libx11-dev libx11-xcb-dev libxcb-randr0-dev libxrandr-dev libxxf86vm-dev meson ninja-build pandoc patch pkg-config python3 python3-click python3-pip unzip wget' + FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/i386_and_proclamation_container_prep.sh' -# Arch Linux (x64) -arch:container_prep: +# Make Debian bullseye-ndk image +debian:bullseye-ndk:container_prep: stage: container_prep extends: - - .monado.variables.arch:rolling - - .monado.variables.container-prep-base - - .fdo.container-build@arch # from ci-templates + - .monado.variables.debian:bullseye-ndk + - .fdo.container-build@debian # from ci-templates variables: - # a list of packages to install - FDO_DISTRIBUTION_PACKAGES: "git gcc clang cmake meson ninja pkgconfig python3 diffutils patch doxygen graphviz eigen hidapi libxrandr mesa glslang vulkan-headers vulkan-icd-loader check glfw-x11 libusb opencv gtk3 ffmpeg v4l-utils qt5-base" + FDO_DISTRIBUTION_PACKAGES: 'ca-certificates cmake git glslang-tools libeigen3-dev meson ninja-build pkg-config python3 unzip wget' + FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/ndk_container_prep.sh' -# Ubuntu Focal (x64) +# Make Ubuntu focal image ubuntu:focal:container_prep: stage: container_prep extends: - .monado.variables.ubuntu:focal - - .monado.variables.container-prep-base - - .monado.variables.debian-based-packages - .fdo.container-build@ubuntu # from ci-templates variables: - # a list of packages to install - assembled from .monado.variables.debian-based-packages - FDO_DISTRIBUTION_PACKAGES: "${CORE_REQUIRED_PACKAGES} ${FEATURE_PACKAGES} ${PACKAGING_PACKAGES}" + FDO_DISTRIBUTION_PACKAGES: 'build-essential ca-certificates cmake curl debhelper devscripts dput-ng gettext-base git glslang-tools libavcodec-dev libbsd-dev libcjson-dev libdbus-1-dev libegl1-mesa-dev libeigen3-dev libgl1-mesa-dev libglvnd-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libhidapi-dev libopencv-dev libsdl2-dev libsystemd-dev libudev-dev libusb-1.0-0-dev libuvc-dev libv4l-dev libvulkan-dev libwayland-dev libx11-dev libx11-xcb-dev libxcb-randr0-dev libxrandr-dev libxxf86vm-dev meson ninja-build pandoc patch pkg-config python3 unzip wget' -# Ubuntu Hirsute (x64) +# Make Ubuntu hirsute image ubuntu:hirsute:container_prep: stage: container_prep extends: - .monado.variables.ubuntu:hirsute - - .monado.variables.container-prep-base - - .monado.variables.debian-based-packages - .fdo.container-build@ubuntu # from ci-templates variables: - # a list of packages to install - assembled from .monado.variables.debian-based-packages - FDO_DISTRIBUTION_PACKAGES: "${CORE_REQUIRED_PACKAGES} ${FEATURE_PACKAGES} ${PACKAGING_PACKAGES}" + FDO_DISTRIBUTION_PACKAGES: 'build-essential ca-certificates cmake curl debhelper devscripts dput-ng gettext-base git glslang-tools libavcodec-dev libbsd-dev libcjson-dev libdbus-1-dev libegl1-mesa-dev libeigen3-dev libgl1-mesa-dev libglvnd-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libhidapi-dev libopencv-dev libsdl2-dev libsystemd-dev libudev-dev libusb-1.0-0-dev libuvc-dev libv4l-dev libvulkan-dev libwayland-dev libx11-dev libx11-xcb-dev libxcb-randr0-dev libxrandr-dev libxxf86vm-dev meson ninja-build pandoc patch pkg-config python3 unzip wget' -# Ubuntu Impish (x64) +# Make Ubuntu impish image ubuntu:impish:container_prep: stage: container_prep extends: - .monado.variables.ubuntu:impish - - .monado.variables.container-prep-base - - .monado.variables.debian-based-packages - .fdo.container-build@ubuntu # from ci-templates variables: - # a list of packages to install - assembled from .monado.variables.debian-based-packages, plus reprepro - FDO_DISTRIBUTION_PACKAGES: "${CORE_REQUIRED_PACKAGES} ${FEATURE_PACKAGES} ${PACKAGING_PACKAGES} reprepro" + FDO_DISTRIBUTION_PACKAGES: 'build-essential ca-certificates cmake curl debhelper devscripts dput-ng gettext-base git glslang-tools libavcodec-dev libbsd-dev libcjson-dev libdbus-1-dev libegl1-mesa-dev libeigen3-dev libgl1-mesa-dev libglvnd-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libhidapi-dev libopencv-dev libsdl2-dev libsystemd-dev libudev-dev libusb-1.0-0-dev libuvc-dev libv4l-dev libvulkan-dev libwayland-dev libx11-dev libx11-xcb-dev libxcb-randr0-dev libxrandr-dev libxxf86vm-dev meson ninja-build pandoc patch pkg-config python3 reprepro unzip wget' -# Debian Buster + the Android NDK in /opt/android-ndk -# The NDK itself gets installed by .gitlab-ci/ndk:container_prep.sh -ndk:container_prep: +# Make Arch rolling image +arch:rolling:container_prep: stage: container_prep extends: - - .monado.variables.debian:buster-ndk - - .monado.variables.container-prep-base - - .fdo.container-build@debian # from ci-templates + - .monado.variables.arch:rolling + - .fdo.container-build@arch # from ci-templates variables: - # Repo suffix is set in .monado.variables.debian:buster-ndk - # a list of packages to install - FDO_DISTRIBUTION_PACKAGES: "${NDK_PACKAGES}" + FDO_DISTRIBUTION_PACKAGES: 'check clang cmake diffutils doxygen eigen ffmpeg gcc git glfw-x11 glslang graphviz gtk3 hidapi libusb libxrandr mesa meson ninja opencv patch pkgconfig python3 qt5-base v4l-utils vulkan-headers vulkan-icd-loader' + +### +# Container usage base jobs + +# Base for using Debian bullseye image +.monado.image.debian:bullseye: + extends: + - .monado.variables.debian:bullseye + - .fdo.distribution-image@debian # from ci-templates + + +# Base for using Debian bullseye-ndk image +.monado.image.debian:bullseye-ndk: + extends: + - .monado.variables.debian:bullseye-ndk + - .fdo.suffixed-image@debian # from ci-templates + + +# Base for using Ubuntu focal image +.monado.image.ubuntu:focal: + extends: + - .monado.variables.ubuntu:focal + - .fdo.distribution-image@ubuntu # from ci-templates + + +# Base for using Ubuntu hirsute image +.monado.image.ubuntu:hirsute: + extends: + - .monado.variables.ubuntu:hirsute + - .fdo.distribution-image@ubuntu # from ci-templates + + +# Base for using Ubuntu impish image +.monado.image.ubuntu:impish: + extends: + - .monado.variables.ubuntu:impish + - .fdo.distribution-image@ubuntu # from ci-templates + + +# Base for using Arch rolling image +.monado.image.arch:rolling: + extends: + - .monado.variables.arch:rolling + - .fdo.distribution-image@arch # from ci-templates + # Style check job format-and-spellcheck: extends: - - .monado.variables.debian:bullseye - - .fdo.distribution-image@debian # from ci-templates + - .monado.image.debian:bullseye + stage: build script: - scripts/format-and-spellcheck.sh @@ -204,160 +197,183 @@ reuse: script: - reuse lint -# "Base" job for a CMake build -.monado.base-job.build-cmake: - stage: build - script: - - rm -rf build - - mkdir build - - pushd build - - cmake -GNinja .. $CMAKE_ARGS - # List build options - - grep "^XRT_" CMakeCache.txt - - ninja - - ctest --output-on-failure -# "Base" job for a Meson build -.monado.base-job.build-meson: +debian:cmake: stage: build - script: - - rm -rf build - - mkdir build - - pushd build - - meson .. $MESON_ARGS - - ninja - -debian:bullseye:cmake: extends: - - .monado.variables.debian:bullseye - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.build-cmake + - .monado.image.debian:bullseye + before_script: - # Generate "changes since last release" and add to changelog, - # since this is the build that makes our docs. - pushd doc/changes - proclamation build --overwrite vNEXT - popd + script: + - rm -rf build + - cmake -GNinja -B build -S . + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure artifacts: paths: - build/doc/html/ debian:cmake-no-opencv: - extends: - - .monado.variables.debian:buster - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.build-cmake - variables: - CMAKE_ARGS: -DXRT_HAVE_OPENCV=OFF - -debian:cmake-no-opengl: - extends: - - .monado.variables.debian:buster - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.build-cmake - variables: - CMAKE_ARGS: -DXRT_HAVE_OPENGL=OFF - -debian:cmake-no-sdl2: - extends: - - .monado.variables.debian:buster - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.build-cmake - variables: - CMAKE_ARGS: -DXRT_HAVE_SDL2=OFF - -debian:cmake-no-service: - extends: - - .monado.variables.debian:buster - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.build-cmake - variables: - CMAKE_ARGS: -DXRT_FEATURE_SERVICE=OFF - -arch:cmake: - extends: - - .monado.variables.arch:rolling - - .fdo.distribution-image@arch # from ci-templates - - .monado.base-job.build-cmake - -arch:cmake:clang: - extends: - - .monado.variables.arch:rolling - - .fdo.distribution-image@arch # from ci-templates - - .monado.base-job.build-cmake - variables: - CMAKE_ARGS: -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ - -ubuntu:cmake: - extends: - - .monado.variables.ubuntu:focal - - .fdo.distribution-image@ubuntu # from ci-templates - - .monado.base-job.build-cmake - -debian:meson: - extends: - - .monado.variables.debian:buster - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.build-meson - -ubuntu:meson: - extends: - - .monado.variables.ubuntu:focal - - .fdo.distribution-image@ubuntu # from ci-templates - - .monado.base-job.build-meson - -arch:meson: - extends: - - .monado.variables.arch:rolling - - .fdo.distribution-image@arch # from ci-templates - - .monado.base-job.build-meson - variables: - MESON_ARGS: -Ddocs=disabled - -# Cross-compiling -debian:meson:32bit: - extends: - - .monado.variables.debian:buster - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.build-meson - variables: - MESON_ARGS: --prefix /usr --libdir /usr/lib/i386-linux-gnu --cross-file ../.gitlab-ci/i386-cross.txt - -debian:cmake:32bit: - extends: - - .monado.variables.debian:buster - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.build-cmake - variables: - # OpenCV and local OpenHMD doesn't play nicely with us in multi-arch. - CMAKE_ARGS: -DCMAKE_TOOLCHAIN_FILE=../.gitlab-ci/i386.cmake -DXRT_HAVE_OPENCV=off -DXRT_BUILD_DRIVER_OHMD=off - -# Base of Android NDK builds. -# Takes the last :-delimited part of the name as the ABI to build for, -# so you don't need to do anything other than "extends" in the job -.monado.ndk:build-base: stage: build extends: - - .monado.variables.debian:buster-ndk - - .fdo.suffixed-image@debian # from ci-templates - variables: - ANDROID_PLATFORM: 26 + - .monado.image.debian:bullseye + script: - - mkdir build - - pushd build - # This extracts the ABI from the job name - - export ABI=$(echo $CI_JOB_NAME | cut --delimiter=":" -f 2) - # Note we are pointing CMake to the host install of Eigen3 because it's header-only - # and thus this is safe to do. - - cmake -GNinja .. -DANDROID_PLATFORM=$ANDROID_PLATFORM -DANDROID_ABI=$ABI -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake -DEigen3_DIR=/usr/lib/cmake/eigen3/ - - grep "^XRT_" CMakeCache.txt - - ninja + - rm -rf build + - cmake -GNinja -B build -S . -DBUILD_DOC=OFF -DXRT_HAVE_OPENCV=OFF + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure + +debian:cmake-no-sdl2: + stage: build + extends: + - .monado.image.debian:bullseye + + script: + - rm -rf build + - cmake -GNinja -B build -S . -DBUILD_DOC=OFF -DXRT_HAVE_SDL2=OFF + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure + +debian:cmake-no-service: + stage: build + extends: + - .monado.image.debian:bullseye + + script: + - rm -rf build + - cmake -GNinja -B build -S . -DBUILD_DOC=OFF -DXRT_FEATURE_SERVICE=OFF + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure + +debian:cmake:32bit: + stage: build + extends: + - .monado.image.debian:bullseye + + script: + - rm -rf build + - cmake -GNinja -B build -S . -DCMAKE_TOOLCHAIN_FILE=.gitlab-ci/i386.cmake -DXRT_HAVE_OPENCV=OFF + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure + +debian:meson: + stage: build + extends: + - .monado.image.debian:bullseye + + script: + - rm -rf build + - meson setup build . + - ninja -C build + +debian:meson:32bit: + stage: build + extends: + - .monado.image.debian:bullseye + + script: + - rm -rf build + - meson setup build . --prefix=/usr --libdir=/usr/lib/i386-linux-gnu --cross-file=.gitlab-ci/i386-cross.txt + - ninja -C build ndk:armeabi-v7a: - extends: .monado.ndk:build-base + stage: build + extends: + - .monado.image.debian:bullseye-ndk + + script: + - rm -rf build + - cmake -GNinja -B build -S . -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=26 -DBUILD_DOC=OFF -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake -DEigen3_DIR=/usr/lib/cmake/eigen3/ -DEIGEN3_INCLUDE_DIR=/usr/include/eigen3 + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build ndk:arm64-v8a: - extends: .monado.ndk:build-base + stage: build + extends: + - .monado.image.debian:bullseye-ndk + + script: + - rm -rf build + - cmake -GNinja -B build -S . -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=26 -DBUILD_DOC=OFF -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake -DEigen3_DIR=/usr/lib/cmake/eigen3/ -DEIGEN3_INCLUDE_DIR=/usr/include/eigen3 + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + +ubuntu:cmake: + stage: build + extends: + - .monado.image.ubuntu:focal + + script: + - rm -rf build + - cmake -GNinja -B build -S . -DBUILD_DOC=OFF + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure + +ubuntu:meson: + stage: build + extends: + - .monado.image.ubuntu:focal + + script: + - rm -rf build + - meson setup build . + - ninja -C build + +ubuntu:latest:cmake: + stage: build + extends: + - .monado.image.ubuntu:impish + + script: + - rm -rf build + - cmake -GNinja -B build -S . -DBUILD_DOC=OFF + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure + +arch:cmake: + stage: build + extends: + - .monado.image.arch:rolling + + script: + - rm -rf build + - cmake -GNinja -B build -S . + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure + +arch:cmake:clang: + stage: build + extends: + - .monado.image.arch:rolling + + script: + - rm -rf build + - cmake -GNinja -B build -S . -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + - cd build && ctest --output-on-failure + +arch:meson: + stage: build + extends: + - .monado.image.arch:rolling + + script: + - rm -rf build + - meson setup build . + - ninja -C build # Packaging .monado.packaging.conditions: @@ -368,127 +384,121 @@ ndk:arm64-v8a: # Otherwise, don't build packages. - when: never -.monado.base-job.debuild: + + +debian:bullseye:package: extends: + - .monado.image.debian:bullseye - .monado.packaging.conditions + variables: + DEBFULLNAME: "Monado CI" + DEBEMAIL: "ryan.pavlik@collabora.com" + DISTRO: debian + CODENAME: bullseye + DEB_VERSION_SUFFIX: bpo11 stage: package before_script: - # Configure git - needed despite not actually committing here. - - git config --global user.email "ryan.pavlik@collabora.com" - - git config --global user.name "Monado CI" + - git config --global user.name Monado CI + - git config --global user.email ryan.pavlik@collabora.com script: # Prep the source tree - git clean -dfx - - git merge origin/${PACKAGE_BRANCH} --no-commit - - DEBFULLNAME="Monado CI" DEBEMAIL="ryan.pavlik@collabora.com" debian/extra/prepare-commit-package.sh ${CI_COMMIT_SHA} 1~${BACKPORT_SUFFIX}~ci$(date --utc "+%Y%m%d") - # Build the package - - debuild -uc -us - # Use dput-ng to move the package-related files into some artifacts. - - export INCOMING=$(pwd)/incoming - - mkdir -p $INCOMING - - mkdir -p ~/.dput.d/profiles - - cat .gitlab-ci/localhost.json | envsubst > ~/.dput.d/profiles/localhost.json - - dpkg-parsechangelog --show-field version > incoming/${DISTRO}.distro - - dput --debug localhost ../monado_$(dpkg-parsechangelog --show-field version)_amd64.changes + # Call this script to build binary and source packages. + # Can try locally by exporting the right variables and passing -B to get only a binary package to avoid complaints. + - .gitlab-ci/build-and-submit-package.sh artifacts: paths: - "incoming/" expire_in: 2 days -debian:buster:package: - extends: - - .monado.variables.debian:buster - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.debuild - variables: - BACKPORT_SUFFIX: bpo10 - PACKAGE_BRANCH: debian/buster-backports - DISTRO: buster - -debian:bullseye:package: - extends: - - .monado.variables.debian:bullseye - - .fdo.distribution-image@debian # from ci-templates - - .monado.base-job.debuild - variables: - BACKPORT_SUFFIX: bpo11 - PACKAGE_BRANCH: debian/bullseye - DISTRO: bullseye - ubuntu:focal:package: extends: - - .monado.variables.ubuntu:focal - - .fdo.distribution-image@ubuntu # from ci-templates - - .monado.base-job.debuild + - .monado.image.ubuntu:focal + - .monado.packaging.conditions variables: - BACKPORT_SUFFIX: ubuntu2004 - PACKAGE_BRANCH: ubuntu/focal - DISTRO: focal + DEBFULLNAME: "Monado CI" + DEBEMAIL: "ryan.pavlik@collabora.com" + DISTRO: ubuntu + CODENAME: focal + DEB_VERSION_SUFFIX: ubuntu2004 + stage: package + before_script: + - git config --global user.name Monado CI + - git config --global user.email ryan.pavlik@collabora.com + script: + # Prep the source tree + - git clean -dfx + # Call this script to build binary and source packages. + # Can try locally by exporting the right variables and passing -B to get only a binary package to avoid complaints. + - .gitlab-ci/build-and-submit-package.sh + artifacts: + paths: + - "incoming/" + expire_in: 2 days ubuntu:hirsute:package: extends: - - .monado.variables.ubuntu:hirsute - - .fdo.distribution-image@ubuntu # from ci-templates - - .monado.base-job.debuild - + - .monado.image.ubuntu:hirsute + - .monado.packaging.conditions variables: - BACKPORT_SUFFIX: ubuntu2104 - PACKAGE_BRANCH: ubuntu/hirsute - DISTRO: hirsute + DEBFULLNAME: "Monado CI" + DEBEMAIL: "ryan.pavlik@collabora.com" + DISTRO: ubuntu + CODENAME: hirsute + DEB_VERSION_SUFFIX: ubuntu2104 + stage: package + before_script: + - git config --global user.name Monado CI + - git config --global user.email ryan.pavlik@collabora.com + script: + # Prep the source tree + - git clean -dfx + # Call this script to build binary and source packages. + # Can try locally by exporting the right variables and passing -B to get only a binary package to avoid complaints. + - .gitlab-ci/build-and-submit-package.sh + artifacts: + paths: + - "incoming/" + expire_in: 2 days ubuntu:impish:package: extends: - - .monado.variables.ubuntu:impish - - .fdo.distribution-image@ubuntu # from ci-templates - - .monado.base-job.debuild - + - .monado.image.ubuntu:impish + - .monado.packaging.conditions variables: - BACKPORT_SUFFIX: ubuntu2110 - PACKAGE_BRANCH: ubuntu/impish - DISTRO: impish + DEBFULLNAME: "Monado CI" + DEBEMAIL: "ryan.pavlik@collabora.com" + DISTRO: ubuntu + CODENAME: impish + DEB_VERSION_SUFFIX: ubuntu2110 + stage: package + before_script: + - git config --global user.name Monado CI + - git config --global user.email ryan.pavlik@collabora.com + script: + # Prep the source tree + - git clean -dfx + # Call this script to build binary and source packages. + # Can try locally by exporting the right variables and passing -B to get only a binary package to avoid complaints. + - .gitlab-ci/build-and-submit-package.sh + artifacts: + paths: + - "incoming/" + expire_in: 2 days reprepro:package: stage: reprepro extends: - - .monado.variables.ubuntu:impish + - .monado.image.ubuntu:impish + - .monado.packaging.conditions - - .fdo.distribution-image@ubuntu # from ci-templates dependencies: - - debian:buster:package - debian:bullseye:package - ubuntu:focal:package - ubuntu:hirsute:package - ubuntu:impish:package - before_script: - # Convince gnupg to work properly in CI - - mkdir -p ~/.gnupg && chmod 700 ~/.gnupg - - touch ~/.gnupg/gpg.conf - - echo 'use-agent' > ~/.gnupg/gpg.conf - - echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf - - touch ~/.gnupg/gpg-agent.conf - - echo 'allow-loopback-pinentry' > ~/.gnupg/gpg-agent.conf - - echo RELOADAGENT | gpg-connect-agent - - gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE} --import ${MONADO_GPG_SECRET_KEY} - script: - # Use reprepro to create an apt repository in our artifacts - - mkdir -p repo/conf - # For each distro, sign the changes file and add it to the repo. - - | - for fn in incoming/*.distro; do - # parse the distro name out - export DISTRO=$(echo $fn | sed -e 's:incoming/::' -e 's:[.]distro::') - echo "Processing $DISTRO" - # add distro to repository config - blank line is mandatory! - cat .gitlab-ci/distributions | envsubst >> repo/conf/distributions - echo >> repo/conf/distributions - - echo "Signing package for $DISTRO" - debsign -k ${MONADO_GPG_FINGERPRINT} -p "gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE}" incoming/monado_$(cat $fn)_amd64.changes - - echo "Adding package for $DISTRO to the repository" - reprepro -V --ignore=wrongdistribution -b repo include ${DISTRO} incoming/monado_$(cat $fn)_amd64.changes - done + - bash .gitlab-ci/reprepro.sh artifacts: paths: - "repo/" @@ -502,7 +512,7 @@ pages: only: - main dependencies: - - debian:bullseye:cmake + - debian:cmake - reprepro:package script: - mkdir -p public @@ -510,4 +520,4 @@ pages: - mv repo public/apt artifacts: paths: - - public + - public \ No newline at end of file diff --git a/.gitlab-ci/arch_container_prep.sh b/.gitlab-ci/arch_container_prep.sh deleted file mode 100644 index eb27c59b3..000000000 --- a/.gitlab-ci/arch_container_prep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors -# SPDX-License-Identifier: BSL-1.0 - -( - cd $(dirname $0) - bash ./build-openxr-openhmd.sh -) diff --git a/.gitlab-ci/build-and-submit-package.sh b/.gitlab-ci/build-and-submit-package.sh new file mode 100755 index 000000000..304ea366d --- /dev/null +++ b/.gitlab-ci/build-and-submit-package.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors + +set -euo pipefail + +# Prep the source tree +git merge "origin/${DISTRO}/${CODENAME}" --no-commit +datestamp=$(date --utc "+%Y%m%d") +debian/extra/prepare-commit-package.sh "${CI_COMMIT_SHA}" "1~${DEB_VERSION_SUFFIX}~ci${datestamp}" +# Build the package +debuild -uc -us "$@" +# Stash the package version in a convenient file for a later job. +INCOMING="$(pwd)/incoming" +export INCOMING +mkdir -p "$INCOMING" +dpkg-parsechangelog --show-field version > "incoming/${CODENAME}.distro" +# Use dput-ng to move the package-related files into some artifacts. +mkdir -p ~/.dput.d/profiles +envsubst < .gitlab-ci/localhost.json > ~/.dput.d/profiles/localhost.json +dput --debug localhost "../monado_$(dpkg-parsechangelog --show-field version)_amd64.changes" diff --git a/.gitlab-ci/build-openxr-openhmd.sh b/.gitlab-ci/build-openxr-openhmd.sh deleted file mode 100755 index 011d91a55..000000000 --- a/.gitlab-ci/build-openxr-openhmd.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors -# SPDX-License-Identifier: BSL-1.0 - -# Install the OpenXR SDK, whatever version, installed system-wide. -git clone https://github.com/KhronosGroup/OpenXR-SDK -pushd OpenXR-SDK -mkdir build -pushd build -cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=Off -DPRESENTATION_BACKEND=xlib -DDYNAMIC_LOADER=ON -DOpenGL_GL_PREFERENCE=GLVND -GNinja .. -ninja install -popd -popd - -# Install OpenHMD from git master, as released versions are not sufficient -# for us to build. -git clone https://github.com/OpenHMD/OpenHMD -pushd OpenHMD -mkdir build -meson --prefix=/usr/local --libdir=lib build -ninja -C build install -popd diff --git a/.gitlab-ci/ci-scripts.mk b/.gitlab-ci/ci-scripts.mk new file mode 100644 index 000000000..b8809aaa3 --- /dev/null +++ b/.gitlab-ci/ci-scripts.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2022 Collabora, Ltd. and the Monado contributors +# +# To generate all the templated files, run this from the root of the repo: +# make -f .gitlab-ci/ci-scripts.mk + +# These also all have their template named the same with a .template suffix. +FILES_IN_SUBDIR := \ + .gitlab-ci/distributions \ + .gitlab-ci/reprepro.sh \ + +CONFIG_FILE := .gitlab-ci/config.yml +all: .gitlab-ci.yml $(FILES_IN_SUBDIR) +.PHONY: all + +clean: + rm -f .gitlab-ci.yml $(FILES_IN_SUBDIR) +.PHONY: clean + +# As the default thing for ci-fairy to template, this is special cased +.gitlab-ci.yml: .gitlab-ci/ci.template $(CONFIG_FILE) + ci-fairy generate-template + +# Everything else is structured alike +$(FILES_IN_SUBDIR): %: %.jinja $(CONFIG_FILE) + ci-fairy generate-template --config=$(CONFIG_FILE) $< > $@ diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template new file mode 100644 index 000000000..7c7610a30 --- /dev/null +++ b/.gitlab-ci/ci.template @@ -0,0 +1,254 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors + +{# ignore the warning, this is actually the template to edit. #} +###################################### +# GENERATED - DO NOT EDIT # +# see .gitlab-ci/ci.template instead # +###################################### +{# +useful links: +https://freedesktop.pages.freedesktop.org/ci-templates/ +https://freedesktop.pages.freedesktop.org/ci-templates/ci-fairy.html#templating-gitlab-ci-yml +https://gitlab.freedesktop.org/freedesktop/ci-templates + +Config file used for all templates: .gitlab-ci/config.yml +.gitlab-ci.yml template: .gitlab-ci/ci.template +.gitlab-ci/distributions template (for reprepro): .gitlab-ci/distributions.jinja +.gitlab-ci/reprepro.sh template: .gitlab-ci/reprepro.sh.jinja + +The following will update all files from templates: +make -f .gitlab-ci/ci-scripts.mk +#} + +variables: + FDO_UPSTREAM_REPO: monado/monado + +.templates_sha: &templates_sha {{fdo_ci_templates_sha}} + +include: +{% for distro in distributions %} + # {{ distro.name | capitalize }} + - project: "freedesktop/ci-templates" + ref: *templates_sha + file: "/templates/{{distro.name}}.yml" +{% endfor %} + +{% for distro in distributions -%} {%- for image in distro.images %} + +# Variables for build and usage of {{ distro.name|capitalize }} {{image.codename}} image +.monado.variables.{{distro.name}}:{{image.codename}}: + variables: + FDO_DISTRIBUTION_VERSION: "{{ image["distro_version"] | default(image.codename) }}" + FDO_DISTRIBUTION_TAG: "{{image["tag"]}}" +{% if "repo_suffix" in image %} + FDO_REPO_SUFFIX: {{image["repo_suffix"]}} +{% endif %} +{% endfor -%} {%- endfor %} + +stages: + - container_prep + - build + - package + - reprepro + - pages + - deploy + +### +# Container prep jobs + +{%- for distro in distributions -%} {%- for image in distro.images %} + +# Make {{ distro.name|capitalize }} {{image.codename}} image +{{distro.name}}:{{image.codename}}:container_prep: + stage: container_prep + extends: + - .monado.variables.{{distro.name}}:{{image.codename}} + - .fdo.container-build@{{distro.name}} # from ci-templates + variables: + {# The packages list is actually a mapping, not an array, but the same syntax works. #} + {# Needed to be a mapping so it could be "merged" #} + FDO_DISTRIBUTION_PACKAGES: '{{image.packages | sort | join(" ")}}' +{% if "script" in image %} + FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/{{image["script"]}}' +{% endif %} +{% endfor -%} {%- endfor %} + +{# Macro to compute job name to extend to use image given distro and image objects#} +{% macro base_job_to_use_image(distro, image) %}.monado.image.{{distro.name}}:{{image.codename}}{% endmacro -%} + +### +# Container usage base jobs +{% for distro in distributions -%} {%- for image in distro.images %} + +# Base for using {{ distro.name|capitalize }} {{image.codename}} image +{{base_job_to_use_image(distro, image)}}: + extends: + - .monado.variables.{{distro.name}}:{{image.codename}} + - .fdo.{{ "suffixed" if "repo_suffix" in image else "distribution" }}-image@{{distro.name}} # from ci-templates + +{% endfor -%} {%- endfor %} + +{# Macro to compute job name to extend to use image given a package we want#} +{% macro base_job_to_use_image_containing(package) %} +{% for distro in distributions -%} {%- for image in distro.images if package in image.packages %} +{{ base_job_to_use_image(distro, image) if loop.first }} +{% endfor -%} {%- endfor %} +{% endmacro -%} + +# Style check job +format-and-spellcheck: + extends: + - {{base_job_to_use_image_containing("codespell")}} + stage: build + script: + - scripts/format-and-spellcheck.sh + artifacts: + paths: + - patches/ + expire_in: 1 week + when: on_failure + +# Verify REUSE compliance +reuse: + stage: build + image: + name: fsfe/reuse:latest + entrypoint: [""] + script: + - reuse lint + +{% macro make_cmake_args(cmake_defines) %} +{% if cmake_defines is defined %} +{%- for k, v in cmake_defines |dictsort %} -D{{ k }}={{ v }}{% endfor %} +{%- endif %} +{%- endmacro -%} + +{#### Main build jobs ####} +{% for distro in distributions -%} {%- for image in distro.images -%} {%- for job in image.build_jobs %} + +{{job.name}}: + stage: build + extends: + - {{base_job_to_use_image(distro, image)}} + +{% if job.before_script %} + before_script: + {% for line in job.before_script %} + - {{line}} + {% endfor %} +{% endif %} + script: + - rm -rf build + +{#- meson builds -#} +{%- if "meson" in job.name %} + + - meson setup build . + {%- if job.args %} {{ job.args | join(' ') }}{% endif %} + + - ninja -C build + +{#- regular or NDK cmake builds -#} +{%- elif "cmake" in job.name or "ndk" in job.name %} + + - cmake -GNinja -B build -S . {{- make_cmake_args(job.cmake_defines) }} + - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt + - ninja -C build + +{%- else %} + +{# error message #} + CANNOT GUESS JOB TYPE + +{%- endif %} + +{%- if "cmake" in job.name %} + + - cd build && ctest --output-on-failure +{%- endif %} + +{%- if job.artifact_path %} + + artifacts: + paths: + - {{ job.artifact_path }} +{%- endif %} + +{% endfor -%} {%- endfor -%} {%- endfor %} + +# Packaging +.monado.packaging.conditions: + rules: + # Only the default branch of the "upstream" repo. + - if: "$CI_PROJECT_PATH == $FDO_UPSTREAM_REPO && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH" + when: on_success + # Otherwise, don't build packages. + - when: never + +{% macro packaging_job_name(distro, image) -%} +{{distro.name}}:{{image.codename}}:package +{%- endmacro %} + +{% for distro in distributions -%} {%- for image in distro.images if "deb_version_suffix" in image %} + +{{packaging_job_name(distro, image)}}: + extends: + - {{base_job_to_use_image(distro, image)}} + - .monado.packaging.conditions + variables: + DEBFULLNAME: "{{packaging.name}}" + DEBEMAIL: "{{packaging.email}}" + DISTRO: {{distro.name}} + CODENAME: {{image.codename}} + DEB_VERSION_SUFFIX: {{image.deb_version_suffix}} + stage: package + before_script: + {# Configure git - needed despite not actually committing here. #} + - git config --global user.name {{packaging.name}} + - git config --global user.email {{packaging.email}} + script: + # Prep the source tree + - git clean -dfx + # Call this script to build binary and source packages. + # Can try locally by exporting the right variables and passing -B to get only a binary package to avoid complaints. + - .gitlab-ci/build-and-submit-package.sh + artifacts: + paths: + - "incoming/" + expire_in: 2 days +{% endfor -%} {%- endfor %} + +reprepro:package: + stage: reprepro + extends: + - {{ base_job_to_use_image_containing("reprepro") }} + - .monado.packaging.conditions + dependencies: +{% for distro in distributions -%} {%- for image in distro.images if "deb_version_suffix" in image %} + - {{packaging_job_name(distro, image)}} +{% endfor -%} {%- endfor %} + script: + - bash .gitlab-ci/reprepro.sh + artifacts: + paths: + - "repo/" + expire_in: 2 days + +### +# Pages +### +pages: + stage: pages + only: + - main + dependencies: + - debian:cmake + - reprepro:package + script: + - mkdir -p public + - mv build/doc/html/* public/ + - mv repo public/apt + artifacts: + paths: + - public diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml new file mode 100644 index 000000000..c9699b412 --- /dev/null +++ b/.gitlab-ci/config.yml @@ -0,0 +1,235 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors + +# Please run the following from the repo root after modifying this file: +# make -f .gitlab-ci/ci-scripts.mk + +fdo_ci_templates_sha: 34039cd573a2df832d465bc9e4c5f543571f5241 + +# These are a mapping, instead of a list/array, so we can merge. +.default_debian_packages: + &default_debian_packages # Packages required for build and some other basic jobs + build-essential: + git: + wget: + unzip: + cmake: + meson: + ninja-build: + libeigen3-dev: + curl: + patch: + python3: + pkg-config: + libx11-dev: + libx11-xcb-dev: + libxxf86vm-dev: + libxrandr-dev: + libxcb-randr0-dev: + libvulkan-dev: + glslang-tools: + libglvnd-dev: + libgl1-mesa-dev: + ca-certificates: + libusb-1.0-0-dev: + libudev-dev: + # These are optional packages, that we're building against to ensure we build as much code as possible + libhidapi-dev: + libwayland-dev: + libuvc-dev: + libavcodec-dev: + libopencv-dev: + libv4l-dev: + libcjson-dev: + libsdl2-dev: + libegl1-mesa-dev: + libdbus-1-dev: + libgstreamer1.0-dev: + libgstreamer-plugins-base1.0-dev: + libsystemd-dev: + libbsd-dev: + # Only used for building packages + devscripts: + debhelper: + dput-ng: + gettext-base: + pandoc: + +# These config defines are used for all NDK builds +.android_cmake_defines: &android_cmake_defines + ANDROID_PLATFORM: 26 + CMAKE_TOOLCHAIN_FILE: /opt/android-ndk/build/cmake/android.toolchain.cmake + Eigen3_DIR: /usr/lib/cmake/eigen3/ + EIGEN3_INCLUDE_DIR: /usr/include/eigen3 + +# The distributions we'll make an image for +distributions: + - name: debian + images: + # This image does some extra work. + - codename: bullseye + script: i386_and_proclamation_container_prep.sh + tag: "2022-01-19.0" + deb_version_suffix: bpo11 + packages: + <<: *default_debian_packages + codespell: + doxygen: + graphviz: + python3-pip: + python3-click: + clang-format: + build_jobs: + - name: "debian:cmake" + # Generate "changes since last release" and add to changelog, + # since this is the build that makes our docs. + before_script: + - pushd doc/changes + - proclamation build --overwrite vNEXT + - popd + artifact_path: build/doc/html/ + + - name: "debian:cmake-no-opencv" + cmake_defines: + BUILD_DOC: "OFF" + XRT_HAVE_OPENCV: "OFF" + + - name: "debian:cmake-no-sdl2" + cmake_defines: + BUILD_DOC: "OFF" + XRT_HAVE_SDL2: "OFF" + + - name: "debian:cmake-no-service" + cmake_defines: + BUILD_DOC: "OFF" + XRT_FEATURE_SERVICE: "OFF" + + - name: "debian:cmake:32bit" + cmake_defines: + CMAKE_TOOLCHAIN_FILE: .gitlab-ci/i386.cmake + # OpenCV doesn't play nicely with us in multi-arch. + XRT_HAVE_OPENCV: "OFF" + + - name: "debian:meson" + + - name: "debian:meson:32bit" + args: + - --prefix=/usr + - --libdir=/usr/lib/i386-linux-gnu + - --cross-file=.gitlab-ci/i386-cross.txt + + # This one is pretty minimal, compared to the others. + - codename: bullseye-ndk + distro_version: bullseye + repo_suffix: ndk + script: ndk_container_prep.sh + tag: "2022-01-19.0" + packages: + git: + wget: + unzip: + cmake: + meson: + ninja-build: + libeigen3-dev: + python3: + pkg-config: + ca-certificates: + glslang-tools: + build_jobs: + - name: "ndk:armeabi-v7a" + cmake_defines: + <<: *android_cmake_defines + BUILD_DOC: "OFF" + ANDROID_ABI: armeabi-v7a + + - name: "ndk:arm64-v8a" + cmake_defines: + <<: *android_cmake_defines + BUILD_DOC: "OFF" + ANDROID_ABI: arm64-v8a + + - name: ubuntu + images: + # LTS + - codename: focal + distro_version: "20.04" + tag: "2021-10-27.1" + deb_version_suffix: ubuntu2004 + packages: + <<: *default_debian_packages + build_jobs: + - name: "ubuntu:cmake" + cmake_defines: + BUILD_DOC: "OFF" + + - name: "ubuntu:meson" + + - codename: hirsute + distro_version: "21.04" + tag: "2021-10-27.1" + deb_version_suffix: ubuntu2104 + packages: + <<: *default_debian_packages + + - codename: impish + distro_version: "21.10" + tag: "2021-10-28.0" + deb_version_suffix: ubuntu2110 + packages: + <<: *default_debian_packages + reprepro: + build_jobs: + - name: "ubuntu:latest:cmake" + cmake_defines: + BUILD_DOC: "OFF" + + - name: arch + images: + - codename: rolling + tag: "2021-09-14.0" + packages: + git: + gcc: + clang: + cmake: + meson: + ninja: + pkgconfig: + python3: + diffutils: + patch: + doxygen: + graphviz: + eigen: + hidapi: + libxrandr: + mesa: + glslang: + vulkan-headers: + vulkan-icd-loader: + check: + glfw-x11: + libusb: + opencv: + gtk3: + ffmpeg: + v4l-utils: + qt5-base: + build_jobs: + - name: "arch:cmake" + + - name: "arch:cmake:clang" + cmake_defines: + CMAKE_C_COMPILER: /usr/bin/clang + CMAKE_CXX_COMPILER: /usr/bin/clang++ + + - name: "arch:meson" + +android: + platform: 26 + +packaging: + # Name and email associated with the package + name: "Monado CI" + email: "ryan.pavlik@collabora.com" diff --git a/.gitlab-ci/debian_buster_container_prep.sh b/.gitlab-ci/debian_buster_container_prep.sh deleted file mode 100644 index 54059dfca..000000000 --- a/.gitlab-ci/debian_buster_container_prep.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors -# SPDX-License-Identifier: BSL-1.0 - -( - cd $(dirname $0) - bash ./install-cross.sh -) -( - cd $(dirname $0) - bash ./build-openxr-openhmd.sh -) diff --git a/.gitlab-ci/distributions b/.gitlab-ci/distributions index 90f3d0c5d..e69de29bb 100644 --- a/.gitlab-ci/distributions +++ b/.gitlab-ci/distributions @@ -1,7 +0,0 @@ -Origin: monado.freedesktop.org -Description: Monado CI apt repository -Codename: ${DISTRO} -Architectures: amd64 i386 source -Components: main -Tracking: minimal -SignWith: ${MONADO_GPG_FINGERPRINT} diff --git a/.gitlab-ci/distributions.jinja b/.gitlab-ci/distributions.jinja new file mode 100644 index 000000000..825d7522f --- /dev/null +++ b/.gitlab-ci/distributions.jinja @@ -0,0 +1,34 @@ +{# +Copyright 2020-2022, Collabora, Ltd. + +SPDX-License-Identifier: BSL-1.0 +#} +{# +Template for reprepro distributions config file. + +After this template gets expanded, with a paragraph for each +distribution codename supported, +the GPG fingerprint gets substituted into that at CI time using envsubst, +(not ahead of time using ci-fairy) +because the fingerprint is included in the "secrets" in CI. + +Note: There is no way to indicate comments in the reprepro distributions config +file format, and whitespace is meaningful (need blank lines between paragraphs). + +Please run the following after modifying this file: + + ci-fairy generate-template --config .gitlab-ci/config.yml .gitlab-ci/distributions.template > .gitlab-ci/distributions + +#} +{% for distro in packaging.distribution_suffixes %} +{% for codename in packaging.distribution_suffixes[distro] %} +Origin: monado.freedesktop.org +Description: Monado CI apt repository +Codename: {{ codename }} +Architectures: amd64 i386 source +Components: main +Tracking: minimal +SignWith: ${MONADO_GPG_FINGERPRINT} + +{% endfor %} +{% endfor %} diff --git a/.gitlab-ci/distributions.license b/.gitlab-ci/distributions.license index 972ecf740..8feac6693 100644 --- a/.gitlab-ci/distributions.license +++ b/.gitlab-ci/distributions.license @@ -1,3 +1,5 @@ -Copyright 2020, Collabora, Ltd. +Copyright 2020-2022, Collabora, Ltd. -SPDX-License-Identifier: BSL-1.0 \ No newline at end of file +SPDX-License-Identifier: BSL-1.0 + +Generated from distributions.template with ci-fairy diff --git a/.gitlab-ci/gpg-agent.conf b/.gitlab-ci/gpg-agent.conf new file mode 100644 index 000000000..8a1ad9863 --- /dev/null +++ b/.gitlab-ci/gpg-agent.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors + +# Used for CI package building. +allow-loopback-pinentry diff --git a/.gitlab-ci/gpg.conf b/.gitlab-ci/gpg.conf new file mode 100644 index 000000000..e7aba9e06 --- /dev/null +++ b/.gitlab-ci/gpg.conf @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors + +# Used for CI package building. +use-agent +pinentry-mode loopback diff --git a/.gitlab-ci/debian_bullseye_container_prep.sh b/.gitlab-ci/i386_and_proclamation_container_prep.sh similarity index 77% rename from .gitlab-ci/debian_bullseye_container_prep.sh rename to .gitlab-ci/i386_and_proclamation_container_prep.sh index 18cdb5c40..34058e211 100644 --- a/.gitlab-ci/debian_bullseye_container_prep.sh +++ b/.gitlab-ci/i386_and_proclamation_container_prep.sh @@ -6,9 +6,5 @@ cd $(dirname $0) bash ./install-cross.sh ) -( - cd $(dirname $0) - bash ./build-openxr-openhmd.sh -) python3 -m pip install proclamation diff --git a/.gitlab-ci/reprepro.sh b/.gitlab-ci/reprepro.sh new file mode 100644 index 000000000..d941282dd --- /dev/null +++ b/.gitlab-ci/reprepro.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors + +############################################### +# GENERATED - DO NOT EDIT # +# see .gitlab-ci/reprepro.sh.template instead # +############################################### + + +set -euo pipefail + +# Convince gnupg to work properly in CI +mkdir -p ~/.gnupg && chmod 700 ~/.gnupg +cp .gitlab-ci/gpg.conf .gitlab-ci/gpg-agent.conf ~/.gnupg +echo RELOADAGENT | gpg-connect-agent +gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase "${MONADO_GPG_PASSPHRASE}" --import "${MONADO_GPG_SECRET_KEY}" +mkdir -p repo/conf +# Substitute in the GPG fingerprint into the repository config. +# This file is itself generated with ci-fairy. +envsubst < .gitlab-ci/distributions >> repo/conf/distributions + +# For each distro, sign the changes file and add it to the repo. + +# bullseye +if [ -f "incoming/bullseye.distro" ]; then + VERSION=$(cat incoming/bullseye.distro) + echo "Signing and processing bullseye: ${VERSION}" + debsign -k "${MONADO_GPG_FINGERPRINT}" -p "gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE}" "incoming/monado_${VERSION}_amd64.changes" + reprepro -V --ignore=wrongdistribution -b repo include bullseye "incoming/monado_${VERSION}_amd64.changes" +else + echo "Skipping bullseye - no artifact found" +fi + +# focal +if [ -f "incoming/focal.distro" ]; then + VERSION=$(cat incoming/focal.distro) + echo "Signing and processing focal: ${VERSION}" + debsign -k "${MONADO_GPG_FINGERPRINT}" -p "gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE}" "incoming/monado_${VERSION}_amd64.changes" + reprepro -V --ignore=wrongdistribution -b repo include focal "incoming/monado_${VERSION}_amd64.changes" +else + echo "Skipping focal - no artifact found" +fi + +# hirsute +if [ -f "incoming/hirsute.distro" ]; then + VERSION=$(cat incoming/hirsute.distro) + echo "Signing and processing hirsute: ${VERSION}" + debsign -k "${MONADO_GPG_FINGERPRINT}" -p "gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE}" "incoming/monado_${VERSION}_amd64.changes" + reprepro -V --ignore=wrongdistribution -b repo include hirsute "incoming/monado_${VERSION}_amd64.changes" +else + echo "Skipping hirsute - no artifact found" +fi + +# impish +if [ -f "incoming/impish.distro" ]; then + VERSION=$(cat incoming/impish.distro) + echo "Signing and processing impish: ${VERSION}" + debsign -k "${MONADO_GPG_FINGERPRINT}" -p "gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE}" "incoming/monado_${VERSION}_amd64.changes" + reprepro -V --ignore=wrongdistribution -b repo include impish "incoming/monado_${VERSION}_amd64.changes" +else + echo "Skipping impish - no artifact found" +fi diff --git a/.gitlab-ci/reprepro.sh.jinja b/.gitlab-ci/reprepro.sh.jinja new file mode 100644 index 000000000..1eee6e2da --- /dev/null +++ b/.gitlab-ci/reprepro.sh.jinja @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors + +{# ignore the warning, this is actually the template to edit. #} +############################################### +# GENERATED - DO NOT EDIT # +# see .gitlab-ci/reprepro.sh.template instead # +############################################### +{# +Please run the following after editing: + ci-fairy generate-template --config .gitlab-ci/config.yml .gitlab-ci/reprepro.sh.template > .gitlab-ci/reprepro.sh +#} + + +set -euo pipefail + +# Convince gnupg to work properly in CI +mkdir -p ~/.gnupg && chmod 700 ~/.gnupg +cp .gitlab-ci/gpg.conf .gitlab-ci/gpg-agent.conf ~/.gnupg +echo RELOADAGENT | gpg-connect-agent +gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase "${MONADO_GPG_PASSPHRASE}" --import "${MONADO_GPG_SECRET_KEY}" +mkdir -p repo/conf +# Substitute in the GPG fingerprint into the repository config. +# This file is itself generated with ci-fairy. +envsubst < .gitlab-ci/distributions >> repo/conf/distributions + +# For each distro, sign the changes file and add it to the repo. +{% for distro in distributions | sort(attribute="name") %} +{% for image in distro.images if "deb_version_suffix" in image %} + +# {{ image.codename }} +if [ -f "incoming/{{image.codename}}.distro" ]; then + VERSION=$(cat incoming/{{image.codename}}.distro) + echo "Signing and processing {{image.codename}}: ${VERSION}" + debsign -k "${MONADO_GPG_FINGERPRINT}" -p "gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE}" "incoming/monado_${VERSION}_amd64.changes" + reprepro -V --ignore=wrongdistribution -b repo include {{image.codename}} "incoming/monado_${VERSION}_amd64.changes" +else + echo "Skipping {{image.codename}} - no artifact found" +fi +{% endfor %} +{% endfor %} diff --git a/.gitlab-ci/ubuntu_focal_container_prep.sh b/.gitlab-ci/ubuntu_focal_container_prep.sh deleted file mode 100644 index 921193167..000000000 --- a/.gitlab-ci/ubuntu_focal_container_prep.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors -# SPDX-License-Identifier: BSL-1.0 -( - cd $(dirname $0) - bash ./build-openxr-openhmd.sh -) diff --git a/.gitlab-ci/ubuntu_hirsute_container_prep.sh b/.gitlab-ci/ubuntu_hirsute_container_prep.sh deleted file mode 100644 index 36480abd3..000000000 --- a/.gitlab-ci/ubuntu_hirsute_container_prep.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# Copyright 2021, Collabora, Ltd. and the Monado contributors -# SPDX-License-Identifier: BSL-1.0 - -# Nothing really needed. diff --git a/.gitlab-ci/ubuntu_impish_container_prep.sh b/.gitlab-ci/ubuntu_impish_container_prep.sh deleted file mode 100644 index 36480abd3..000000000 --- a/.gitlab-ci/ubuntu_impish_container_prep.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# Copyright 2021, Collabora, Ltd. and the Monado contributors -# SPDX-License-Identifier: BSL-1.0 - -# Nothing really needed.