.gitlab-ci.yml revision 49ef06a4
149ef06a4Smrg# This is the tag of the docker image used for the build jobs. If the
249ef06a4Smrg# image doesn't exist yet, the containers stage generates it.
349ef06a4Smrg#
449ef06a4Smrg# In order to generate a new image, one should generally change the tag.
549ef06a4Smrg# While removing the image from the registry would also work, that's not
649ef06a4Smrg# recommended except for ephemeral images during development: Replacing
749ef06a4Smrg# an image after a significant amount of time might pull in newer
849ef06a4Smrg# versions of gcc/clang or other packages, which might break the build
949ef06a4Smrg# with older commits using the same tag.
1049ef06a4Smrg#
1149ef06a4Smrg# After merging a change resulting in generating a new image to the
1249ef06a4Smrg# main repository, it's recommended to remove the image from the source
1349ef06a4Smrg# repository's container registry, so that the image from the main
1449ef06a4Smrg# repository's registry will be used there as well.
1549ef06a4Smrg.templates_sha: &template_sha 567700e483aabed992d0a4fea84994a0472deff6 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
1649ef06a4Smrg
1749ef06a4Smrginclude:
1849ef06a4Smrg  - project: 'freedesktop/ci-templates'
1949ef06a4Smrg    ref: *template_sha
2049ef06a4Smrg    file:
2149ef06a4Smrg    - '/templates/debian.yml'
2249ef06a4Smrg    - '/templates/freebsd.yml'
2349ef06a4Smrg    - '/templates/ci-fairy.yml'
2449ef06a4Smrg
2549ef06a4Smrgvariables:
2649ef06a4Smrg  FDO_UPSTREAM_REPO: mesa/drm
2749ef06a4Smrg  FDO_REPO_SUFFIX: "$BUILD_OS/$BUILD_ARCH"
2849ef06a4Smrg
2949ef06a4Smrgstages:
3049ef06a4Smrg  - "Base container"
3149ef06a4Smrg  - "Build"
3249ef06a4Smrg
3349ef06a4Smrg.ci-rules:
3449ef06a4Smrg  rules:
3549ef06a4Smrg    - when: on_success
3649ef06a4Smrg
3749ef06a4Smrg# CONTAINERS
3849ef06a4Smrg
3949ef06a4Smrg.os-debian:
4049ef06a4Smrg  variables:
4149ef06a4Smrg    BUILD_OS: debian
4249ef06a4Smrg    FDO_DISTRIBUTION_VERSION: buster
4349ef06a4Smrg    FDO_DISTRIBUTION_PACKAGES: 'build-essential docbook-xsl libatomic-ops-dev libcairo2-dev libcunit1-dev libpciaccess-dev meson ninja-build pkg-config python3 python3-pip python3-wheel python3-setuptools python3-docutils valgrind'
4449ef06a4Smrg    FDO_DISTRIBUTION_EXEC: 'pip3 install meson==0.52.1'
4549ef06a4Smrg    # bump this tag every time you change something which requires rebuilding the
4649ef06a4Smrg    # base image
4749ef06a4Smrg    FDO_DISTRIBUTION_TAG: "2021-08-03.0"
4849ef06a4Smrg
4949ef06a4Smrg.debian-x86_64:
5049ef06a4Smrg  extends:
5149ef06a4Smrg    - .os-debian
5249ef06a4Smrg  variables:
5349ef06a4Smrg    BUILD_ARCH: "x86-64"
5449ef06a4Smrg
5549ef06a4Smrg.debian-aarch64:
5649ef06a4Smrg  extends:
5749ef06a4Smrg    - .os-debian
5849ef06a4Smrg  variables:
5949ef06a4Smrg    BUILD_ARCH: "aarch64"
6049ef06a4Smrg
6149ef06a4Smrg.debian-armv7:
6249ef06a4Smrg  extends:
6349ef06a4Smrg    - .os-debian
6449ef06a4Smrg  variables:
6549ef06a4Smrg    BUILD_ARCH: "armv7"
6649ef06a4Smrg
6749ef06a4Smrg.os-freebsd:
6849ef06a4Smrg  variables:
6949ef06a4Smrg    BUILD_OS: freebsd
7049ef06a4Smrg    FDO_DISTRIBUTION_VERSION: "13.0"
7149ef06a4Smrg    FDO_DISTRIBUTION_PACKAGES: 'meson ninja pkgconf libpciaccess libpthread-stubs py38-docutils cairo'
7249ef06a4Smrg    # bump this tag every time you change something which requires rebuilding the
7349ef06a4Smrg    # base image
7449ef06a4Smrg    FDO_DISTRIBUTION_TAG: "2021-11-10.1"
7549ef06a4Smrg
7649ef06a4Smrg.freebsd-x86_64:
7749ef06a4Smrg  extends:
7849ef06a4Smrg    - .os-freebsd
7949ef06a4Smrg  variables:
8049ef06a4Smrg    BUILD_ARCH: "x86_64"
8149ef06a4Smrg
8249ef06a4Smrg# Build our base container image, which contains the core distribution, the
8349ef06a4Smrg# toolchain, and all our build dependencies. This will be reused in the build
8449ef06a4Smrg# stage.
8549ef06a4Smrgx86_64-debian-container_prep:
8649ef06a4Smrg  extends:
8749ef06a4Smrg    - .ci-rules
8849ef06a4Smrg    - .debian-x86_64
8949ef06a4Smrg    - .fdo.container-build@debian
9049ef06a4Smrg  stage: "Base container"
9149ef06a4Smrg  variables:
9249ef06a4Smrg    GIT_STRATEGY: none
9349ef06a4Smrg
9449ef06a4Smrgaarch64-debian-container_prep:
9549ef06a4Smrg  extends:
9649ef06a4Smrg    - .ci-rules
9749ef06a4Smrg    - .debian-aarch64
9849ef06a4Smrg    - .fdo.container-build@debian
9949ef06a4Smrg  tags:
10049ef06a4Smrg    - aarch64
10149ef06a4Smrg  stage: "Base container"
10249ef06a4Smrg  variables:
10349ef06a4Smrg    GIT_STRATEGY: none
10449ef06a4Smrg
10549ef06a4Smrgarmv7-debian-container_prep:
10649ef06a4Smrg  extends:
10749ef06a4Smrg    - .ci-rules
10849ef06a4Smrg    - .debian-armv7
10949ef06a4Smrg    - .fdo.container-build@debian
11049ef06a4Smrg  tags:
11149ef06a4Smrg    - aarch64
11249ef06a4Smrg  stage: "Base container"
11349ef06a4Smrg  variables:
11449ef06a4Smrg    GIT_STRATEGY: none
11549ef06a4Smrg    FDO_BASE_IMAGE: "arm32v7/debian:$FDO_DISTRIBUTION_VERSION"
11649ef06a4Smrg
11749ef06a4Smrgx86_64-freebsd-container_prep:
11849ef06a4Smrg  extends:
11949ef06a4Smrg    - .ci-rules
12049ef06a4Smrg    - .freebsd-x86_64
12149ef06a4Smrg    - .fdo.qemu-build@freebsd@x86_64
12249ef06a4Smrg  stage: "Base container"
12349ef06a4Smrg  variables:
12449ef06a4Smrg    GIT_STRATEGY: none
12549ef06a4Smrg
12649ef06a4Smrg# Core build environment.
12749ef06a4Smrg.build-env:
12849ef06a4Smrg  variables:
12949ef06a4Smrg    MESON_BUILD_TYPE: "-Dbuildtype=debug -Doptimization=0 -Db_sanitize=address,undefined"
13049ef06a4Smrg
13149ef06a4Smrg# OS/architecture-specific variants
13249ef06a4Smrg.build-env-debian-x86_64:
13349ef06a4Smrg  extends:
13449ef06a4Smrg    - .fdo.suffixed-image@debian
13549ef06a4Smrg    - .debian-x86_64
13649ef06a4Smrg    - .build-env
13749ef06a4Smrg  needs:
13849ef06a4Smrg    - job: x86_64-debian-container_prep
13949ef06a4Smrg      artifacts: false
14049ef06a4Smrg
14149ef06a4Smrg.build-env-debian-aarch64:
14249ef06a4Smrg  extends:
14349ef06a4Smrg    - .fdo.suffixed-image@debian
14449ef06a4Smrg    - .debian-aarch64
14549ef06a4Smrg    - .build-env
14649ef06a4Smrg  variables:
14749ef06a4Smrg    # At least with the versions we have, the LSan runtime makes fork unusably
14849ef06a4Smrg    # slow on AArch64, which is bad news since the test suite decides to fork
14949ef06a4Smrg    # for every single subtest. For now, in order to get AArch64 builds and
15049ef06a4Smrg    # tests into CI, just assume that we're not going to leak any more on
15149ef06a4Smrg    # AArch64 than we would on ARMv7 or x86-64.
15249ef06a4Smrg    ASAN_OPTIONS: "detect_leaks=0"
15349ef06a4Smrg  tags:
15449ef06a4Smrg    - aarch64
15549ef06a4Smrg  needs:
15649ef06a4Smrg    - job: aarch64-debian-container_prep
15749ef06a4Smrg      artifacts: false
15849ef06a4Smrg
15949ef06a4Smrg.build-env-debian-armv7:
16049ef06a4Smrg  extends:
16149ef06a4Smrg    - .fdo.suffixed-image@debian
16249ef06a4Smrg    - .debian-armv7
16349ef06a4Smrg    - .build-env
16449ef06a4Smrg  tags:
16549ef06a4Smrg    - aarch64
16649ef06a4Smrg  needs:
16749ef06a4Smrg    - job: armv7-debian-container_prep
16849ef06a4Smrg      artifacts: false
16949ef06a4Smrg
17049ef06a4Smrg.build-env-freebsd-x86_64:
17149ef06a4Smrg  variables:
17249ef06a4Smrg    # Compiling with ASan+UBSan appears to trigger an infinite loop in the
17349ef06a4Smrg    # compiler shipped with FreeBSD 13.0, so we only use UBSan here.
17449ef06a4Smrg    # Additionally, sanitizers can't be used with b_lundef on FreeBSD.
17549ef06a4Smrg    MESON_BUILD_TYPE: "-Dbuildtype=debug -Db_sanitize=undefined -Db_lundef=false"
17649ef06a4Smrg  extends:
17749ef06a4Smrg    - .fdo.suffixed-image@freebsd
17849ef06a4Smrg    - .freebsd-x86_64
17949ef06a4Smrg    - .build-env
18049ef06a4Smrg  needs:
18149ef06a4Smrg    - job: x86_64-freebsd-container_prep
18249ef06a4Smrg      artifacts: false
18349ef06a4Smrg
18449ef06a4Smrg# BUILD
18549ef06a4Smrg
18649ef06a4Smrg.do-build:
18749ef06a4Smrg  extends:
18849ef06a4Smrg    - .ci-rules
18949ef06a4Smrg  stage: "Build"
19049ef06a4Smrg  variables:
19149ef06a4Smrg    GIT_DEPTH: 10
19249ef06a4Smrg  script:
19349ef06a4Smrg    - meson build
19449ef06a4Smrg        -D amdgpu=true
19549ef06a4Smrg        -D cairo-tests=true
19649ef06a4Smrg        -D etnaviv=true
19749ef06a4Smrg        -D exynos=true
19849ef06a4Smrg        -D freedreno=true
19949ef06a4Smrg        -D freedreno-kgsl=true
20049ef06a4Smrg        -D intel=true
20149ef06a4Smrg        -D libkms=true
20249ef06a4Smrg        -D man-pages=true
20349ef06a4Smrg        -D nouveau=true
20449ef06a4Smrg        -D omap=true
20549ef06a4Smrg        -D radeon=true
20649ef06a4Smrg        -D tegra=true
20749ef06a4Smrg        -D udev=true
20849ef06a4Smrg        -D valgrind=auto
20949ef06a4Smrg        -D vc4=true
21049ef06a4Smrg        -D vmwgfx=true
21149ef06a4Smrg    - ninja -C build
21249ef06a4Smrg    - ninja -C build test
21349ef06a4Smrg    - DESTDIR=$PWD/install ninja -C build install
21449ef06a4Smrg  artifacts:
21549ef06a4Smrg    when: on_failure
21649ef06a4Smrg    paths:
21749ef06a4Smrg      - build/meson-logs/*
21849ef06a4Smrg
21949ef06a4Smrg.do-build-qemu:
22049ef06a4Smrg  extends:
22149ef06a4Smrg    - .ci-rules
22249ef06a4Smrg  stage: "Build"
22349ef06a4Smrg  script:
22449ef06a4Smrg    # Start the VM and copy our workspace to the VM
22549ef06a4Smrg    - /app/vmctl start
22649ef06a4Smrg    - scp -r $PWD "vm:"
22749ef06a4Smrg    # The `set +e is needed to ensure that we always copy the meson logs back to
22849ef06a4Smrg    # the workspace to see details about the failed tests.
22949ef06a4Smrg    - |
23049ef06a4Smrg      set +e
23149ef06a4Smrg      /app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson build -D amdgpu=true -D cairo-tests=true -D intel=true -D libkms=true -D man-pages=true -D nouveau=false -D radeon=true -D valgrind=auto && ninja -C build"
23249ef06a4Smrg      set -ex
23349ef06a4Smrg      scp -r vm:$CI_PROJECT_NAME/build/meson-logs .
23449ef06a4Smrg      /app/vmctl exec "ninja -C $CI_PROJECT_NAME/build install"
23549ef06a4Smrg      mkdir -p $PREFIX && scp -r vm:$PREFIX/ $PREFIX/
23649ef06a4Smrg    # Finally, shut down the VM.
23749ef06a4Smrg    - /app/vmctl stop
23849ef06a4Smrg  artifacts:
23949ef06a4Smrg    when: on_failure
24049ef06a4Smrg    paths:
24149ef06a4Smrg      - build/meson-logs/*
24249ef06a4Smrg
24349ef06a4Smrg# Full build and test.
24449ef06a4Smrgx86_64-debian-build:
24549ef06a4Smrg  extends:
24649ef06a4Smrg    - .build-env-debian-x86_64
24749ef06a4Smrg    - .do-build
24849ef06a4Smrg
24949ef06a4Smrgaarch64-debian-build:
25049ef06a4Smrg  extends:
25149ef06a4Smrg    - .build-env-debian-aarch64
25249ef06a4Smrg    - .do-build
25349ef06a4Smrg
25449ef06a4Smrgarmv7-debian-build:
25549ef06a4Smrg  extends:
25649ef06a4Smrg    - .build-env-debian-armv7
25749ef06a4Smrg    - .do-build
25849ef06a4Smrg
25949ef06a4Smrg# Daily build
26049ef06a4Smrgmeson-arch-daily:
26149ef06a4Smrg  rules:
26249ef06a4Smrg    - if: '$SCHEDULE == "arch-daily"'
26349ef06a4Smrg      when: on_success
26449ef06a4Smrg    - when: never
26549ef06a4Smrg  image: archlinux/archlinux:base-devel
26649ef06a4Smrg  before_script:
26749ef06a4Smrg    - pacman -Syu --noconfirm --needed
26849ef06a4Smrg        cairo
26949ef06a4Smrg        cunit
27049ef06a4Smrg        libatomic_ops
27149ef06a4Smrg        libpciaccess
27249ef06a4Smrg        meson
27349ef06a4Smrg        valgrind
27449ef06a4Smrg        python-docutils
27549ef06a4Smrg  extends: .do-build
27649ef06a4Smrg
27749ef06a4Smrgx86_64-freebsd-build:
27849ef06a4Smrg  extends:
27949ef06a4Smrg    - .build-env-freebsd-x86_64
28049ef06a4Smrg    - .do-build-qemu
281