This repository was archived by the owner on Aug 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
49 lines (46 loc) · 1.56 KB
/
Jenkinsfile
File metadata and controls
49 lines (46 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!groovy
void setBuildStatus(String message, String state) {
step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/brg-jenkins/pypsl"],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
}
pipeline {
agent any
stages {
stage('Preparing environment') {
steps {
setBuildStatus("Build in progress", "PENDING");
sh 'docker build --tag=testimage .';
}
}
stage('Test') {
steps {
sh "docker run -v ${WORKSPACE}:/tmp testimage sh -c 'make install; pytest tests/'";
}
}
stage('Coverage') {
when {
branch 'master'
}
steps {
sh "docker run -v ${WORKSPACE}:/tmp testimage sh -c 'make install; coverage run -m pytest tests/; coverage-badge -o coverage.svg'"
s3Upload(file:'coverage.svg', bucket:'pypsl-public', path:"cov_${env.BRANCH_NAME}.svg")
}
}
}
post {
success {
setBuildStatus("Build succeeded", "SUCCESS");
}
failure {
setBuildStatus("Build failed", "FAILURE");
}
always {
cleanWs()
}
}
}