AuthMeReloaded/Jenkinsfile

111 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')
}
environment {
COVERALLS_TOKEN = credentials('coveralls-token')
DISCORD_WEBHOOK_URL = credentials('discord-webhook-url')
}
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
}
}
}
stage ('clean') {
2018-03-13 11:42:39 +01:00
steps {
sh 'mvn clean'
2018-03-13 11:42:39 +01:00
}
}
2018-03-17 21:07:23 +01:00
stage ('compile') {
2018-03-13 11:42:39 +01:00
steps {
2018-03-17 21:07:23 +01:00
sh 'mvn compile'
2018-03-13 11:42:39 +01:00
}
}
2018-03-17 21:07:23 +01:00
stage ('test') {
2018-03-13 11:42:39 +01:00
steps {
2018-03-17 21:07:23 +01:00
sh 'mvn test coveralls:report -DrepoToken=$COVERALLS_TOKEN -Dmaven.test.failure.ignore=true'
}
post {
always {
junit 'target/surefire-reports/*.xml'
jacoco(execPattern: '**/*.exec')
}
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-17 21:07:23 +01:00
discordSend webhookURL: '$DISCORD_WEBHOOK_URL'
}
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
}
}