From 2e08e2e7fba33f11da02a33d49e040c60ccfa641 Mon Sep 17 00:00:00 2001 From: Patrik Dufresne Date: Wed, 4 Apr 2018 16:42:29 -0400 Subject: [PATCH] Compile each tox environment in parallel. Configure gitlab-ci to compile all the tox environments in separate environment. Also add test coverage and publish it on gitlab pages. --- .gitignore | 1 + .gitlab-ci.yml | 113 +++++++++++++++++++++++++++++++++++++++++++------ tox.ini | 6 ++- 3 files changed, 106 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index c6538995..a0097af9 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ nosetests*.xml /sonar-project.properties .tox .pydevproject +/htmlcov/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e31b85e8..1acfe464 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,29 +3,98 @@ image: ikus060/docker-debian-py2-py3:stretch stages: - test - publish +- pages # Upgrade python and install dependencies to avoid compiling from sources. before_script: - apt-get update && apt-get -qq install python-pysqlite2 libldap2-dev libsasl2-dev rdiff-backup node-less - pip install pip setuptools --upgrade -# TODO Split this by python version and OS. -test_py27: +.tox: &tox stage: test script: - pip install tox nose coverage --upgrade - - python setup.py build - - export TOXENV=`tox --listenvs | grep "^py27" | tr '\n' ','` - - tox --sitepackages + - tox -e $CI_JOB_NAME --sitepackages + artifacts: + paths: + - .coverage.$CI_JOB_NAME + expire_in: 1 day + +py27-cherrypy35: + <<: *tox -test_py3: - stage: test - script: - - pip install tox nose coverage --upgrade - - python setup.py build - - export TOXENV=`tox --listenvs | grep "^py3" | tr '\n' ','` - - tox --sitepackages +py27-cherrypy4: + <<: *tox + +py27-cherrypy5: + <<: *tox + +py27-cherrypy6: + <<: *tox + +py27-cherrypy7: + <<: *tox + +py27-cherrypy8: + <<: *tox + +py27-cherrypy9: + <<: *tox + +py27-cherrypy10: + <<: *tox + +py27-cherrypy11: + <<: *tox + +py27-cherrypy12: + <<: *tox + +py27-cherrypy13: + <<: *tox + +py27-cherrypy14: + <<: *tox + +py3-cherrypy35: + <<: *tox + +py3-cherrypy4: + <<: *tox +py3-cherrypy5: + <<: *tox + +py3-cherrypy6: + <<: *tox + +py3-cherrypy7: + <<: *tox + +py3-cherrypy8: + <<: *tox + +py3-cherrypy9: + <<: *tox + +py3-cherrypy10: + <<: *tox + +py3-cherrypy11: + <<: *tox + +py3-cherrypy12: + <<: *tox + +py3-cherrypy13: + <<: *tox + +py3-cherrypy14: + <<: *tox + +py27-cherrypy32: + <<: *tox + # TODO Publish coverage repport # TODO Publish testcases repport @@ -51,3 +120,23 @@ github_push: - git push --force https://${GITHUB_USR}:${GITHUB_PWD}@github.com/ikus060/rdiffweb.git refs/remotes/origin/${CI_COMMIT_REF_NAME}:refs/heads/${CI_COMMIT_REF_NAME} - git push https://${GITHUB_USR}:${GITHUB_PWD}@github.com/ikus060/rdiffweb.git --tags +coverage: + stage: publish + script: + - coverage combine .coverage.* + - coverage html + coverage: '/TOTAL.*(\d+%)/' + artifacts: + paths: + - htmlcov/ + +pages: + stage: pages + dependencies: + - coverage + script: + - mv htmlcov/ public/ + artifacts: + paths: + - public + expire_in: 15 days diff --git a/tox.ini b/tox.ini index cadde544..552202fe 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ # along with this program. If not, see . [tox] -envlist = py{27,3}-cherrypy{35,4,5,6,7,8,9,10,11},py27-cherrypy32 +envlist = py{27,3}-cherrypy{35,4,5,6,7,8,9,10,11,12,13,14},py27-cherrypy32 [testenv] deps= @@ -34,7 +34,9 @@ deps= cherrypy12: cherrypy>=12.0.0,<13.0.0 cherrypy13: cherrypy>=13.0.0,<14.0.0 cherrypy14: cherrypy>=14.0.0,<15.0.0 -commands=python setup.py nosetests --xunit-file=nosetests-{envname}.xml --xunit-testsuite-name={envname} --cover-xml-file=coverage-{envname}.xml +setenv = + COVERAGE_FILE=.coverage.{envname} +commands=python setup.py nosetests --xunit-file=nosetests-{envname}.xml --xunit-testsuite-name={envname} [travis:env] CHERRYPY = -- GitLab