From b1d149347a48b2484e93ffbbb2bc4c39462a46cf Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Thu, 6 Apr 2023 16:46:54 +0900 Subject: [PATCH] Rework CI implementation v2 --- .gitlab-ci.yml | 426 ++++++++++++++++++++----------------- .gitlab-ci/.gitignore | 1 + .gitlab-ci/build.sh | 132 ++++++++++++ .gitlab-ci/ci.template | 133 +++--------- .gitlab-ci/config.yml | 59 ++++- .gitlab-ci/fedora-cross.sh | 3 + .gitlab-ci/other.yml | 142 +++++++++++++ 7 files changed, 587 insertions(+), 309 deletions(-) create mode 100644 .gitlab-ci/.gitignore create mode 100755 .gitlab-ci/build.sh create mode 100644 .gitlab-ci/fedora-cross.sh create mode 100644 .gitlab-ci/other.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f495fe5..9387806 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,7 @@ include: - project: 'freedesktop/ci-templates' ref: *template_sha file: '/templates/ci-fairy.yml' + - local: '.gitlab-ci/other.yml' stages: - prep @@ -34,7 +35,7 @@ variables: # changing these will force rebuilding the associated image # Note: these tags have no meaning and are not tied to a particular # fontconfig version - FEDORA_TAG: '2023-03-31.0-b6a9c5563c63' + FEDORA_TAG: '2023-03-31.0-e8249e0940af' FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh' @@ -48,46 +49,32 @@ variables: # will re-use the containers if the tag doesn't change. fedora:rawhide@container-prep: - extends: - - .fdo.container-build@fedora + extends: .fdo.container-build@fedora stage: prep variables: GIT_STRATEGY: none FDO_DISTRIBUTION_VERSION: 'rawhide' - FDO_DISTRIBUTION_PACKAGES: '@buildsys-build autoconf automake libtool gettext gettext-devel gperf expat-devel libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf bubblewrap ninja-build wget python3-pip' + FDO_DISTRIBUTION_PACKAGES: '@buildsys-build autoconf automake libtool gettext gettext-devel gperf expat-devel libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf bubblewrap ninja-build wget python3-pip mingw64-gettext mingw64-freetype mingw64-libxml2 wine' FDO_DISTRIBUTION_TAG: $FEDORA_TAG FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC fedora:38@container-prep: - extends: - - .fdo.container-build@fedora + extends: .fdo.container-build@fedora stage: prep variables: GIT_STRATEGY: none FDO_DISTRIBUTION_VERSION: '38' - FDO_DISTRIBUTION_PACKAGES: '@buildsys-build autoconf automake libtool gettext gettext-devel gperf expat-devel libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf bubblewrap ninja-build wget python3-pip' + FDO_DISTRIBUTION_PACKAGES: '@buildsys-build autoconf automake libtool gettext gettext-devel gperf expat-devel libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf bubblewrap ninja-build wget python3-pip mingw64-gettext mingw64-freetype mingw64-libxml2 wine' FDO_DISTRIBUTION_TAG: $FEDORA_TAG FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC fedora:37@container-prep: - extends: - - .fdo.container-build@fedora + extends: .fdo.container-build@fedora stage: prep variables: GIT_STRATEGY: none FDO_DISTRIBUTION_VERSION: '37' - FDO_DISTRIBUTION_PACKAGES: '@buildsys-build autoconf automake libtool gettext gettext-devel gperf expat-devel libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf bubblewrap ninja-build wget python3-pip' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC - -fedora:36@container-prep: - extends: - - .fdo.container-build@fedora - stage: prep - variables: - GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: '36' - FDO_DISTRIBUTION_PACKAGES: '@buildsys-build autoconf automake libtool gettext gettext-devel gperf expat-devel libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf bubblewrap ninja-build wget python3-pip' + FDO_DISTRIBUTION_PACKAGES: '@buildsys-build autoconf automake libtool gettext gettext-devel gperf expat-devel libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf bubblewrap ninja-build wget python3-pip mingw64-gettext mingw64-freetype mingw64-libxml2 wine' FDO_DISTRIBUTION_TAG: $FEDORA_TAG FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC @@ -151,15 +138,6 @@ fedora:37@container-clean: FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG -fedora:36@container-clean: - extends: - - .container-clean - variables: - GIT_STRATEGY: none - CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG - FDO_DISTRIBUTION_VERSION: '36' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - ####################################### # # @@ -167,72 +145,7 @@ fedora:36@container-clean: # # ####################################### -.build autotools shared expat: - stage: test - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - mkdir "$BUILDDIR" "$PREFIX" - - cd "$BUILDDIR" - - env - - r=0 - - ../autogen.sh --prefix="$PREFIX" --enable-shared --disable-static --disable-libxml2 2>&1 | tee /tmp/fc-build.log || r=$? - - make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - make distcheck V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build autotools shared libxml2: - stage: test - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - mkdir "$BUILDDIR" "$PREFIX" - - cd "$BUILDDIR" - - env - - r=0 - - ../autogen.sh --prefix="$PREFIX" --enable-shared --disable-static --enable-libxml2 2>&1 | tee /tmp/fc-build.log || r=$? - - make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - make distcheck V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build autotools static expat: - stage: test - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - mkdir "$BUILDDIR" "$PREFIX" - - cd "$BUILDDIR" - - env - - r=0 - - ../autogen.sh --prefix="$PREFIX" --disable-shared --enable-static --disable-libxml2 2>&1 | tee /tmp/fc-build.log || r=$? - - make check V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build autotools static libxml2: - stage: test - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - mkdir "$BUILDDIR" "$PREFIX" - - cd "$BUILDDIR" - - env - - r=0 - - ../autogen.sh --prefix="$PREFIX" --disable-shared --enable-static --enable-libxml2 2>&1 | tee /tmp/fc-build.log || r=$? - - make check V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build meson shared: - stage: test +.build@template: before_script: - pip install meson script: @@ -240,32 +153,28 @@ fedora:36@container-clean: - export PREFIX="$(pwd)/prefix-$BUILD_ID" - export BUILDDIR="$(pwd)/build-$BUILD_ID" - export MAKEFLAGS="-j4" - - env - - r=0 - - meson --prefix="$PREFIX" --default-library=shared "$BUILDDIR" 2>&1 | tee /tmp/fc-build.log || r=$? - - meson compile -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson test -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson install -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson dist -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build meson static: - stage: test - before_script: - - pip install meson - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - env - - r=0 - - meson --prefix="$PREFIX" --default-library=static "$BUILDDIR" 2>&1 | tee /tmp/fc-build.log || r=$? - - meson compile -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson test -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson install -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r + - | + buildopt=() + for bo in $FC_BUILD_ENABLED; do + buildopt+=(-e $bo) + done + for bo in $FC_BUILD_DISABLED; do + buildopt+=(-d $bo) + done + [ -n "$FC_BUILD_ARCH" ] && buildopt+=(-a $FC_BUILD_ARCH) + [ $FC_BUILD_DISTCHECK -eq 1 ] && buildopt+=(-c) + [ $FC_BUILD_NO_INSTALL -eq 1 ] && buildopt+=(-I) + buildopt+=(-s $FC_BUILDSYS) + buildopt+=(-t $FC_BUILD_TYPE) + buildopt+=(-X $FC_XML_BACKEND) + sh .gitlab-ci/build.sh ${buildopt[*]} + variables: + FC_BUILDSYS: autotools + FC_XML_BACKEND: expat + FC_BUILD_TYPE: both + FC_BUILD_DISTCHECK: 0 + FC_BUILD_NO_INSTALL: 0 + .fc_artifacts: artifacts: name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID @@ -285,288 +194,403 @@ fedora:36@container-clean: t_fedora:rawhide:autotools shared expat: extends: - - .build autotools shared expat + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: 'rawhide' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: shared + FC_XML_BACKEND: expat needs: - 'fedora:rawhide@container-prep' t_fedora:rawhide:autotools shared libxml2: extends: - - .build autotools shared libxml2 + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: 'rawhide' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + FC_BUILD_DISTCHECK: 1 needs: - 'fedora:rawhide@container-prep' t_fedora:rawhide:autotools static expat: extends: - - .build autotools static expat + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: 'rawhide' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat needs: - 'fedora:rawhide@container-prep' t_fedora:rawhide:autotools static libxml2: extends: - - .build autotools static libxml2 + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: 'rawhide' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 needs: - 'fedora:rawhide@container-prep' -t_fedora:rawhide:meson shared: +t_fedora:rawhide:mingw autotools static libxml2: extends: - - .build meson shared + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: 'rawhide' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 + FC_BUILD_PLATFORM: mingw + FC_BUILD_ARCH: x86_64-mingw32 needs: - 'fedora:rawhide@container-prep' -t_fedora:rawhide:meson static: +t_fedora:rawhide:meson shared expat: extends: - - .build meson static + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: 'rawhide' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: expat + needs: + - 'fedora:rawhide@container-prep' + + +t_fedora:rawhide:meson static expat: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .fc_artifacts + variables: + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: 'rawhide' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat + needs: + - 'fedora:rawhide@container-prep' + + +t_fedora:rawhide:mingw meson static expat: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .fc_artifacts + variables: + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: 'rawhide' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat + FC_BUILD_PLATFORM: mingw + FC_BUILD_ARCH: linux-mingw-w64-64bit + FC_BUILD_NO_INSTALL: 1 needs: - 'fedora:rawhide@container-prep' t_fedora:38:autotools shared expat: extends: - - .build autotools shared expat + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '38' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: shared + FC_XML_BACKEND: expat needs: - 'fedora:38@container-prep' t_fedora:38:autotools shared libxml2: extends: - - .build autotools shared libxml2 + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '38' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + FC_BUILD_DISTCHECK: 1 needs: - 'fedora:38@container-prep' t_fedora:38:autotools static expat: extends: - - .build autotools static expat + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '38' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat needs: - 'fedora:38@container-prep' t_fedora:38:autotools static libxml2: extends: - - .build autotools static libxml2 + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '38' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 needs: - 'fedora:38@container-prep' -t_fedora:38:meson shared: +t_fedora:38:mingw autotools static libxml2: extends: - - .build meson shared + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '38' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 + FC_BUILD_PLATFORM: mingw + FC_BUILD_ARCH: x86_64-mingw32 needs: - 'fedora:38@container-prep' -t_fedora:38:meson static: +t_fedora:38:meson shared expat: extends: - - .build meson static + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '38' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: expat + needs: + - 'fedora:38@container-prep' + + +t_fedora:38:meson static expat: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .fc_artifacts + variables: + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: '38' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat + needs: + - 'fedora:38@container-prep' + + +t_fedora:38:mingw meson static expat: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .fc_artifacts + variables: + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: '38' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat + FC_BUILD_PLATFORM: mingw + FC_BUILD_ARCH: linux-mingw-w64-64bit + FC_BUILD_NO_INSTALL: 1 needs: - 'fedora:38@container-prep' t_fedora:37:autotools shared expat: extends: - - .build autotools shared expat + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: shared + FC_XML_BACKEND: expat needs: - 'fedora:37@container-prep' t_fedora:37:autotools shared libxml2: extends: - - .build autotools shared libxml2 + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + FC_BUILD_DISTCHECK: 1 needs: - 'fedora:37@container-prep' t_fedora:37:autotools static expat: extends: - - .build autotools static expat + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat needs: - 'fedora:37@container-prep' t_fedora:37:autotools static libxml2: extends: - - .build autotools static libxml2 + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 needs: - 'fedora:37@container-prep' -t_fedora:37:meson shared: +t_fedora:37:mingw autotools static libxml2: extends: - - .build meson shared + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 + FC_BUILD_PLATFORM: mingw + FC_BUILD_ARCH: x86_64-mingw32 needs: - 'fedora:37@container-prep' -t_fedora:37:meson static: +t_fedora:37:meson shared expat: extends: - - .build meson static + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: + FC_DISTRO_NAME: fedora FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: expat needs: - 'fedora:37@container-prep' -t_fedora:36:autotools shared expat: +t_fedora:37:meson static expat: extends: - - .build autotools shared expat + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: - FDO_DISTRIBUTION_VERSION: '36' + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat needs: - - 'fedora:36@container-prep' + - 'fedora:37@container-prep' -t_fedora:36:autotools shared libxml2: +t_fedora:37:mingw meson static expat: extends: - - .build autotools shared libxml2 + - .build@template - .fdo.distribution-image@fedora - .fc_artifacts variables: - FDO_DISTRIBUTION_VERSION: '36' + FC_DISTRO_NAME: fedora + FDO_DISTRIBUTION_VERSION: '37' FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat + FC_BUILD_PLATFORM: mingw + FC_BUILD_ARCH: linux-mingw-w64-64bit + FC_BUILD_NO_INSTALL: 1 needs: - - 'fedora:36@container-prep' + - 'fedora:37@container-prep' -t_fedora:36:autotools static expat: - extends: - - .build autotools static expat - - .fdo.distribution-image@fedora - - .fc_artifacts - variables: - FDO_DISTRIBUTION_VERSION: '36' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - needs: - - 'fedora:36@container-prep' - - -t_fedora:36:autotools static libxml2: - extends: - - .build autotools static libxml2 - - .fdo.distribution-image@fedora - - .fc_artifacts - variables: - FDO_DISTRIBUTION_VERSION: '36' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - needs: - - 'fedora:36@container-prep' - - -t_fedora:36:meson shared: - extends: - - .build meson shared - - .fdo.distribution-image@fedora - - .fc_artifacts - variables: - FDO_DISTRIBUTION_VERSION: '36' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - needs: - - 'fedora:36@container-prep' - - -t_fedora:36:meson static: - extends: - - .build meson static - - .fdo.distribution-image@fedora - - .fc_artifacts - variables: - FDO_DISTRIBUTION_VERSION: '36' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - needs: - - 'fedora:36@container-prep' - diff --git a/.gitlab-ci/.gitignore b/.gitlab-ci/.gitignore new file mode 100644 index 0000000..aeaec0f --- /dev/null +++ b/.gitlab-ci/.gitignore @@ -0,0 +1 @@ +/*~ diff --git a/.gitlab-ci/build.sh b/.gitlab-ci/build.sh new file mode 100755 index 0000000..7c3c47b --- /dev/null +++ b/.gitlab-ci/build.sh @@ -0,0 +1,132 @@ +#! /bin/bash + +set -ex +set -o pipefail + +case "$OSTYPE" in + msys) MyPWD=$(pwd -W) ;; + *) MyPWD=$(pwd) ;; +esac +enable=() +disable=() +distcheck=0 +enable_install=1 +cross=0 +buildsys="autotools" +type="both" +arch="" +buildopt=() +SRCDIR=$MyPWD +export BUILD_ID=${BUILD_ID:-fontconfig-$$} +export PREFIX=${PREFIX:-$MyPWD/prefix} +export BUILDDIR=${BUILDDIR:-$MyPWD/build} + +while getopts a:ce:d:hIs:t:X: OPT +do + case $OPT in + 'a') arch=$OPTARG ;; + 'c') distcheck=1 ;; + 'e') enable+=($OPTARG) ;; + 'd') disable+=($OPTARG) ;; + 'I') enable_install=0 ;; + 's') buildsys=$OPTARG ;; + 't') type=$OPTARG ;; + 'X') backend=$OPTARG ;; + 'h') + echo "Usage: $0 [-a ARCH] [-c] [-e OPT] [-d OPT] [-I] [-s BUILDSYS] [-t BUILDTYPE] [-X XMLBACKEND]" + exit 1 + ;; + esac +done +case x"$FC_BUILD_PLATFORM" in + 'xmingw') cross=1 ;; + *) cross=0 ;; +esac + +env +r=0 + +if [ x"$buildsys" == "xautotools" ]; then + for i in "${enable[@]}"; do + buildopt+=(--enable-$i) + done + for i in "${disable[@]}"; do + buildopt+=(--disable-$i) + done + case x"$backend" in + 'xexpat') + buildopt+=(--disable-libxml2) + ;; + 'xlibxml2') + buildopt+=(--enable-libxml2) + ;; + esac + case x"$type" in + 'xshared') + buildopt+=(--enable-shared) + buildopt+=(--disable-static) + ;; + 'xstatic') + buildopt+=(--disable-shared) + buildopt+=(--enable-static) + ;; + 'both') + buildopt+=(--enable-shared) + buildopt+=(--enable-static) + ;; + esac + if [ $cross -eq 1 -a -z "$arch" ]; then + buildopt+=(--host=$arch) + if [ -f .gitlab-ci/${FC_DISTRO_NAME}-cross.sh ]; then + echo "No ${FC_DISTRO_NAME}-cross.sh available" + exit 1 + fi + . .gitlab-ci/${FC_DISTRO_NAME}-cross.sh + fi + rm -rf "$BUILDDIR" "$PREFIX" || : + mkdir "$BUILDDIR" "$PREFIX" + cd "$BUILDDIR" + ../autogen.sh --prefix="$PREFIX" ${buildopt[*]} 2>&1 | tee /tmp/fc-build.log || r=$? + make V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? + make check V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? + if [ $enable_install -eq 1 ]; then + make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? + fi + if [ $distcheck -eq 1 ]; then + make distcheck V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? + fi +elif [ x"$buildsys" == "xmeson" ]; then + for i in "${enable[@]}"; do + buildopt+=(-D$i=true) + done + for i in "${disable[@]}"; do + buildopt+=(-D$i=false) + done + case x"$backend" in + 'xexpat') + ;; + 'xlibxml2') + ;; + esac + if [ $cross -eq 1 -a -z "$arch" ]; then + buildopt+=(--cross-file) + buildopt+=(.gitlab-ci/$arch.txt) + if [ -f .gitlab-ci/cross-$FC_DISTRO_NAME.sh ]; then + echo "No cross-$FC_DISTRO_NAME.sh available" + exit 1 + fi + . .gitlab-ci/cross-$FC_DISTRO_NAME.sh + fi + buildopt+=(--default-library=$type) + meson setup --prefix="$PREFIX" ${buildopt[*]} "$BUILDDIR" 2>&1 | tee /tmp/fc-build.log || r=$? + meson compile -v -C "$BUILDDIR" 2>&1 | tee -a /tmp/fc-build.log || r=$? + meson test -v -C "$BUILDDIR" 2>&1 | tee -a /tmp/fc-build.log || r=$? + if [ $enable_install -eq 1 ]; then + meson install -C "$BUILDDIR" 2>&1 | tee -a /tmp/fc-build.log || r=$? + fi + if [ $distcheck -eq 1 ]; then + meson dist -C "$BUILDDIR" 2>&1 | tee -a /tmp/fc-build.log || r=$? + fi +fi +mv /tmp/fc-build.log . || : +exit $r diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index 2166175..43572db 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -24,6 +24,7 @@ include: - project: 'freedesktop/ci-templates' ref: *template_sha file: '/templates/ci-fairy.yml' + - local: '.gitlab-ci/other.yml' stages: - prep @@ -61,8 +62,7 @@ variables: {% for version in distro.versions %} {{distro.name}}:{{version}}@container-prep: - extends: - - .fdo.container-build@{{distro.name}} + extends: .fdo.container-build@{{distro.name}} stage: prep variables: GIT_STRATEGY: none @@ -126,72 +126,7 @@ variables: # # ####################################### -.build autotools shared expat: - stage: test - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - mkdir "$BUILDDIR" "$PREFIX" - - cd "$BUILDDIR" - - env - - r=0 - - ../autogen.sh --prefix="$PREFIX" --enable-shared --disable-static --disable-libxml2 2>&1 | tee /tmp/fc-build.log || r=$? - - make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - make distcheck V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build autotools shared libxml2: - stage: test - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - mkdir "$BUILDDIR" "$PREFIX" - - cd "$BUILDDIR" - - env - - r=0 - - ../autogen.sh --prefix="$PREFIX" --enable-shared --disable-static --enable-libxml2 2>&1 | tee /tmp/fc-build.log || r=$? - - make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - make distcheck V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build autotools static expat: - stage: test - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - mkdir "$BUILDDIR" "$PREFIX" - - cd "$BUILDDIR" - - env - - r=0 - - ../autogen.sh --prefix="$PREFIX" --disable-shared --enable-static --disable-libxml2 2>&1 | tee /tmp/fc-build.log || r=$? - - make check V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build autotools static libxml2: - stage: test - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - mkdir "$BUILDDIR" "$PREFIX" - - cd "$BUILDDIR" - - env - - r=0 - - ../autogen.sh --prefix="$PREFIX" --disable-shared --enable-static --enable-libxml2 2>&1 | tee /tmp/fc-build.log || r=$? - - make check V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - make install V=1 2>&1 | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build meson shared: - stage: test +.build@template: before_script: - pip install meson script: @@ -199,32 +134,28 @@ variables: - export PREFIX="$(pwd)/prefix-$BUILD_ID" - export BUILDDIR="$(pwd)/build-$BUILD_ID" - export MAKEFLAGS="-j4" - - env - - r=0 - - meson --prefix="$PREFIX" --default-library=shared "$BUILDDIR" 2>&1 | tee /tmp/fc-build.log || r=$? - - meson compile -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson test -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson install -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson dist -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r -.build meson static: - stage: test - before_script: - - pip install meson - script: - - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" - - export PREFIX="$(pwd)/prefix-$BUILD_ID" - - export BUILDDIR="$(pwd)/build-$BUILD_ID" - - export MAKEFLAGS="-j4" - - env - - r=0 - - meson --prefix="$PREFIX" --default-library=static "$BUILDDIR" 2>&1 | tee /tmp/fc-build.log || r=$? - - meson compile -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson test -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - meson install -v -C "$BUILDDIR" | tee -a /tmp/fc-build.log || r=$? - - mv /tmp/fc-build.log . - - exit $r + - | + buildopt=() + for bo in $FC_BUILD_ENABLED; do + buildopt+=(-e $bo) + done + for bo in $FC_BUILD_DISABLED; do + buildopt+=(-d $bo) + done + [ -n "$FC_BUILD_ARCH" ] && buildopt+=(-a $FC_BUILD_ARCH) + [ $FC_BUILD_DISTCHECK -eq 1 ] && buildopt+=(-c) + [ $FC_BUILD_NO_INSTALL -eq 1 ] && buildopt+=(-I) + buildopt+=(-s $FC_BUILDSYS) + buildopt+=(-t $FC_BUILD_TYPE) + buildopt+=(-X $FC_XML_BACKEND) + sh .gitlab-ci/build.sh ${buildopt[*]} + variables: + FC_BUILDSYS: autotools + FC_XML_BACKEND: expat + FC_BUILD_TYPE: both + FC_BUILD_DISTCHECK: 0 + FC_BUILD_NO_INSTALL: 0 + .fc_artifacts: artifacts: name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID @@ -243,20 +174,21 @@ variables: {% for distro in distributions %} {% for version in distro.versions %} -{% for bs in distro.buildsys %} +{% for build in distro.builds %} -t_{{distro.name}}:{{version}}:{{bs}}: +t_{{distro.name}}:{{version}}:{{build.name}}: extends: - - .build {{bs}} + - .build@template - .fdo.distribution-image@{{distro.name}} - .fc_artifacts variables: + FC_DISTRO_NAME: {{distro.name}} FDO_DISTRIBUTION_VERSION: '{{version}}' FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_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}} + {% if build.variables is defined %} + {% for key, value in build.variables.items() %} + {{key}}: {{value}} {% endfor %} {% endif %} needs: @@ -265,3 +197,4 @@ t_{{distro.name}}:{{version}}:{{bs}}: {% endfor %} {% endfor %} {% endfor %} + diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index cf1ae0f..6ddd5bf 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -8,14 +8,53 @@ distributions: - "rawhide" - "38" - "37" - - "36" - buildsys: - - "autotools shared expat" - - "autotools shared libxml2" - - "autotools static expat" - - "autotools static libxml2" - - "meson shared" - - "meson static" + builds: + - name: "autotools shared expat" + variables: + FC_BUILDSYS: autotools + FC_BUILD_TYPE: shared + FC_XML_BACKEND: expat + - name: "autotools shared libxml2" + variables: + FC_BUILDSYS: autotools + FC_BUILD_TYPE: shared + FC_XML_BACKEND: libxml2 + FC_BUILD_DISTCHECK: 1 + - name: "autotools static expat" + variables: + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat + - name: "autotools static libxml2" + variables: + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 + - name: "mingw autotools static libxml2" + variables: + FC_BUILDSYS: autotools + FC_BUILD_TYPE: static + FC_XML_BACKEND: libxml2 + FC_BUILD_PLATFORM: mingw + FC_BUILD_ARCH: x86_64-mingw32 + - name: "meson shared expat" + variables: + FC_BUILDSYS: meson + FC_BUILD_TYPE: shared + FC_XML_BACKEND: expat + - name: "meson static expat" + variables: + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat + - name: "mingw meson static expat" + variables: + FC_BUILDSYS: meson + FC_BUILD_TYPE: static + FC_XML_BACKEND: expat + FC_BUILD_PLATFORM: mingw + FC_BUILD_ARCH: linux-mingw-w64-64bit + FC_BUILD_NO_INSTALL: 1 packages: fedora: @@ -39,5 +78,9 @@ packages: "ninja-build", "wget", "python3-pip", + "mingw64-gettext", + "mingw64-freetype", + "mingw64-libxml2", + "wine", ] use_qemu: false diff --git a/.gitlab-ci/fedora-cross.sh b/.gitlab-ci/fedora-cross.sh new file mode 100644 index 0000000..27cd003 --- /dev/null +++ b/.gitlab-ci/fedora-cross.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +eval `rpm --eval %{mingw64_env}` diff --git a/.gitlab-ci/other.yml b/.gitlab-ci/other.yml new file mode 100644 index 0000000..42caf1c --- /dev/null +++ b/.gitlab-ci/other.yml @@ -0,0 +1,142 @@ +# FIXME: fontconfig should probably get its own image +# In the meantime, the latest GStreamer image tag can be found here: +# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/.gitlab-image-tags.yml#L10 +.build meson windows: + image: "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2022-09-23.0-main" + stage: "test" + tags: + - "docker" + - "windows" + - "2022" + variables: + # Make sure any failure in PowerShell scripts is fatal + ErrorActionPreference: "Stop" + WarningPreference: "Stop" + # Uncomment the following key if need to pass custom args, as well with the + # $env:MESON_ARGS line in the `script:` blocks + # MESON_ARGS: >- + # -Dfoo=enabled + # -Dbar=disabled + before_script: + # Make sure meson is up to date, so we don't need to rebuild the image with each release + - pip3 install -U meson certifi + script: + # For some reason, options are separated by newline instead of space, so we + # have to replace them first. + # - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ") + # Gitlab executes PowerShell in docker, but VsDevCmd.bat is a batch script. + # Environment variables substitutions is done by PowerShell before calling + # cmd.exe, that's why we use $env:FOO instead of %FOO% + - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH && + SET CERT_PATH=$(python -m certifi) && + SET SSL_CERT_FILE=$(python -m certifi) && + SET REQUESTS_CA_BUNDLE=$(python -m certifi) && + meson build $env:MESON_ARGS && + ninja -C build && + ninja -C build test" + artifacts: + name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID + when: always + paths: + - build-*/meson-logs/*txt + - prefix-* + +meson vs2019 amd64: + extends: ".build meson windows" + variables: + ARCH: "amd64" + +meson vs2019 x86: + extends: ".build meson windows" + variables: + ARCH: "x86" + +meson macos: + stage: "test" + tags: + - gst-macos-11.1 + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" + expire_in: "5 days" + when: "always" + paths: + - "build/meson-logs/*txt" + before_script: + - pip3 install --upgrade pip + # Make sure meson is up to date + - pip3 install -U meson + # Need to install certificates for python + - pip3 install --upgrade certifi + # Anther way t install certificates + - open /Applications/Python\ 3.8/Install\ Certificates.command + # Get ninja + - curl -L -o ninja-mac.zip https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-mac.zip + - unzip ninja-mac.zip + - sudo cp ninja /usr/local/bin + script: + - CERT_PATH=$(python3 -m certifi) && export SSL_CERT_FILE=${CERT_PATH} && export REQUESTS_CA_BUNDLE=${CERT_PATH} && meson build + - ninja -C build + - ninja -C build test + +# msys infrastructure is a bit broken, disable for now +meson msys2: + extends: ".build meson windows" + when: "manual" + allow_failure: true + script: + # For some reason, options are separated by newline instead of space, so we + # have to replace them first. + # - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ") + + - $env:PATH += ";C:\msys64\usr\bin;C:\msys64\mingw64/bin;C:\msys64\mingw32/bin" + # XXX: Copied from https://gitlab.freedesktop.org/gstreamer/gst-ci/blob/master/gitlab/ci_template.yml#L487 + # For some reason docker build hangs if this is included in the image, needs more troubleshooting + - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true" + - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm" + - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja" + - C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS && + ninja -C build && + ninja -C build test" + +meson android arm64 fedora: + # See https://gitlab.freedesktop.org/gstreamer/gst-ci/container_registry/164 for current images + image: "registry.freedesktop.org/gstreamer/gst-ci/amd64/android-fedora:2020-10-22.0-master" + stage: "test" + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" + expire_in: "5 days" + when: "always" + paths: + - "build/meson-logs/*.txt" + before_script: + - dnf install -y python3-pip gcc ninja-build gperf + - pip3 install --user meson + script: + - export PATH="$HOME/.local/bin:$PATH" + - | + cat > android-cross-file.txt <