diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc41370..e268bad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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"' diff --git a/setup.py b/setup.py index af81968..6d0bd43 100755 --- a/setup.py +++ b/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])