pixman: Branch 'master' - 4 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 20 16:09:49 UTC 2024


 .gitlab-ci.d/01-docker.yml                 |   75 ++++++++++++++
 .gitlab-ci.d/01-docker/Dockerfile          |   39 +++++++
 .gitlab-ci.d/01-docker/platform-lookup.awk |    3 
 .gitlab-ci.d/01-docker/platform.lut        |    9 +
 .gitlab-ci.d/02-build.yml                  |   78 ++++++++++++++
 .gitlab-ci.d/03-test.yml                   |  143 +++++++++++++++++++++++++++
 .gitlab-ci.d/04-summary.yml                |   34 ++++++
 .gitlab-ci.d/pixman-project.yml            |   65 ++++++++++++
 .gitlab-ci.d/platform-templates.yml        |  152 +++++++++++++++++++++++++++++
 .gitlab-ci.yml                             |   31 ++---
 meson.build                                |    2 
 pixman/pixman-mips.c                       |   13 ++
 12 files changed, 627 insertions(+), 17 deletions(-)

New commits:
commit e7ef051a6d9edd2d8bd84fe2fda3ca54ba83d1c8
Author: Marek Pikuła <m.pikula at partner.samsung.com>
Date:   Wed Jul 31 14:33:35 2024 +0200

    ci: Build and test on the supported platforms
    
    This commit introduces a build and test CI workflow, which tests the
    correctness of execution for nearly all configurations supported by
    pixman. The notable exception is ARM iWMMXt, which is omitted as it's
    soon to be deprecated as mentioned in #98.
    
    The build and test stage is separated, as a single build can be used to
    test multiple configurations for a given platform (e.g., MMX, SSE2,
    SSSE3 for x86).
    
    Execution is performed using multi-arch Docker images built in the
    `docker` stage. The important thing to note is that the runner needs to
    have a relatively recent version of Docker and QEMU, and needs to have
    the qemu-user-static+binfmt execution enabled.
    
    Once all tests are complete, coverage reports are merged together in the
    `summary` stage. Then the result can be used in a GitLab-native coverage
    report summary.
    
    Signed-off-by: Marek Pikuła <m.pikula at partner.samsung.com>

diff --git a/.gitlab-ci.d/02-build.yml b/.gitlab-ci.d/02-build.yml
new file mode 100644
index 0000000..46f89f9
--- /dev/null
+++ b/.gitlab-ci.d/02-build.yml
@@ -0,0 +1,78 @@
+# Build stage
+#
+# This stage builds pixman with enabled coverage for all supported
+# architectures.
+#
+# Some targets don't support atomic profile update, so to decrease the number of
+# gcov errors, they need to be built without OpenMP (single threaded) by adding
+# `-Dopenmp=disabled` Meson argument.
+
+variables:
+  # Used in test stage as well.
+  BUILD_DIR: build
+
+.build:linux:
+  stage: build
+  variables:
+    MESON_ARGS: ""
+    EXTRA_C_ARGS: ""
+  script:
+    - meson setup ${BUILD_DIR}
+        -Db_coverage=true
+        -Dc_args="-fprofile-update=atomic -DCI_HAS_ALL_MIPS_CPU_FEATURES ${EXTRA_C_ARGS}"
+        ${MESON_ARGS}
+    - meson compile -C ${BUILD_DIR}
+  artifacts:
+    paths:
+      - ${BUILD_DIR}/
+
+build:linux:386:
+  extends:
+    - .build:linux
+    - .platform:linux:386
+
+build:linux:amd64:
+  extends:
+    - .build:linux
+    - .platform:linux:amd64
+
+build:linux:arm:v5:
+  extends:
+    - .build:linux
+    - .platform:linux:arm:v5
+  variables:
+    MESON_ARGS: -Dopenmp=disabled
+
+build:linux:arm:v7:
+  extends:
+    - .build:linux
+    - .platform:linux:arm:v7
+
+build:linux:arm64:v8:
+  extends:
+    - .build:linux
+    - .platform:linux:arm64:v8
+
+build:linux:mips64el:
+  extends:
+    - .build:linux
+    - .platform:linux:mips64el
+
+build:linux:mipsel:
+  extends:
+    - .build:linux
+    - .platform:linux:mipsel
+  variables:
+    MESON_ARGS: -Dopenmp=disabled
+
+build:linux:ppc64le:
+  extends:
+    - .build:linux
+    - .platform:linux:ppc64le
+
+build:linux:riscv64:
+  extends:
+    - .build:linux
+    - .platform:linux:riscv64
+  variables:
+    EXTRA_C_ARGS: "-march=rv64gcv"
diff --git a/.gitlab-ci.d/03-test.yml b/.gitlab-ci.d/03-test.yml
new file mode 100644
index 0000000..ba4ce54
--- /dev/null
+++ b/.gitlab-ci.d/03-test.yml
@@ -0,0 +1,143 @@
+# Test stage
+#
+# This stage executes the test suite for pixman for all architectures in
+# different configurations. Build and test is split, as some architectures can
+# have different QEMU configuration or have multiple supported pixman backends,
+# which are executed as job matrix.
+#
+# Mind that `PIXMAN_ENABLE` variable in matrix runs does nothing, but it looks
+# better in CI to indicate what is actually being tested.
+#
+# Some emulated targets are really slow or cannot be run in multithreaded mode
+# (e.g., arm:v5), thus it's required to increase the timeout for them.
+#
+# Some jobs have `--gcov-ignore-parse-errors`, and `MESON_TESTTHREADS=1`
+# specified. It prevents gcovr failing in case of negative counter warning for
+# platforms which don't support atomic profile update. Because of that, some
+# results might be not 100% correct but, still, it's better to include them in
+# the final coverage report, as it's not really important how many times given
+# line is hit, but that it's hit at all.
+
+variables:
+  # Used in summary stage as well.
+  COVERAGE_OUT_DIR: ${BUILD_DIR}/coverage
+  COVERAGE_HTML_OUT_DIR: ${COVERAGE_OUT_DIR}/html
+
+.test:linux:
+  stage: test
+  variables:
+    TEST_TIMEOUT_MULTIPLIER: 20
+    TEST_NAME: ""  # Allow to specify a set of tests to run with run variables.
+  script:
+    - mkdir -p ${COVERAGE_OUT_DIR} ${COVERAGE_HTML_OUT_DIR}
+    - meson test -C ${BUILD_DIR} -t ${TEST_TIMEOUT_MULTIPLIER}
+        --no-rebuild ${TEST_NAME}
+  after_script:
+    - gcovr ${QCOVR_FLAGS} -r ./ ${BUILD_DIR} -e ./subprojects
+        --json ${COVERAGE_OUT_DIR}/coverage-${CI_JOB_ID}.json
+        --html-details ${COVERAGE_HTML_OUT_DIR}/coverage.html
+        --print-summary
+  artifacts:
+    paths:
+      - ${COVERAGE_OUT_DIR}/
+    reports:
+      junit: ${BUILD_DIR}/meson-logs/testlog.junit.xml
+
+test:linux:386:
+  extends:
+    - .test:linux
+    - .platform:linux:386
+  needs:
+    - build:linux:386
+  parallel:
+    matrix:
+      - PIXMAN_ENABLE: ["mmx"]
+        PIXMAN_DISABLE: ["sse2 ssse3"]
+      - PIXMAN_ENABLE: ["sse2"]
+        PIXMAN_DISABLE: ["mmx ssse3"]
+      - PIXMAN_ENABLE: ["ssse3"]
+        PIXMAN_DISABLE: ["mmx sse2"]
+
+test:linux:amd64:
+  extends:
+    - .test:linux
+    - .platform:linux:amd64
+  needs:
+    - build:linux:amd64
+  parallel:
+    matrix:
+      - PIXMAN_DISABLE:
+        - ""
+        - "fast"
+        - "wholeops"
+
+test:linux:arm:v5:
+  extends:
+    - .test:linux
+    - .platform:linux:arm:v5
+  needs:
+    - build:linux:arm:v5
+  timeout: 3h
+  variables:
+    TEST_TIMEOUT_MULTIPLIER: 40
+    PIXMAN_DISABLE: "arm-neon arm-iwmmxt"  # Test only arm-simd.
+    MESON_TESTTHREADS: 1
+    QCOVR_FLAGS: --gcov-ignore-parse-errors
+
+test:linux:arm:v7:
+  extends:
+    - .test:linux
+    - .platform:linux:arm:v7
+  needs:
+    - build:linux:arm:v7
+
+test:linux:arm64:v8:
+  extends:
+    - .test:linux
+    - .platform:linux:arm64:v8
+  needs:
+    - build:linux:arm64:v8
+
+test:linux:mips64el:
+  extends:
+    - .test:linux
+    - .platform:linux:mips64el
+  needs:
+    - build:linux:mips64el
+  variables:
+    # Testing only loongson-mmi. Needs to be explicitly disabled due to
+    # CI_HAS_ALL_MIPS_CPU_FEATURES.
+    PIXMAN_DISABLE: "mips-dspr2"
+
+test:linux:mipsel:
+  extends:
+    - .test:linux
+    - .platform:linux:mipsel
+  needs:
+    - build:linux:mipsel
+  timeout: 2h
+  variables:
+    MESON_TESTTHREADS: 1
+    QCOVR_FLAGS: --gcov-ignore-parse-errors
+
+test:linux:ppc64le:
+  extends:
+    - .test:linux
+    - .platform:linux:ppc64le
+  needs:
+    - build:linux:ppc64le
+
+test:linux:riscv64:
+  extends:
+    - .test:linux
+    - .platform:linux:riscv64
+  needs:
+    - build:linux:riscv64
+  parallel:
+    matrix:
+      # Test correctness for different VLENs.
+      - QEMU_CPU:
+          - rv64,v=true,vext_spec=v1.0,vlen=128,elen=64
+          - rv64,v=true,vext_spec=v1.0,vlen=256,elen=64
+          - rv64,v=true,vext_spec=v1.0,vlen=512,elen=64
+          - rv64,v=true,vext_spec=v1.0,vlen=1024,elen=64
diff --git a/.gitlab-ci.d/04-summary.yml b/.gitlab-ci.d/04-summary.yml
new file mode 100644
index 0000000..3c88314
--- /dev/null
+++ b/.gitlab-ci.d/04-summary.yml
@@ -0,0 +1,34 @@
+# Summary stage
+#
+# This stage takes coverage reports from test runs for all architectures, and
+# merges it into a single report, with GitLab visualization. There is also an
+# HTML report generated as a separate artifact.
+
+summary:
+  stage: summary
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-amd64
+    docker:
+      platform: linux/amd64
+  script:
+    - echo "Input coverage reports:" && ls ${COVERAGE_OUT_DIR}/coverage-*.json
+    - |
+      args=( )
+      for f in ${COVERAGE_OUT_DIR}/coverage-*.json; do
+        args+=( "-a" "$f" )
+      done
+    # Recreate the output directory, so that new artifacts don't mix with
+    # arch-specific HTML outputs.
+    - rm -fr ${COVERAGE_HTML_OUT_DIR} && mkdir -p ${COVERAGE_HTML_OUT_DIR}
+    - gcovr "${args[@]}"
+        --cobertura-pretty --cobertura ${COVERAGE_OUT_DIR}/coverage.xml
+        --html-details ${COVERAGE_HTML_OUT_DIR}/coverage.html
+        --txt --print-summary
+  coverage: '/^TOTAL.*\s+(\d+\%)$/'
+  artifacts:
+    reports:
+      coverage_report:
+        coverage_format: cobertura
+        path: ${COVERAGE_OUT_DIR}/coverage.xml
+    paths:
+      - ${COVERAGE_OUT_DIR}/
diff --git a/.gitlab-ci.d/pixman-project.yml b/.gitlab-ci.d/pixman-project.yml
index 183245d..06115f0 100644
--- a/.gitlab-ci.d/pixman-project.yml
+++ b/.gitlab-ci.d/pixman-project.yml
@@ -3,6 +3,9 @@
 
 stages:
   - docker
+  - build
+  - test
+  - summary
 
 variables:
   # Make it possible to change RUNNER_TAG from GitLab variables. The default
@@ -13,6 +16,17 @@ variables:
   DOCKER_TAG: latest
   DOCKER_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/pixman:${DOCKER_TAG}
 
+  # Enable/disable specific platforms.
+  PLATFORM_LINUX_386: true
+  PLATFORM_LINUX_AMD64: true
+  PLATFORM_LINUX_ARM_V5: true
+  PLATFORM_LINUX_ARM_V7: true
+  PLATFORM_LINUX_ARM64_V8: true
+  PLATFORM_LINUX_MIPS64EL: true
+  PLATFORM_LINUX_MIPSEL: true
+  PLATFORM_LINUX_PPC64LE: true
+  PLATFORM_LINUX_RISCV64: true
+
 workflow:
   rules:
     # Use modified Docker image if building in MR and Docker image is affected
@@ -44,4 +58,8 @@ default:
   retry: 1
 
 include:
+  - local: "/.gitlab-ci.d/platform-templates.yml"
   - local: "/.gitlab-ci.d/01-docker.yml"
+  - local: "/.gitlab-ci.d/02-build.yml"
+  - local: "/.gitlab-ci.d/03-test.yml"
+  - local: "/.gitlab-ci.d/04-summary.yml"
diff --git a/.gitlab-ci.d/platform-templates.yml b/.gitlab-ci.d/platform-templates.yml
new file mode 100644
index 0000000..908b6fd
--- /dev/null
+++ b/.gitlab-ci.d/platform-templates.yml
@@ -0,0 +1,152 @@
+# Platform templates
+#
+# Used to provide base for multi-arch runs. Each platform can be globally
+# disabled with `PLATFORM_LINUX_...` variable. Some targets have pre-defined
+# `QEMU_CPU`, which is either the only or the default QEMU configuration for a
+# given platform.
+
+# i386 is used for `mmx`, `sse2` and `ssse3` backend tests.
+.platform:linux:386:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/386
+  rules:
+    - if: $PLATFORM_LINUX_386 == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-386
+    docker:
+      platform: linux/386
+
+# amd64 is used for general tests.
+.platform:linux:amd64:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/amd64
+  rules:
+    - if: $PLATFORM_LINUX_AMD64 == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-amd64
+    docker:
+      platform: linux/amd64
+
+# ARMv5 is used for `arm-simd` test.
+.platform:linux:arm:v5:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/arm/v5
+  rules:
+    - if: $PLATFORM_LINUX_ARM_V5 == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-arm-v5
+    docker:
+      platform: linux/arm/v5
+  variables:
+    # It is in fact an ARMv6 CPU, which is required for SIMD to get discovered
+    # on runtime.
+    QEMU_CPU: arm1136
+
+# ARMv7 is used for ARMv7 variant of `arm-neon`.
+.platform:linux:arm:v7:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/arm/v7
+  rules:
+    - if: $PLATFORM_LINUX_ARM_V7 == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-arm-v7
+    docker:
+      platform: linux/arm/v7
+
+# ARM64v8 is used for `arm-neon`.
+.platform:linux:arm64:v8:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/arm64/v8
+  rules:
+    - if: $PLATFORM_LINUX_ARM64_V8 == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-arm64-v8
+    docker:
+      platform: linux/arm64/v8
+
+# MIPS64EL used for `loongson-mmi`.
+.platform:linux:mips64el:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/mips64el
+  rules:
+    - if: $PLATFORM_LINUX_MIPS64EL == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-mips64el
+    docker:
+      platform: linux/mips64el
+  variables:
+    QEMU_CPU: "Loongson-3A4000"
+
+# MIPS (32 bit, little endian) is used for `mips-dspr2`.
+.platform:linux:mipsel:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/mipsel
+  rules:
+    - if: $PLATFORM_LINUX_MIPSEL == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-mipsel
+    docker:
+      platform: linux/mipsel
+  variables:
+    # As written in the code comment, it's the only supported CPU.
+    QEMU_CPU: 74Kf
+
+# PPC64LE used for `vmx`.
+.platform:linux:ppc64le:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/ppc64le
+  rules:
+    - if: $PLATFORM_LINUX_PPC64LE == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-ppc64le
+    docker:
+      platform: linux/ppc64le
+
+# RISCV64 used for `rvv`.
+.platform:linux:riscv64:
+  needs:
+    - job: docker-pixman
+      optional: true
+      parallel:
+        matrix:
+          - PLATFORM: linux/riscv64
+  rules:
+    - if: $PLATFORM_LINUX_RISCV64 == "true"
+  image:
+    name: $DOCKER_IMAGE_NAME-linux-riscv64
+    docker:
+      platform: linux/riscv64
+  variables:
+    QEMU_CPU: rv64,v=true,vext_spec=v1.0,vlen=256,elen=64
commit 2d35a8769c8b84e38eafb23bccb89d40f1d707cf
Author: Marek Pikuła <m.pikula at partner.samsung.com>
Date:   Tue Aug 6 19:27:04 2024 +0200

    mips: Add option to force MIPS CPU feature discovery
    
    Used to force feature discovery in CI where /proc/cpuinfo is unreliable.
    It can happen, e.g., if executed in qemu-user-static mode.
    
    For such a build, MIPS-specific features need to be manually disabled by
    using `PIXMAN_DISABLE` env variable.
    
    Signed-off-by: Marek Pikuła <m.pikula at partner.samsung.com>

diff --git a/pixman/pixman-mips.c b/pixman/pixman-mips.c
index 7479a08..1a9cbef 100644
--- a/pixman/pixman-mips.c
+++ b/pixman/pixman-mips.c
@@ -59,6 +59,19 @@ have_feature (const char *search_string)
     fclose (f);
 #endif
 
+#if defined (CI_HAS_ALL_MIPS_CPU_FEATURES)
+    /* Used to force feature discovery in CI where /proc/cpuinfo is unreliable.
+     * It can happen, e.g., if executed in qemu-user-static mode.
+     *
+     * For such a build, MIPS-specific features need to be manually disabled by
+     * using `PIXMAN_DISABLE` env variable
+     *
+     * SHOULD NOT BE USED IN RELEASE BUILD!
+     */
+    #warning "Building with disabled MIPS feature discovery. SHOULD NOT BE USED IN RELEASE BUILD!"
+    return TRUE;
+#endif
+
     /* Did not find string in the proc file, or not Linux ELF. */
     return FALSE;
 }
commit 15af6fd0bcc52733b13732e895d11dd22a942475
Author: Marek Pikuła <m.pikula at partner.samsung.com>
Date:   Tue Aug 6 18:16:10 2024 +0200

    mips: Widen CPU family check for DSPr2
    
    DSPr2 can be available for targets other than mips32. Some distros
    (e.g., Debian) don't support mips32 but still support mipsel. Extending
    the check enables use of such images for testing.
    
    Signed-off-by: Marek Pikuła <m.pikula at partner.samsung.com>

diff --git a/meson.build b/meson.build
index 7bef570..3b56f4f 100644
--- a/meson.build
+++ b/meson.build
@@ -336,7 +336,7 @@ use_mips_dspr2 = get_option('mips-dspr2')
 have_mips_dspr2 = false
 mips_dspr2_flags = ['-mdspr2']
 if not use_mips_dspr2.disabled()
-  if host_machine.cpu_family() == 'mips32'
+  if host_machine.cpu_family().startswith('mips')
     if cc.compiles('''
         #if !(defined(__mips__) &&  __mips_isa_rev >= 2)
         #error MIPS DSPr2 is currently only available on MIPS32r2 platforms.
commit a7263190c25f31444e00e8671e71eaf23e7af30a
Author: Marek Pikuła <m.pikula at partner.samsung.com>
Date:   Wed Jul 31 14:31:43 2024 +0200

    ci: Add multiarch Docker image build
    
    The image is used in CI pipeline to build and test on different
    architectures.
    
    This commit introduces more extensible GitLab CI scheme borrowed from
    qemu project.
    
    Signed-off-by: Marek Pikuła <m.pikula at partner.samsung.com>

diff --git a/.gitlab-ci.d/01-docker.yml b/.gitlab-ci.d/01-docker.yml
new file mode 100644
index 0000000..a0b67f9
--- /dev/null
+++ b/.gitlab-ci.d/01-docker.yml
@@ -0,0 +1,75 @@
+# Docker build stage
+#
+# It builds a multi-arch image for all required architectures. Each image can be
+# later easily used with properly configured Docker (which uses binfmt and QEMU
+# underneath).
+
+docker-pixman:
+  stage: docker
+  image: quay.io/buildah/stable
+  rules:
+    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+      changes:
+        paths:
+          - .gitlab-ci.d/01-docker.yml
+          - .gitlab-ci.d/01-docker/
+      variables:
+        DOCKER_TAG: $CI_COMMIT_REF_SLUG
+    - if: $CI_PIPELINE_SOURCE == 'schedule'
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - if: $CI_COMMIT_TAG
+
+  variables:
+    # Use vfs with buildah. Docker offers overlayfs as a default, but Buildah
+    # cannot stack overlayfs on top of another overlayfs filesystem.
+    STORAGE_DRIVER: vfs
+
+    # Write all image metadata in the docker format, not the standard OCI
+    # format. Newer versions of docker can handle the OCI format, but older
+    # versions, like the one shipped with Fedora 30, cannot handle the format.
+    BUILDAH_FORMAT: docker
+
+    BUILDAH_ISOLATION: chroot
+    CACHE_IMAGE: ${CI_REGISTRY_IMAGE}/cache
+    CACHE_ARGS: --cache-from ${CACHE_IMAGE} --cache-to ${CACHE_IMAGE}
+
+    PLT_LOOKUP: .gitlab-ci.d/01-docker/platform-lookup.awk
+    PLT_TBL: .gitlab-ci.d/01-docker/platform.lut
+  before_script:
+    # Login to the target registry.
+    - echo "${CI_REGISTRY_PASSWORD}" |
+        buildah login -u "${CI_REGISTRY_USER}" --password-stdin ${CI_REGISTRY}
+
+    # Docker Hub login is optional, and can be used to circumvent image pull
+    # quota for anonymous pulls for base images.
+    - echo "${DOCKERHUB_PASSWORD}" |
+        buildah login -u "${DOCKERHUB_USER}" --password-stdin docker.io ||
+          echo "Failed to login to Docker Hub."
+  parallel:
+    matrix:
+      - PLATFORM:
+        - linux/386
+        - linux/amd64
+        - linux/arm/v5
+        - linux/arm/v7
+        - linux/arm64/v8
+        - linux/mips64el
+        - linux/mipsel
+        - linux/ppc64le
+        - linux/riscv64
+  script:
+    # Prepare environment.
+    - BASE_IMAGE=$(${PLT_LOOKUP} ${PLATFORM} 2 ${PLT_TBL})
+    - BASE_IMAGE_TAG=$(${PLT_LOOKUP} ${PLATFORM} 3 ${PLT_TBL})
+    - FULL_IMAGE_NAME=${DOCKER_IMAGE_NAME}-$(echo ${PLATFORM} | sed "s|/|-|g")
+
+    # Build and push the image.
+    - buildah bud
+        --tag ${FULL_IMAGE_NAME}
+        --layers
+        ${CACHE_ARGS}
+        --platform=${PLATFORM}
+        --build-arg BASE_IMAGE=${BASE_IMAGE}
+        --build-arg BASE_IMAGE_TAG=${BASE_IMAGE_TAG}
+        -f Dockerfile .gitlab-ci.d/01-docker/
+    - buildah push ${FULL_IMAGE_NAME}
diff --git a/.gitlab-ci.d/01-docker/Dockerfile b/.gitlab-ci.d/01-docker/Dockerfile
new file mode 100644
index 0000000..4593750
--- /dev/null
+++ b/.gitlab-ci.d/01-docker/Dockerfile
@@ -0,0 +1,39 @@
+ARG BASE_IMAGE=docker.io/debian
+# Debian Sid is requried for official riscv64 support.
+ARG BASE_IMAGE_TAG=sid-slim
+FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG}
+
+LABEL org.opencontainers.image.title="Pixman build environment" \
+      org.opencontainers.image.authors="Marek Pikuła <m.pikula at partner.samsung.com>"
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update \
+    # Install build dependencies.
+    && apt-get install -y --no-install-recommends \
+        # Build dependencies
+        build-essential \
+        libglib2.0-dev \
+        libgtk-3-dev \
+        libpng-dev \
+        meson \
+        pkg-config \
+        # pipx and gcovr dependencies
+        libxml2-dev \
+        libxslt-dev \
+        python3-argcomplete \
+        python3-dev \
+        python3-packaging \
+        python3-pip \
+        python3-platformdirs \
+        python3-userpath \
+        python3-venv \
+    # Clean up after apt.
+    && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* \
+    # Install pipx using pip to have the more recent version which supports the
+    # `--global` flag.
+    && pip install pipx --break-system-packages \
+    # Install gcovr using pipx to have the same version on all installations.
+    && pipx ensurepath --global \
+    && pipx install --global gcovr \
+    # Check gcovr version.
+    && gcovr --version
diff --git a/.gitlab-ci.d/01-docker/platform-lookup.awk b/.gitlab-ci.d/01-docker/platform-lookup.awk
new file mode 100755
index 0000000..6d679f0
--- /dev/null
+++ b/.gitlab-ci.d/01-docker/platform-lookup.awk
@@ -0,0 +1,3 @@
+#!/usr/bin/awk -f
+BEGIN { key = ARGV[1]; field = ARGV[2]; ARGV[1]=ARGV[2]="" }
+$1 == key { print $field }
diff --git a/.gitlab-ci.d/01-docker/platform.lut b/.gitlab-ci.d/01-docker/platform.lut
new file mode 100644
index 0000000..d55819c
--- /dev/null
+++ b/.gitlab-ci.d/01-docker/platform.lut
@@ -0,0 +1,9 @@
+linux/386       docker.io/i386/debian                       bookworm-slim
+linux/amd64     docker.io/amd64/debian                      bookworm-slim
+linux/arm/v5    docker.io/arm32v5/debian                    bookworm-slim
+linux/arm/v7    docker.io/arm32v7/debian                    bookworm-slim
+linux/arm64/v8  docker.io/arm64v8/debian                    bookworm-slim
+linux/mips64el  docker.io/mips64le/debian                   bookworm-slim
+linux/mipsel    docker.io/serenitycode/debian-debootstrap   mipsel-bookworm-slim    # There is no official mipsel image, thus custom one from debootstrap is used.
+linux/ppc64le   docker.io/ppc64le/debian                    bookworm-slim
+linux/riscv64   docker.io/riscv64/debian                    sid-slim                # There is no bookworm image available for riscv64.
diff --git a/.gitlab-ci.d/pixman-project.yml b/.gitlab-ci.d/pixman-project.yml
new file mode 100644
index 0000000..183245d
--- /dev/null
+++ b/.gitlab-ci.d/pixman-project.yml
@@ -0,0 +1,47 @@
+# This file contains the set of jobs run by the pixman project:
+# https://gitlab.freedesktop.org/pixman/pixman/-/pipelines
+
+stages:
+  - docker
+
+variables:
+  # Make it possible to change RUNNER_TAG from GitLab variables. The default
+  # `kvm` tag has been tested with FDO infrastructure.
+  RUNNER_TAG: kvm
+
+  # Docker image global configuration.
+  DOCKER_TAG: latest
+  DOCKER_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/pixman:${DOCKER_TAG}
+
+workflow:
+  rules:
+    # Use modified Docker image if building in MR and Docker image is affected
+    # by the MR.
+    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+      changes:
+        paths:
+          - .gitlab-ci.d/01-docker.yml
+          - .gitlab-ci.d/01-docker/
+      variables:
+        DOCKER_TAG: $CI_COMMIT_REF_SLUG
+
+    # A standard set of GitLab CI triggers (i.e., MR, schedule, default branch,
+    # and tag).
+    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
+      when: never
+    - if: $CI_PIPELINE_SOURCE == 'schedule'
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - if: $CI_COMMIT_BRANCH
+    - if: $CI_COMMIT_TAG
+
+default:
+  tags:
+    - $RUNNER_TAG
+
+  # Retry in case the runner is misconfigured for multi-arch builds or some
+  # random unexpected runner error occurs (it happened during testing).
+  retry: 1
+
+include:
+  - local: "/.gitlab-ci.d/01-docker.yml"
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3fe0725..e9f7f8c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,17 +1,16 @@
-workflow:
-    rules:
-    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
-    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
-      when: never
-    - if: $CI_COMMIT_BRANCH
+#
+# This is the GitLab CI configuration file for the mainstream pixman project:
+# https://gitlab.freedesktop.org/pixman/pixman/-/pipelines
+#
+# !!! DO NOT ADD ANY NEW CONFIGURATION TO THIS FILE !!!
+#
+# Only documentation or comments is accepted.
+#
+# To use a different set of jobs than the mainstream project, you need to set
+# the location of your custom yml file at "custom CI/CD configuration path", on
+# your GitLab CI namespace:
+# https://docs.gitlab.com/ee/ci/pipelines/settings.html#custom-cicd-configuration-path
+#
 
-image: fedora:39
-
-meson-build:
-    script:
-    - dnf -y install dnf-plugins-core
-    - dnf -y groupinstall buildsys-build
-    - dnf -y builddep pixman
-    - dnf -y install meson
-    - meson setup build
-    - ninja -C build test
+include:
+  - local: '/.gitlab-ci.d/pixman-project.yml'


More information about the xorg-commit mailing list