AuthMeReloaded/Jenkinsfile

104 lines
2.9 KiB
Plaintext
Raw Normal View History

2018-03-13 11:42:39 +01:00
pipeline {
tools {
maven 'Maven 3'
jdk 'OracleJDK 8'
}
2018-03-17 21:07:23 +01:00
agent any
options {
timestamps()
timeout(time: 5, unit: 'MINUTES')
}
2018-03-17 22:03:58 +01:00
triggers {
githubPush()
}
2018-03-13 11:42:39 +01:00
stages {
2018-03-13 21:11:35 +01:00
stage ('check-commit') {
2018-03-13 12:44:54 +01:00
steps {
2018-03-13 12:51:59 +01:00
script {
env.CI_SKIP = "false"
result = sh (script: "git log -1 | grep '(?s).[CI[-\\s]SKIP].*'", returnStatus: true)
2018-03-13 12:51:59 +01:00
if (result == 0) {
env.CI_SKIP = "true"
error "'[CI-SKIP]' found in git commit message. Aborting."
}
2018-03-13 12:44:54 +01:00
}
}
}
2018-03-17 21:07:23 +01:00
stage ('compile') {
2018-03-13 11:42:39 +01:00
steps {
2018-03-18 18:51:03 +01:00
withCredentials([string(credentialsId: 'authme-coveralls-token', variable: 'COVERALLS_TOKEN')]) {
2018-03-18 19:42:18 +01:00
sh 'mvn clean verify coveralls:report -DrepoToken=$COVERALLS_TOKEN'
2018-03-18 18:51:03 +01:00
}
2018-03-17 21:07:23 +01:00
}
post {
always {
junit 'target/surefire-reports/*.xml'
2018-03-18 18:51:03 +01:00
jacoco(execPattern: '**/**.exec', classPattern: '**/classes', sourcePattern: '**/src/main/java')
2018-03-17 21:07:23 +01:00
}
2018-03-13 11:42:39 +01:00
}
}
2018-03-13 12:44:54 +01:00
stage ('sources') {
2018-03-13 11:42:39 +01:00
when {
branch "master"
}
steps {
2018-03-17 21:07:23 +01:00
sh 'mvn source:jar'
2018-03-13 11:42:39 +01:00
}
post {
success {
archiveArtifacts artifacts: 'target/*-souces.jar', fingerprint: true
}
}
}
2018-03-13 12:44:54 +01:00
stage ('javadoc') {
2018-03-13 11:42:39 +01:00
when {
branch "master"
}
steps {
2018-03-17 21:07:23 +01:00
sh 'mvn javadoc:javadoc javadoc:jar'
2018-03-13 11:42:39 +01:00
}
post {
success {
step([
$class: 'JavadocArchiver',
javadocDir: 'target/site/apidocs',
keepAll: true
])
archiveArtifacts artifacts: 'target/*-javadoc.jar', fingerprint: true
}
}
}
2018-03-13 12:44:54 +01:00
stage ('deploy') {
2018-03-13 11:42:39 +01:00
when {
branch "master"
}
steps {
2018-03-13 21:11:35 +01:00
sh 'mvn -DskipTests deploy'
2018-03-13 11:42:39 +01:00
}
}
2018-03-17 21:07:23 +01:00
}
2018-03-13 12:54:11 +01:00
post {
always {
script {
if (env.CI_SKIP == "true") {
currentBuild.result = 'NOT_BUILT'
2018-03-13 12:51:59 +01:00
}
2018-03-13 12:44:54 +01:00
}
2018-03-18 18:51:03 +01:00
withCredentials([string(credentialsId: 'authme-discord-webhook', variable: 'DISCORD_WEBHOOK')]) {
2018-03-18 20:11:59 +01:00
discordSend webhookURL: env.DISCORD_WEBHOOK
2018-03-18 18:51:03 +01:00
}
2018-03-17 21:07:23 +01:00
}
success {
githubNotify description: 'The jenkins build was successful', status: 'SUCCESS'
}
failure {
githubNotify description: 'The jenkins build failed', status: 'FAILURE'
2018-03-13 12:44:54 +01:00
}
2018-03-13 11:42:39 +01:00
}
}