AuthMeReloaded/Jenkinsfile

141 lines
3.9 KiB
Plaintext
Raw Normal View History

2018-03-13 11:42:39 +01:00
pipeline {
agent any
tools {
maven 'Maven 3'
jdk 'OracleJDK 8'
}
stages {
2018-03-13 12:44:54 +01:00
stage ('prepare') {
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 {
echo 'Cleaning the maven workspace...'
sh 'mvn clean'
2018-03-13 11:42:39 +01:00
}
}
2018-03-13 12:44:54 +01:00
stage ('dependencies') {
2018-03-13 11:42:39 +01:00
steps {
echo 'Downloading dependencies...'
sh 'mvn dependency:go-offline'
2018-03-13 11:42:39 +01:00
}
}
2018-03-13 12:44:54 +01:00
stage ('validate') {
2018-03-13 11:42:39 +01:00
steps {
echo 'Validating the maven project...'
sh 'mvn -o validate'
2018-03-13 11:42:39 +01:00
}
}
2018-03-13 12:44:54 +01:00
stage ('compile') {
2018-03-13 11:42:39 +01:00
steps {
echo 'Compiling source classes...'
sh 'mvn -o compile'
2018-03-13 11:42:39 +01:00
}
}
2018-03-13 12:44:54 +01:00
stage ('compile-test') {
2018-03-13 11:42:39 +01:00
steps {
echo 'Compiling test classes...'
sh 'mvn -o test-compile'
2018-03-13 11:42:39 +01:00
}
}
2018-03-13 12:44:54 +01:00
stage ('test') {
2018-03-13 11:42:39 +01:00
steps {
echo 'Performing unit testing...'
sh 'mvn -o test'
2018-03-13 11:42:39 +01:00
}
post {
success {
echo 'Archiving test results...'
junit 'target/surefire-reports/**/*.xml'
}
}
}
2018-03-13 12:44:54 +01:00
stage ('package') {
2018-03-13 11:42:39 +01:00
steps {
echo 'Preparing the final package...'
sh 'mvn -o package'
2018-03-13 11:42:39 +01:00
}
post {
success {
echo 'Archiving the final package...'
archiveArtifacts artifacts: 'target/*.jar', fingerprint: true
}
}
}
2018-03-13 12:44:54 +01:00
stage ('sources') {
2018-03-13 11:42:39 +01:00
when {
branch "master"
}
steps {
echo 'Generating sources...'
sh 'mvn -o source:jar'
2018-03-13 11:42:39 +01:00
}
post {
success {
echo 'Archiving sources...'
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 {
echo 'Generaing javadocs...'
sh 'mvn -o javadoc:javadoc javadoc:jar'
2018-03-13 11:42:39 +01:00
}
post {
success {
echo 'Archiving javadocs...'
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 ('verify') {
2018-03-13 11:42:39 +01:00
steps {
echo 'Performing integration testing...'
sh 'mvn -o verify'
2018-03-13 11:42:39 +01:00
}
}
2018-03-13 12:44:54 +01:00
stage ('install') {
2018-03-13 11:42:39 +01:00
steps {
echo 'Installing artifacts to the local repository...'
sh 'mvn -o install'
2018-03-13 11:42:39 +01:00
}
}
2018-03-13 12:44:54 +01:00
stage ('deploy') {
2018-03-13 11:42:39 +01:00
when {
branch "master"
}
steps {
echo 'Deploying to repository...'
sh 'mvn -o deploy'
2018-03-13 11:42:39 +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-13 11:42:39 +01:00
}
}