Merge pull request #30 from kemitix/feature/clean-up-travis

Clean up travis support in favour of jenkins
This commit is contained in:
Paul Campbell 2018-03-08 19:32:10 +00:00 committed by GitHub
commit 2041721574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 27 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule ".travis-support"]
path = .travis-support
url = https://github.com/kemitix/kemitix-travis-support.git

@ -1 +0,0 @@
Subproject commit b8593e541ba9a11447fa9559a83e5f99097ca4d2

View file

@ -5,12 +5,4 @@ cache:
directories: directories:
- "$HOME/.m2" - "$HOME/.m2"
install: true install: true
script: "./mvnw clean install" script: "./mvnw -B -U clean install"
after_success:
- sh .travis-support/coveralls.sh
- bash <(curl -s https://codecov.io/bash)
deploy:
provider: script
script: sh .travis-support/deploy.sh
on:
branch: master

View file

@ -1,27 +1,32 @@
final String repoName = "mon"
final String repoUrl = "git@github.com:kemitix/${repoName}.git"
final String mvn = "mvn --batch-mode --update-snapshots" final String mvn = "mvn --batch-mode --update-snapshots"
pipeline { pipeline {
agent any agent any
stages { stages {
stage('Prepare') { stage('Environment') {
steps { steps {
git url: repoUrl, branch: '**', credentialsId: 'github-kemitix' sh 'set'
} }
} }
stage('no SNAPSHOT in master') { stage('no SNAPSHOT in master') {
// checks that the pom version is not a snapshot when the current branch is master // checks that the pom version is not a snapshot when the current or target branch is master
// TODO: also check for SNAPSHOT when is a pull request with master as the target branch
when { when {
expression { expression {
(env.GIT_BRANCH == 'master') && (env.GIT_BRANCH == 'master' || env.CHANGE_TARGET == 'master') &&
(readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") } (readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") }
} }
steps { steps {
error("Build failed because SNAPSHOT version") error("Build failed because SNAPSHOT version")
} }
} }
stage('Static Code Analysis') {
steps {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
sh "${mvn} compile checkstyle:checkstyle pmd:pmd"
}
pmd canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '', unHealthy: ''
}
}
stage('Build') { stage('Build') {
parallel { parallel {
stage('Java 8') { stage('Java 8') {
@ -34,7 +39,7 @@ pipeline {
stage('Java 9') { stage('Java 9') {
steps { steps {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') { withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') {
sh 'mvn clean install' sh "${mvn} clean install"
} }
} }
} }
@ -43,6 +48,14 @@ pipeline {
stage('Test Results') { stage('Test Results') {
steps { steps {
junit '**/target/surefire-reports/*.xml' junit '**/target/surefire-reports/*.xml'
jacoco exclusionPattern: '**/*{Test|IT|Main|Application|Immutable}.class'
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
sh "${mvn} com.gavinmogan:codacy-maven-plugin:coverage " +
"-DcoverageReportFile=target/site/jacoco/jacoco.xml " +
"-DprojectToken=`$JENKINS_HOME/codacy/token` " +
"-DapiToken=`$JENKINS_HOME/codacy/apitoken` " +
"-Dcommit=`git rev-parse HEAD`"
}
} }
} }
stage('Archiving') { stage('Archiving') {
@ -50,15 +63,10 @@ pipeline {
archiveArtifacts '**/target/*.jar' archiveArtifacts '**/target/*.jar'
} }
} }
stage('Coverage') {
steps {
jacoco(execPattern: '**/target/jacoco.exec')
}
}
stage('Deploy') { stage('Deploy') {
when { expression { (env.GIT_BRANCH == 'master') } } when { expression { (env.GIT_BRANCH == 'master') } }
steps { steps {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') { withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
sh "${mvn} deploy --activate-profiles release -DskipTests=true" sh "${mvn} deploy --activate-profiles release -DskipTests=true"
} }
} }