Browse Source

.gitlab-ci.yml: Run tests with coverage on gitlab

Signed-off-by: Niels Thykier <niels@thykier.net>
devuan-deployment
Niels Thykier 2 years ago
parent
commit
3d076d9bb0
2 changed files with 45 additions and 6 deletions
  1. +19
    -6
      .gitlab-ci.yml
  2. +26
    -0
      ci/gitlab-ci-runner

+ 19
- 6
.gitlab-ci.yml View File

@@ -1,10 +1,21 @@
#tests-stretch:
# image: debian:stretch
# script: debian/run-ci
tests-stretch:
stage: test
image: debian:stretch
script:
- apt-get update
- apt-get install -y python3 python3-apt python3-yaml python3-pytest git rsync libclass-accessor-perl libdpkg-perl
- ci/gitlab-ci-runner

#tests-sid:
# image: debian:sid
# script: debian/run-ci
tests-sid:
stage: test
image: debian:sid
script:
- apt-get update
- apt-get install -y python3 python3-apt python3-yaml python3-coverage python3-pytest python3-pytest-cov git rsync libclass-accessor-perl libdpkg-perl
- ci/gitlab-ci-runner --with-coverage
artifacts:
paths:
- coverage

docs:
stage: test
@@ -22,10 +33,12 @@ pages:
stage: deploy
dependencies:
- docs
- tests-sid
script:
- rm -fr public
- mkdir public
- mv docs public/docs
- mv coverage public/coverage
artifacts:
paths:
- public


+ 26
- 0
ci/gitlab-ci-runner View File

@@ -0,0 +1,26 @@
#!/bin/bash

set -e

err=0

PYTEST_COV_OPTIONS=
BRITNEY=./britney.py

git clone https://salsa.debian.org/debian/britney2-tests.git britney2-tests

if [ "x$1" = "x--with-coverage" ]; then
PYTEST_COV_OPTIONS="--cov-branch --cov --cov-report="
BRITNEY=./ci/britney-coverage.sh
fi
py.test-3 -v $PYTEST_COV_OPTIONS || err=$?
echo
britney2-tests/bin/runtests "$BRITNEY" britney2-tests/t test-out || err=$?

if [ $err = 0 ] && [ "x$1" = "x--with-coverage" ]; then
python3-coverage report -m
echo
python3-coverage html -d coverage
fi

exit $err

Loading…
Cancel
Save