virt-viewer/.gitlab-ci.yml
Daniel P. Berrangé 1e99e5e4f4 ci: refresh with latest lcitool manifest
This refresh switches the CI for contributors to be triggered by merge
requests. Pushing to a branch in a fork will no longer run CI pipelines,
in order to avoid consuming CI minutes. To regain the original behaviour
contributors can opt-in to a pipeline on push

   git push <remote> -o ci.variable=RUN_PIPELINE=1

This variable can also be set globally on the repository, though this is
not recommended. Upstream repo pushes to branches will run CI.

The use of containers has changed in this update, with only the upstream
repo creating containers, in order to avoid consuming contributors'
limited storage quotas. A fork with existing container images may delete
them. Containers will be rebuilt upstream when pushing commits with CI
changes to the default branch. Any other scenario with CI changes will
simply install build pre-requisite packages in a throaway environment,
using the ci/buildenv/ scripts. These scripts may also be used on a
contributor's local machines.

With pipelines triggered by merge requests, it is also now possible to
workaround the inability of contributors to run pipelines if they have
run out of CI quota. A project member can trigger a pipeline from the
merge request, which will run in context of upstream, however, note
this should only be done after reviewing the code for any malicious
CI changes.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-09-30 10:10:21 -04:00

119 lines
3.0 KiB
YAML

stages:
- containers
- builds
- sanity_checks
.script_variables: &script_variables |
export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
export SCRATCH_DIR="/tmp/scratch"
export VROOT="$SCRATCH_DIR/vroot"
export LIBDIR="$VROOT/lib"
export LD_LIBRARY_PATH="$LIBDIR"
export PATH="$VROOT/bin:$PATH"
export PKG_CONFIG_PATH="$LIBDIR/pkgconfig"
.native_build_job:
script:
- *script_variables
- meson build
- ninja -C build dist;
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
then
rpmbuild --nodeps -ta build/meson-dist/virt-viewer-*.tar.xz;
fi
.native_build_job_prebuilt_env:
extends:
- .native_build_job
- .gitlab_native_build_job_prebuilt_env
.native_build_job_local_env:
extends:
- .native_build_job
- .gitlab_native_build_job_local_env
.native_git_build_job:
script:
- *script_variables
- pushd "$PWD"
- mkdir -p "$SCRATCH_DIR"
- cd "$SCRATCH_DIR"
- git clone --depth 1 https://gitlab.com/libvirt/libvirt.git
- git clone --depth 1 https://gitlab.com/libvirt/libvirt-glib.git
- git clone --depth 1 https://gitlab.gnome.org/GNOME/gtk-vnc.git
- cd libvirt
- meson build -Ddriver_libvirtd=disabled "--prefix=$VROOT" "--libdir=$LIBDIR"
- ninja -C build install
- cd ../libvirt-glib
- meson build --prefix="$VROOT" --libdir="$LIBDIR" -Ddocs=disabled
- $NINJA -C build install
- cd ../gtk-vnc
- git submodule update --init
- meson build --prefix="$VROOT" --libdir="$LIBDIR"
- $NINJA -C build install
- popd
- meson build
- ninja -C build dist;
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
then
rpmbuild --nodeps -ta build/meson-dist/virt-viewer-*.tar.xz;
fi
.native_git_build_job_prebuilt_env:
extends:
- .native_git_build_job
- .gitlab_native_build_job_prebuilt_env
.native_git_build_job_local_env:
extends:
- .native_git_build_job
- .gitlab_native_build_job_local_env
.cross_build_job:
image: $CI_REGISTRY_IMAGE/ci-$NAME:latest
cache:
paths:
- ccache/
key: "$CI_JOB_NAME"
script:
- *script_variables
- meson build $MESON_OPTS
- $NINJA -C build
.cross_build_job_prebuilt_env:
extends:
- .cross_build_job
- .gitlab_cross_build_job_prebuilt_env
.cross_build_job_local_env:
extends:
- .cross_build_job
- .gitlab_cross_build_job_local_env
include: '/ci/gitlab.yml'
.codestyle_job:
stage: sanity_checks
script:
- *script_variables
- meson build || (cat build/meson-logs/meson-log.txt && exit 1)
- meson test -C build --suite syntax-check --no-rebuild || (cat build/meson-logs/testlog.txt && exit 1)
codestyle_prebuilt_env:
extends:
- .codestyle_job
- .gitlab_native_build_job_prebuilt_env
needs:
- job: x86_64-centos-stream-8-container
optional: true
variables:
NAME: centos-stream-8
codestyle_local_env:
extends:
- .codestyle_job
- .gitlab_native_build_job_local_env
variables:
IMAGE: quay.io/centos/centos:stream8
NAME: centos-stream-8