From 73e8f6c33043f0b70629af6a788b3e55049cc35d Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Fri, 10 Jan 2020 13:02:45 +0100 Subject: [PATCH] Move jenkins all-comics test pipeline to git --- tests/modules/Jenkinsfile | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/modules/Jenkinsfile diff --git a/tests/modules/Jenkinsfile b/tests/modules/Jenkinsfile new file mode 100644 index 000000000..b015f0213 --- /dev/null +++ b/tests/modules/Jenkinsfile @@ -0,0 +1,46 @@ +#!groovy + +def prepareDocker () { + def img + stage('Prepare environment') { + def uid = sh returnStdout: true, script: 'id -u' + writeFile file: 'Dockerfile', text: """ + FROM python:3.8-buster + RUN pip install pytest-cov && \\ + useradd -m -u ${uid.trim()} jenkins + """ + img = docker.build('local:test-all-comics') + } + return img +} + +def runTests() { + stage('Checkout') { + checkout scm + } + stage ('Install lib') { + sh "pip install --user -e .[css,test]" + } + stage ('Run tests') { + sh "TESTALL=1 py.test -v --cov=dosagelib --cov-report xml --tb=short -n10 --junitxml=junit.xml tests/modules/check_comics.py || true" + } + stage('Report') { + junit 'junit.xml' + publishCoverage calculateDiffForChangeRequests: true, + sourceFileResolver: sourceFiles('STORE_LAST_BUILD'), + adapters: [ + coberturaAdapter('coverage.xml') + ] + } +} + +ansiColor('xterm') { + node { + def img = prepareDocker() + + img.inside { + runTests() + } + } +} +