ci: Drop CentOS 8 Stream and switch F38 to 40, Ubuntu 20.04 to 22.04
[libvirt-python.git] / .gitlab-ci.yml
blobbc4ff48079040d00d84c55ef1fee02020cda985b
2 stages:
3   - containers
4   - builds
5   - sanity_checks
7 .git_build_vars: &git_build_vars |
8   export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
9   export SCRATCH_DIR="$PWD/scratch"
10   export VROOT="$SCRATCH_DIR/vroot"
11   export LIBDIR="$VROOT/lib"
12   export LD_LIBRARY_PATH="$LIBDIR"
13   export PATH="$VROOT/bin:$PATH"
14   export PKG_CONFIG_PATH="$LIBDIR/pkgconfig"
15   export CFLAGS="-Werror"
17 .native_git_build_job:
18   extends:
19     - .gitlab_native_build_job
20   script:
21     - *git_build_vars
22     - pushd "$PWD"
23     - mkdir -p "$SCRATCH_DIR"
24     - cd "$SCRATCH_DIR"
25     - git clone --depth 1 https://gitlab.com/libvirt/libvirt.git
26     - cd libvirt
27     - meson build -Ddriver_libvirtd=disabled "--prefix=$VROOT" "--libdir=$LIBDIR"
28     - ninja -C build install
29     - popd
30     - $PYTHON -m build -n -x
31     - $PYTHON -m venv test-venv --system-site-packages --symlinks
32     - test-venv/bin/python -m pip install dist/libvirt_python*.whl
33     - test-venv/bin/python -m pytest tests
34     - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ;
35       then
36           unset CFLAGS ;
37           rpmbuild --clean --nodeps --define "_topdir $PWD/rpmbuild" -ta dist/libvirt-python*tar.gz ;
38           mv rpmbuild/RPMS/x86_64/ libvirt-python-rpms ;
39       fi
41 .native_build_job:
42   extends:
43     - .gitlab_native_build_job
44   script:
45     - export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
46     - export CFLAGS="-Werror"
47     - $PYTHON -m build -n -x
48     - $PYTHON -m venv test-venv --system-site-packages --symlinks
49     - test-venv/bin/python -m pip install dist/libvirt_python*.whl
50     - test-venv/bin/python -m pytest tests
51     - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ;
52       then
53           unset CFLAGS ;
54           rpmbuild --clean --nodeps --define "_topdir $PWD/rpmbuild" -ta dist/libvirt-python*tar.gz ;
55           mv rpmbuild/RPMS/x86_64/ libvirt-python-rpms ;
56       fi
58 include: '/ci/gitlab.yml'
60 api_coverage_job:
61   extends:
62     - .gitlab_native_build_job
63   needs:
64     - job: x86_64-centos-stream-9-git
65       artifacts: true
66   stage: sanity_checks
67   script:
68     - *git_build_vars
69     - $PYTHON -m venv test-venv --system-site-packages --symlinks
70     - test-venv/bin/python -m pip install dist/libvirt_python*.whl
71     - LIBVIRT_API_COVERAGE=1 test-venv/bin/python -m pytest tests
72   allow_failure: true
73   variables:
74     NAME: centos-stream-9
75     TARGET_BASE_IMAGE: quay.io/centos/centos:stream9