mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-21 16:59:25 +03:00
Don't run sanity checks by default
The sanity check scripts verify that the binding covers all APIs in the libvirt library/headers being built against. This is primarily there for libvirt maintainers to identify when there are gaps in API coverage. This is not something downstream consumers of libvirt-python should be running themselves, so we shouldn't added it to tests by default. In addition if people are working on branches or submitting merge requests for python changes, we shouldn't block their work for failed API coverage sanity tests, if the python binding otherwise builds fine and passes regular unit tests. Thus, we introduce a new gitlab job "api-coverage" with some conditions: - If pushing to a branch, the job is treated as non-fatal - For regular scheduled builds, it is mandatory - Don't run in any other scenarios This job uses the artifacts from the centos-8-git-build job and re-runs the test suite, requesting the sanity tests to be run too. This will achieve the result of letting us see missing API coverage in nightly builds, without blocking other contributions. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@ -23,18 +23,21 @@ stages:
|
||||
after_script:
|
||||
- docker logout
|
||||
|
||||
.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"
|
||||
|
||||
.git_build_job:
|
||||
image: $CI_REGISTRY_IMAGE/ci-$NAME:latest
|
||||
stage: builds
|
||||
before_script:
|
||||
- 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"
|
||||
- export CFLAGS="-Werror"
|
||||
- *git_build_vars
|
||||
script:
|
||||
- pushd "$PWD"
|
||||
- mkdir -p "$SCRATCH_DIR"
|
||||
@ -140,6 +143,11 @@ centos-8-git-build:
|
||||
- centos-8-container
|
||||
variables:
|
||||
NAME: centos-8
|
||||
artifacts:
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- scratch
|
||||
- build
|
||||
|
||||
|
||||
centos-7-dist-build:
|
||||
@ -219,3 +227,18 @@ ubuntu-2004-dist-build:
|
||||
- ubuntu-2004-container
|
||||
variables:
|
||||
NAME: ubuntu-2004
|
||||
|
||||
api-coverage:
|
||||
image: $CI_REGISTRY_IMAGE/ci-centos-8:latest
|
||||
stage: sanity_checks
|
||||
needs:
|
||||
- job: centos-8-git-build
|
||||
artifacts: true
|
||||
before_script:
|
||||
- *git_build_vars
|
||||
script:
|
||||
- LIBVIRT_API_COVERAGE=1 $PYTHON setup.py test
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push"'
|
||||
allow_failure: true
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
||||
|
4
setup.py
4
setup.py
@ -313,7 +313,9 @@ class my_test(Command):
|
||||
os.environ["PYTHONPATH"] = self.build_platlib + ":" + os.environ["PYTHONPATH"]
|
||||
else:
|
||||
os.environ["PYTHONPATH"] = self.build_platlib
|
||||
self.spawn([sys.executable, "sanitytest.py", self.build_platlib, apis[0]])
|
||||
|
||||
if "LIBVIRT_API_COVERAGE" in os.environ:
|
||||
self.spawn([sys.executable, "sanitytest.py", self.build_platlib, apis[0]])
|
||||
pytest = self.find_pytest_path()
|
||||
self.spawn([sys.executable, pytest])
|
||||
|
||||
|
Reference in New Issue
Block a user