diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f06fcb6..f7367a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/ci/gitlab-ci-runner b/ci/gitlab-ci-runner new file mode 100755 index 0000000..dac87ec --- /dev/null +++ b/ci/gitlab-ci-runner @@ -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