From 1aa77c90ab1ca930a10cdc87bf7a61cd352e0b06 Mon Sep 17 00:00:00 2001 From: William Petit Date: Fri, 21 Sep 2018 09:55:10 +0200 Subject: [PATCH] Add Jenkinsfile for continuous integration --- Jenkinsfile | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..4cd7ece --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,59 @@ +pipeline { + + agent { + docker { image 'golang:1.11' } + } + + stages { + + stage('Prepare environment') { + steps { + script { + sh 'make install-devtools' + sh 'make vendor' + } + } + } + + stage('Run unit tests') { + steps { + script { + sh 'make test' + } + } + } + + stage('Run lint') { + steps { + script { + try { + sh "make lint" + } catch(ex) { + currentBuild.result = "UNSTABLE" + } + } + } + } + + } + + post { + always { + script { + if (currentBuild.currentResult != 'SUCCESS') { + emailext ( + subject: "${currentBuild.currentResult} - Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: """ + Voir les étapes du job: ${env.BUILD_URL}flowGraphTable + + Projet: ${env.GIT_URL} + Branche: ${env.GIT_BRANCH} + Commit: ${env.GIT_COMMIT} + """, + recipientProviders: [developers(), requestor()], + ) + } + } + } + } +}