From f70c6b9cc2d98c989fc930bc0b9235b054b8c7e9 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 12:37:23 +0100 Subject: [PATCH 01/14] jenkins: update to follow latest template --- Jenkinsfile.groovy | 66 +++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index aaa00c8..d118553 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -1,33 +1,25 @@ +final String publicRepo = 'https://github.com/kemitix/' final String mvn = "mvn --batch-mode --update-snapshots --errors" final dependenciesSupportJDK=9 pipeline { agent any stages { - stage('master != SNAPSHOT') { - // checks that the pom version is not a snapshot when the current or target branch is master - when { - expression { - (env.GIT_BRANCH == 'master' || env.CHANGE_TARGET == 'master') && - (readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") - } - } - steps { - error("Build failed because SNAPSHOT version") - } - } stage('Build & Test') { steps { - withMaven(maven: 'maven', jdk: 'JDK LTS') { + withMaven(maven: 'maven', jdk: 'JDK 1.8') { sh "${mvn} clean compile checkstyle:checkstyle pmd:pmd test" - //junit '**/target/surefire-reports/*.xml' + // Code Coverage to Codacy sh "${mvn} -pl builder jacoco:report 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`" + // Code Coverage to Jenkins jacoco exclusionPattern: '**/*{Test|IT|Main|Application|Immutable}.class' + // PMD to Jenkins pmd canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '', unHealthy: '' + // Checkstyle to Jenkins step([$class: 'hudson.plugins.checkstyle.CheckStylePublisher', pattern: '**/target/checkstyle-result.xml', healthy:'20', @@ -37,32 +29,32 @@ pipeline { } stage('Verify & Install') { steps { - withMaven(maven: 'maven', jdk: 'JDK LTS') { + withMaven(maven: 'maven', jdk: 'JDK 1.8') { sh "${mvn} -DskipTests install" } } } - stage('SonarQube (github only)') { - when { expression { env.GIT_URL.startsWith('https://github.com') } } + stage('SonarQube (published)') { + when { expression { isPublished(publicRepo) } } steps { withSonarQubeEnv('sonarqube') { - withMaven(maven: 'maven', jdk: 'JDK LTS') { + withMaven(maven: 'maven', jdk: 'JDK 1.8') { sh "${mvn} org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar" } } } } - stage('Archiving') { - when { expression { findFiles(glob: '**/target/*.jar').length > 0 } } - steps { - archiveArtifacts '**/target/*.jar' + stage('Deploy (published release branch)') { + when { + expression { + (isReleaseBranch() && + isPublished(publicRepo) && + notSnapshot()) + } } - } - stage('Deploy (master on github)') { - when { expression { (env.GIT_BRANCH == 'master' && env.GIT_URL.startsWith('https://github.com')) } } steps { - withMaven(maven: 'maven', jdk: 'JDK LTS') { - sh "${mvn} deploy -pl ruleset,tile --activate-profiles release -DskipTests=true" + withMaven(maven: 'maven', jdk: 'JDK 1.8') { + sh "${mvn} -pl ruleset,tile --activate-profiles release deploy" } } } @@ -84,3 +76,23 @@ pipeline { } } } + +private boolean isReleaseBranch() { + return branchStartsWith('release/') +} + +private boolean branchStartsWith(final String branchName) { + startsWith(env.GIT_BRANCH, branchName) +} + +private boolean isPublished(final String repo) { + startsWith(env.GIT_URL, repo) +} + +private static boolean startsWith(final String value, final String match) { + value != null && value.startsWith(match) +} + +private boolean notSnapshot() { + return !(readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") +} From 0dd792685179fd7cc9a233a015f9255e6a3ccb7d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 12:43:04 +0100 Subject: [PATCH 02/14] Version set to DEV-SNAPSHOT --- builder/pom.xml | 2 +- builder/src/main/resources/README-template.md | 2 +- ruleset/pom.xml | 2 +- tile/pom.xml | 2 +- tile/tile.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builder/pom.xml b/builder/pom.xml index 67a9fe0..e049900 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -14,7 +14,7 @@ net.kemitix.checkstyle builder jar - 4.1.1 + DEV-SNAPSHOT true diff --git a/builder/src/main/resources/README-template.md b/builder/src/main/resources/README-template.md index 1f6edbe..ec0dc50 100644 --- a/builder/src/main/resources/README-template.md +++ b/builder/src/main/resources/README-template.md @@ -31,7 +31,7 @@ The simplest way to use the ruleset is with the maven-tile: true - net.kemitix.checkstyle:tile:4.1.1 + net.kemitix.checkstyle:tile:DEV-SNAPSHOT diff --git a/ruleset/pom.xml b/ruleset/pom.xml index 0082091..f06c310 100644 --- a/ruleset/pom.xml +++ b/ruleset/pom.xml @@ -13,7 +13,7 @@ net.kemitix.checkstyle ruleset - 4.1.1 + DEV-SNAPSHOT jar Kemitix Checkstyle Ruleset diff --git a/tile/pom.xml b/tile/pom.xml index 722ade6..1ab3452 100644 --- a/tile/pom.xml +++ b/tile/pom.xml @@ -12,7 +12,7 @@ net.kemitix.checkstyle tile - 4.1.1 + DEV-SNAPSHOT tile diff --git a/tile/tile.xml b/tile/tile.xml index a533e9f..e0393c8 100644 --- a/tile/tile.xml +++ b/tile/tile.xml @@ -3,7 +3,7 @@ 3.0.0 8.10 1.29.0 - 4.1.1 + DEV-SNAPSHOT 5-complexity net/kemitix/checkstyle-${kemitix.checkstyle.ruleset.level}.xml From 48c5b57ffc3e18d6cbfe5a8faa50fd98d43f6016 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 12:44:00 +0100 Subject: [PATCH 03/14] Upgrade `kemitix-parent` to 5.1.1 --- builder/pom.xml | 2 +- ruleset/pom.xml | 2 +- tile/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/pom.xml b/builder/pom.xml index e049900..04ad2c4 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -7,7 +7,7 @@ net.kemitix kemitix-parent - 5.1.0 + 5.1.1 diff --git a/ruleset/pom.xml b/ruleset/pom.xml index f06c310..5a7b08d 100644 --- a/ruleset/pom.xml +++ b/ruleset/pom.xml @@ -7,7 +7,7 @@ net.kemitix kemitix-parent - 5.1.0 + 5.1.1 diff --git a/tile/pom.xml b/tile/pom.xml index 1ab3452..748210f 100644 --- a/tile/pom.xml +++ b/tile/pom.xml @@ -5,7 +5,7 @@ net.kemitix kemitix-parent - 5.1.0 + 5.1.1 4.0.0 From 58a079f90aa68bb2729baed9481d93ccf918f9b5 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 12:49:04 +0100 Subject: [PATCH 04/14] Upgrade `fast-classpath-scanner` to 3.1.6 --- builder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pom.xml b/builder/pom.xml index 04ad2c4..20ed777 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -32,7 +32,7 @@ 2.13.0 3.9.0 0.3.0 - 2.18.1 + 3.1.6 3.0.0 ${project.version} From 10d5f2611ae8ff6c2f2ff5148f11447402df7ead Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:02:13 +0100 Subject: [PATCH 05/14] Upgrade `javax.annotation-api` to 1.3.2 --- builder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pom.xml b/builder/pom.xml index 20ed777..b035742 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -38,7 +38,7 @@ ${project.version} 5-complexity net/kemitix/checkstyle-${kemitix.checkstyle.ruleset.level}.xml - 1.2 + 1.3.2 From 82def93ff1ce49526ae7ffb2a2c2465cd773eda0 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:05:53 +0100 Subject: [PATCH 06/14] Upgrade `mockito` to 2.19.0 --- builder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pom.xml b/builder/pom.xml index b035742..5fc8ec4 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -29,7 +29,7 @@ 1.5.9.RELEASE 2.3.5 1.0.0 - 2.13.0 + 2.19.0 3.9.0 0.3.0 3.1.6 From a5388942a78eea58fde53ea1326f04ba53088620 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:19:15 +0100 Subject: [PATCH 07/14] README: update template so mail changes don't get lost in main file Also removed jenkins badges as they aren't working --- README.md | 10 +++------- builder/src/main/resources/README-template.md | 10 +++++++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 847301f..1535fcb 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,8 @@ Provides an extensive Checkstyle ruleset for use with Checkstyle, together with [![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/https/oss.sonatype.org/net.kemitix/kemitix-checkstyle-ruleset.svg?style=for-the-badge)](https://oss.sonatype.org/content/repositories/releases/net/kemitix/kemitix-checkstyle-ruleset/) [![Maven Central](https://img.shields.io/maven-central/v/net.kemitix/kemitix-checkstyle-ruleset.svg?style=for-the-badge)](https://search.maven.org/#search|ga|1|g%3A"net.kemitix"%20AND%20a%3A"kemitix-checkstyle-ruleset") -[![SonarQube Coverage](https://img.shields.io/sonar/https/sonarcloud.io/net.kemitix%3Akemitix-checkstyle-ruleset/coverage.svg?style=for-the-badge)](https://sonarcloud.io/dashboard?id=net.kemitix%3Akemitix-checkstyle-ruleset) -[![SonarQube Tech Debt](https://img.shields.io/sonar/https/sonarcloud.io/net.kemitix%3Akemitix-checkstyle-ruleset/tech_debt.svg?style=for-the-badge)](https://sonarcloud.io/dashboard?id=net.kemitix%3Akemitix-checkstyle-ruleset) - -[![Jenkins](https://img.shields.io/jenkins/s/https/jenkins.kemitix.net/job/GitLab/job/kemitix%252Fkemitix-checkstyle-ruleset.svg?style=for-the-badge)](https://jenkins.kemitix.net/job/GitLab/job/kemitix%252Fkemitix-checkstyle-ruleset/) -[![Jenkins tests](https://img.shields.io/jenkins/t/https/jenkins.kemitix.net/job/GitLab/job/kemitix%252Fkemitix-checkstyle-ruleset.svg?style=for-the-badge)](https://jenkins.kemitix.net/job/GitLab/job/kemitix%252Fkemitix-checkstyle-ruleset/) -[![Jenkins coverage](https://img.shields.io/jenkins/c/https/jenkins.kemitix.net/job/GitLab/job/kemitix%252Fkemitix-checkstyle-ruleset.svg?style=for-the-badge)](https://jenkins.kemitix.net/job/GitLab/job/kemitix%252Fkemitix-checkstyle-ruleset/) +[![SonarQube Coverage](https://img.shields.io/sonar/https/sonarcloud.io/net.kemitix.checkstyle%3Akemitix-checkstyle-ruleset/coverage.svg?style=for-the-badge)](https://sonarcloud.io/dashboard?id=net.kemitix%3Akemitix-checkstyle-ruleset) +[![SonarQube Tech Debt](https://img.shields.io/sonar/https/sonarcloud.io/net.kemitix.checkstyle%3Akemitix-checkstyle-ruleset/tech_debt.svg?style=for-the-badge)](https://sonarcloud.io/dashboard?id=net.kemitix%3Akemitix-checkstyle-ruleset) [![Codacy grade](https://img.shields.io/codacy/grade/d57096b0639d496aba9a7e43e7cf5b4c.svg?style=for-the-badge)](https://app.codacy.com/project/kemitix/kemitix-checkstyle-ruleset/dashboard) @@ -43,7 +39,7 @@ The simplest way to use the ruleset is with the maven-tile: true - net.kemitix.checkstyle:tile:4.1.1 + net.kemitix.checkstyle:tile:RELEASE diff --git a/builder/src/main/resources/README-template.md b/builder/src/main/resources/README-template.md index ec0dc50..90679f6 100644 --- a/builder/src/main/resources/README-template.md +++ b/builder/src/main/resources/README-template.md @@ -2,6 +2,14 @@ Provides an extensive Checkstyle ruleset for use with Checkstyle, together with a fully configured maven-tile. +[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/https/oss.sonatype.org/net.kemitix/kemitix-checkstyle-ruleset.svg?style=for-the-badge)](https://oss.sonatype.org/content/repositories/releases/net/kemitix/kemitix-checkstyle-ruleset/) +[![Maven Central](https://img.shields.io/maven-central/v/net.kemitix/kemitix-checkstyle-ruleset.svg?style=for-the-badge)](https://search.maven.org/#search|ga|1|g%%3A"net.kemitix"%%20AND%%20a%%3A"kemitix-checkstyle-ruleset") + +[![SonarQube Coverage](https://img.shields.io/sonar/https/sonarcloud.io/net.kemitix.checkstyle%%3Akemitix-checkstyle-ruleset/coverage.svg?style=for-the-badge)](https://sonarcloud.io/dashboard?id=net.kemitix%%3Akemitix-checkstyle-ruleset) +[![SonarQube Tech Debt](https://img.shields.io/sonar/https/sonarcloud.io/net.kemitix.checkstyle%%3Akemitix-checkstyle-ruleset/tech_debt.svg?style=for-the-badge)](https://sonarcloud.io/dashboard?id=net.kemitix%%3Akemitix-checkstyle-ruleset) + +[![Codacy grade](https://img.shields.io/codacy/grade/d57096b0639d496aba9a7e43e7cf5b4c.svg?style=for-the-badge)](https://app.codacy.com/project/kemitix/kemitix-checkstyle-ruleset/dashboard) + The ruleset includes checks from both the core Checkstyle library and from the Sevntu-Checkstyle library. * [Usage](#usage) @@ -31,7 +39,7 @@ The simplest way to use the ruleset is with the maven-tile: true - net.kemitix.checkstyle:tile:DEV-SNAPSHOT + net.kemitix.checkstyle:tile:RELEASE From b0da93c0880dd0d500ba553d728fd3ed23d70c76 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:21:10 +0100 Subject: [PATCH 08/14] Upgrade `spring-boot` to 1.5.14 --- builder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pom.xml b/builder/pom.xml index 5fc8ec4..a93b4b7 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -26,7 +26,7 @@ 1.29.0 1.16.20 Brussels-SR6 - 1.5.9.RELEASE + 1.5.14.RELEASE 2.3.5 1.0.0 2.19.0 From 3186b23ca4fc2219c3cb637c0ea9f2f0b8ecc9de Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:25:04 +0100 Subject: [PATCH 09/14] Upgrade `lombok` to 1.18.0 --- builder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pom.xml b/builder/pom.xml index a93b4b7..a9c44f6 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -24,7 +24,7 @@ 8.10 1.29.0 - 1.16.20 + 1.18.0 Brussels-SR6 1.5.14.RELEASE 2.3.5 From 997568351bfa698f73a96966c17ba95124c24928 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:31:53 +0100 Subject: [PATCH 10/14] Replace Spring IO Platform dependency management with Spring Boot version --- builder/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/pom.xml b/builder/pom.xml index a9c44f6..60a87c6 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -44,9 +44,9 @@ - io.spring.platform - platform-bom - ${spring-platform.version} + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} pom import From 83c90e1be03ae48ff58b385b39a84ca340cd6fe2 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:32:30 +0100 Subject: [PATCH 11/14] Upgrade `conditional` to 0.4.0 --- builder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pom.xml b/builder/pom.xml index 60a87c6..d7a74ba 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -31,7 +31,7 @@ 1.0.0 2.19.0 3.9.0 - 0.3.0 + 0.4.0 3.1.6 3.0.0 From ec1f684872077263c02caf78873f45ab3e17955e Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:36:16 +0100 Subject: [PATCH 12/14] Upgrade `kemitix-maven-tiles` to 0.9.0 The maven-resource-plugin directly is now provided by the maven-plugins tile. --- ruleset/pom.xml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/ruleset/pom.xml b/ruleset/pom.xml index 5a7b08d..5ab04bd 100644 --- a/ruleset/pom.xml +++ b/ruleset/pom.xml @@ -22,8 +22,7 @@ 2.11 - 0.8.1 - 3.0.2 + 0.9.0 @@ -62,14 +61,6 @@ - - org.apache.maven.plugins - maven-resources-plugin - ${maven-resources-plugin.version} - - UTF-8 - - From 61c110c97688a9a8bba02848724f98f41eab0f90 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:38:14 +0100 Subject: [PATCH 13/14] Upgrade `assertj` to 3.10.0 --- builder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pom.xml b/builder/pom.xml index d7a74ba..891d41b 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -30,7 +30,7 @@ 2.3.5 1.0.0 2.19.0 - 3.9.0 + 3.10.0 0.4.0 3.1.6 From 2cc7cbac74f03190c6901662663690d6ef28d83f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 13:51:48 +0100 Subject: [PATCH 14/14] Upgrade `sevntu` to 1.30.0 --- builder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pom.xml b/builder/pom.xml index 891d41b..25cfe4c 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -23,7 +23,7 @@ 0.8.1 8.10 - 1.29.0 + 1.30.0 1.18.0 Brussels-SR6 1.5.14.RELEASE