add build and test django in Jenkinsfile

This commit is contained in:
s460930 2020-12-01 21:28:24 +01:00
commit ef8aeaab20

19
Jenkinsfile vendored
View File

@ -1,17 +1,16 @@
pipeline {
agent any
agent { docker { image 'python:3.7.2' } }
stages {
stage('Build') {
stage('Build and test') {
steps {
sh 'cd rest-app'
sh 'pip3 install -r requirements.txt'
}
}
stage('Test') {
steps {
sh 'cd rest-app'
sh 'python3 manage.py test'
sh 'pwd'
sh 'ls'
dir("${env.WORKSPACE}/rest-app"){
sh 'pwd'
sh 'ls'
sh 'python3 -m venv venv && . venv/bin/activate && pip3 install -r requirements.txt && python3 manage.py migrate && python3 manage.py test'
}
}
}
}