Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into to/#158-osm-model
Browse files Browse the repository at this point in the history
  • Loading branch information
t-ober committed Dec 2, 2021
2 parents 646bd09 + 74ce5a7 commit 08fe27e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 56 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ updates:
- dependency-name: com.github.spotbugs
versions:
- 4.6.2
- dependency-name: org.scalatest:scalatest_2.13
versions:
- "3.3.0-SNAP+"
25 changes: 12 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void setJavaVersion(javaVersionId) {
String featureBranchName = ""

//// gradle tasks that are executed
def gradleTasks = "--refresh-dependencies clean spotlessCheck pmdMain pmdTest spotbugsMain spotbugsTest allTests" // the gradle tasks that are executed on ALL projects
def gradleTasks = "--refresh-dependencies clean spotlessCheck pmdMain pmdTest spotbugsMain spotbugsTest test" // the gradle tasks that are executed on ALL projects
def mainProjectGradleTasks = "jacocoTestReport jacocoTestCoverageVerification reportScoverage checkScoverage" // additional tasks that are only executed on project 0 (== main project)
// if you need additional tasks for deployment add them here
// NOTE: artifactory task with credentials will be added below
Expand Down Expand Up @@ -99,15 +99,15 @@ if (env.BRANCH_NAME == "master") {
}

// test the project
stage("gradle allTests ${projects.get(0)}") {
stage("gradle test ${projects.get(0)}") {
// build and test the project
gradle("${gradleTasks} ${mainProjectGradleTasks}")
}

// execute sonarqube code analysis
stage('SonarQube analysis') {
withSonarQubeEnv() { // Will pick the global server connection from jenkins for sonarqube, TODO: Remove exclusion, when removing deprecated quantity package
gradle("sonarqube -Dsonar.branch.name=master -Dsonar.projectKey=$sonarqubeProjectKey ")
withSonarQubeEnv() { // Will pick the global server connection from jenkins for sonarqube
gradle("sonarqube -Dsonar.branch.name=master -Dsonar.projectKey=$sonarqubeProjectKey")
}
}

Expand Down Expand Up @@ -141,7 +141,7 @@ if (env.BRANCH_NAME == "master") {
withCredentials([usernamePassword(credentialsId: mavenCentralCredentialsId, usernameVariable: 'mavencentral_username', passwordVariable: 'mavencentral_password'),
file(credentialsId: mavenCentralSignKeyFileId, variable: 'mavenCentralKeyFile'),
usernamePassword(credentialsId: mavenCentralSignKeyId, passwordVariable: 'signingPassword', usernameVariable: 'signingKeyId')]) {
deployGradleTasks = "--refresh-dependencies clean allTests " + deployGradleTasks + "publish -Puser=${env.mavencentral_username} -Ppassword=${env.mavencentral_password} -Psigning.keyId=${env.signingKeyId} -Psigning.password=${env.signingPassword} -Psigning.secretKeyRingFile=${env.mavenCentralKeyFile}"
deployGradleTasks = "--refresh-dependencies clean test " + deployGradleTasks + "publish -Puser=${env.mavencentral_username} -Ppassword=${env.mavencentral_password} -Psigning.keyId=${env.signingKeyId} -Psigning.password=${env.signingPassword} -Psigning.secretKeyRingFile=${env.mavenCentralKeyFile}"

// see https://docs.gradle.org/6.0.1/release-notes.html "Publication of SHA256 and SHA512 checksums"
def preventSHACheckSums = "-Dorg.gradle.internal.publish.checksums.insecure=true"
Expand Down Expand Up @@ -220,15 +220,15 @@ if (env.BRANCH_NAME == "master") {


// test the project
stage("gradle allTests ${projects.get(0)}") {
stage("gradle test ${projects.get(0)}") {
// build and test the project
gradle("${gradleTasks} ${mainProjectGradleTasks}")
}

// execute sonarqube code analysis
stage('SonarQube analysis') {
withSonarQubeEnv() { // Will pick the global server connection from jenkins for sonarqube, TODO: Remove exclusion, when removing deprecated quantity package
gradle("sonarqube -Dsonar.branch.name=master -Dsonar.projectKey=$sonarqubeProjectKey")
withSonarQubeEnv() { // Will pick the global server connection from jenkins for sonarqube
gradle("sonarqube -Dsonar.branch.name=master -Dsonar.projectKey=$sonarqubeProjectKey ")
}
}

Expand Down Expand Up @@ -264,7 +264,7 @@ if (env.BRANCH_NAME == "master") {
withCredentials([usernamePassword(credentialsId: mavenCentralCredentialsId, usernameVariable: 'mavencentral_username', passwordVariable: 'mavencentral_password'),
file(credentialsId: mavenCentralSignKeyFileId, variable: 'mavenCentralKeyFile'),
usernamePassword(credentialsId: mavenCentralSignKeyId, passwordVariable: 'signingPassword', usernameVariable: 'signingKeyId')]) {
deployGradleTasks = "--refresh-dependencies clean allTests " + deployGradleTasks + "publish -Puser=${env.mavencentral_username} -Ppassword=${env.mavencentral_password} -Psigning.keyId=${env.signingKeyId} -Psigning.password=${env.signingPassword} -Psigning.secretKeyRingFile=${env.mavenCentralKeyFile}"
deployGradleTasks = "--refresh-dependencies clean test " + deployGradleTasks + "publish -Puser=${env.mavencentral_username} -Ppassword=${env.mavencentral_password} -Psigning.keyId=${env.signingKeyId} -Psigning.password=${env.signingPassword} -Psigning.secretKeyRingFile=${env.mavenCentralKeyFile}"

gradle("${deployGradleTasks}")

Expand Down Expand Up @@ -358,7 +358,7 @@ if (env.BRANCH_NAME == "master") {
}

// test the project
stage("gradle allTests ${projects.get(0)}") {
stage("gradle test ${projects.get(0)}") {

// build and test the project
gradle("${gradleTasks} ${mainProjectGradleTasks}")
Expand All @@ -368,7 +368,6 @@ if (env.BRANCH_NAME == "master") {
stage('SonarQube analysis') {
withSonarQubeEnv() { // Will pick the global server connection from jenkins for sonarqube

// do we have a PR?, TODO: Remove with removal of deprecated quantity package
String gradleCommand = "sonarqube -Dsonar.projectKey=$sonarqubeProjectKey"

if (env.CHANGE_ID != null) {
Expand Down Expand Up @@ -475,7 +474,7 @@ def gitCheckout(String relativeTargetDir, String baseUrl, String branch, String
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
def publishReports() {
// publish test reports
publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: projects.get(0) + '/build/reports/tests/allTests', reportFiles: 'index.html', reportName: "${projects.get(0)}_java_tests_report", reportTitles: ''])
publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: projects.get(0) + '/build/reports/tests/test', reportFiles: 'index.html', reportName: "${projects.get(0)}_java_tests_report", reportTitles: ''])

// publish jacoco report for main project only
publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: projects.get(0) + '/build/reports/jacoco', reportFiles: 'index.html', reportName: "${projects.get(0)}_jacoco_report", reportTitles: ''])
Expand All @@ -487,7 +486,7 @@ def publishReports() {
publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: projects.get(0) + '/build/reports/spotbugs', reportFiles: 'main.html', reportName: "${projects.get(0)}_spotbugs_report", reportTitles: ''])

// scoverage report dir
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: projects.get(0) + '/build/reports/scoverageAllTests', reportFiles: 'scoverage.xml', reportName: "${projects.get(0)}_scoverage_report", reportTitles: ''])
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, escapeUnderscores: false, keepAll: true, reportDir: projects.get(0) + '/build/reports/scoverageTest', reportFiles: 'scoverage.xml', reportName: "${projects.get(0)}_scoverage_report", reportTitles: ''])

}

Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'signing'
id 'pmd' //code check, working on source code
id 'com.github.spotbugs' version '4.8.0' //code check, working on byte code
id 'com.diffplug.spotless' version '6.0.0'//code format
id 'com.diffplug.spotless' version '6.0.1'//code format
id 'jacoco' // java code coverage plugin
id "org.sonarqube" version "3.3" // sonarqube
id "com.github.maiflai.scalatest" version "0.31" // run scalatest without specific spec task
Expand All @@ -27,15 +27,14 @@ description = 'PowerSystemUtils'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion

apply from: scriptsLocation + 'tests.gradle'
apply from: scriptsLocation + 'pmd.gradle'
apply from: scriptsLocation + 'spotbugs.gradle'
apply from: scriptsLocation + 'spotless.gradle'
apply from: scriptsLocation + 'checkJavaVersion.gradle'
apply from: scriptsLocation + 'jacoco.gradle' // jacoco java code coverage
apply from: scriptsLocation + 'mavenCentralPublish.gradle'
apply from: scriptsLocation + 'scoverage.gradle'

apply from: scriptsLocation + 'sonarqube.gradle'

repositories {
mavenCentral()
Expand Down
16 changes: 2 additions & 14 deletions gradle/scripts/jacoco.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
// see https://docs.gradle.org/current/userguide/jacoco_plugin.html for details
// and http://vgaidarji.me/blog/2017/12/20/how-to-configure-jacoco-for-kotlin-and-java-project/ for exclude explanation

//ext {
// // jacoco java code coverage source dir
// coverageSourceDirs = 'src/test/java'
//}

// general configuration
jacoco {
toolVersion = "0.8.4"
toolVersion = "0.8.7"
reportsDir = file("$buildDir/reports/jacoco")
}

//test {
// jacoco {
// enabled = true
//
// }
//}

jacocoTestReport {
reports {
xml.enabled true
Expand All @@ -45,7 +33,7 @@ jacocoTestReport {
))

// sourceSets sourceSets.main
executionData allTests // include integration tests in jacoco reports
executionData test // include integration tests in jacoco reports
}

jacocoTestCoverageVerification {
Expand Down
4 changes: 2 additions & 2 deletions gradle/scripts/pmd.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pmd {
ignoreFailures = true // dont let the build fail on rule violations

toolVersion = "6.21.0"
consoleOutput = true
toolVersion = "6.36.0"
// pmd rule priority is a range from 1 to 5, with 1 being the highest priority
// the default rule priority is 5
rulesMinimumPriority = 2
Expand Down
16 changes: 9 additions & 7 deletions gradle/scripts/sonarqube.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ sonarqube {
property 'sonar.verbose', 'true' // verbose mode
property 'sonar.sourceEncoding', 'UTF-8' // encoding
property 'sonar.sources', [
'src/main/resources',
'src/main/java',
'src/main/scala'] // src dirs
property "sonar.tests", [
Expand Down Expand Up @@ -35,17 +34,20 @@ sonarqube {
property 'sonar.groovy.binaries', 'build/classes/groovy' // groovy binaries
// scala specific stuff
property 'sonar.scala.coverage.reportPaths', 'build/reports/scoverage/scoverage.xml'

}
}

// forces sonarqube to execute integration tests
project.tasks["sonarqube"].dependsOn "pmdMain"
project.tasks["sonarqube"].dependsOn "pmdTest"
project.tasks["sonarqube"].dependsOn "spotbugsMain"
project.tasks["sonarqube"].dependsOn "spotbugsTest"
project.tasks["sonarqube"].dependsOn "allTests"
project.tasks["sonarqube"].dependsOn "check"
// Check itself depends on
// - pmdMain
// - spotBugsMain
// - pmdTest
// - spotBugsTest
// - test

project.tasks["sonarqube"].dependsOn "jacocoTestReport"
project.tasks["sonarqube"].dependsOn "jacocoTestCoverageVerification"

project.tasks["sonarqube"].dependsOn "reportScoverage"
project.tasks["sonarqube"].dependsOn "checkScoverage"
17 changes: 0 additions & 17 deletions gradle/scripts/tests.gradle

This file was deleted.

0 comments on commit 08fe27e

Please sign in to comment.