1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 07:55:06 +03:00
libvirt-python/.gitlab-ci.yml
Erik Skultety 333c8bef2b ci: Drop direct 'setup.py' usage
With all the bits in place we can now drop the 'setup.py' invocations
with preferred alternatives.
This patch does a few things:
- we don't run plain install because that always spins up a new build
  process regardless of whether there are build artifacts literally from
  the previous command, so instead we install the built wheel directly

- when building, we build both the .whl binary and an sdist because
  we'll need the sdist for rpmbuild later in the CI job

- we don't capture the 'build' path as a job artifact anymore, because
  that now only contains egg metadata, all the build artifacts are
  created by Python's build module under 'dist' so we capture that one
  instead

- we always limit pytest to the 'tests' directory which was something
  'setup.py test' used to do as a precaution measure, but setup.py no
  longer has the logic (which is fine)

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2023-06-22 10:52:40 +02:00

100 lines
2.7 KiB
YAML

stages:
- containers
- builds
- sanity_checks
.git_build_vars: &git_build_vars |
export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
export SCRATCH_DIR="$PWD/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"
export CFLAGS="-Werror"
.native_git_build_job:
script:
- *git_build_vars
- pushd "$PWD"
- mkdir -p "$SCRATCH_DIR"
- cd "$SCRATCH_DIR"
- git clone --depth 1 https://gitlab.com/libvirt/libvirt.git
- cd libvirt
- meson build -Ddriver_libvirtd=disabled "--prefix=$VROOT" "--libdir=$LIBDIR"
- ninja -C build install
- popd
- $PYTHON -m build
- $PYTHON -m pip ${PIP_INSTALL:-install} dist/libvirt_python*.whl
- $PYTHON -m pytest tests
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ;
then
rpmbuild --clean --nodeps --define "_topdir $PWD/rpmbuild" -ta dist/libvirt-python*tar.gz ;
mv rpmbuild/RPMS/x86_64/ libvirt-python-rpms ;
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
.native_build_job:
script:
- export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
- export CFLAGS="-Werror"
- $PYTHON -m build
- $PYTHON -m pip ${PIP_INSTALL:-install} dist/libvirt_python*.whl
- $PYTHON -m pytest tests
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ;
then
rpmbuild --clean --nodeps --define "_topdir $PWD/rpmbuild" -ta dist/libvirt-python*tar.gz ;
mv rpmbuild/RPMS/x86_64/ libvirt-python-rpms ;
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
include: '/ci/gitlab.yml'
.api_coverage_job:
stage: sanity_checks
script:
- *git_build_vars
- $PYTHON -m pip ${PIP_INSTALL:-install} dist/libvirt_python*.whl
- LIBVIRT_API_COVERAGE=1 $PYTHON -m pytest tests
allow_failure: true
api_coverage_prebuilt_env:
extends:
- .gitlab_native_build_job_prebuilt_env
- .api_coverage_job
needs:
- job: x86_64-centos-stream-8-git-prebuilt-env
artifacts: true
variables:
NAME: centos-stream-8
api_coverage_local_env:
extends:
- .gitlab_native_build_job_local_env
- .api_coverage_job
needs:
- job: x86_64-centos-stream-8-git-local-env
artifacts: true
variables:
IMAGE: quay.io/centos/centos:stream8
NAME: centos-stream-8