From c622ef636456a642ec26b5ae0343265ecdc1e35f Mon Sep 17 00:00:00 2001 From: xiaojias <649788479@qq.com> Date: Wed, 6 Mar 2019 11:03:50 +0800 Subject: [PATCH] Add 'Test' stage --- Jenkinsfile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 665eba6..ec1cadf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,14 +1,29 @@ pipeline { - agent none + agent none stages { - stage('Build') { + stage('Build') { agent { docker { - image 'python:2-alpine' + image 'python:2-alpine' } } steps { - sh 'python -m py_compile sources/add2vals.py sources/calc.py' + sh 'python -m py_compile sources/add2vals.py sources/calc.py' + } + } + stage('Test') { + agent { + docker { + image 'qnib/pytest' + } + } + steps { + sh 'py.test --verbose --junit-xml test-reports/results.xml sources/test_calc.py' + } + post { + always { + junit 'test-reports/results.xml' + } } } }