Skip to content

Commit

Permalink
Reconnect sonar (#6)
Browse files Browse the repository at this point in the history
* Reconnect Sonar, with code coverage

---------

Co-authored-by: Karl DeBisschop <[email protected]>
  • Loading branch information
kdebisschop and Karl DeBisschop authored Jul 23, 2024
1 parent 0a193ff commit 5e71bfb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
run: ./gradlew test
- name: Determine coverage
run: ./gradlew jacocoTestReport
# - name: Scan with Sonar
# run: ./gradlew sonar
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Scan with Sonar
run: ./gradlew sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Build with Gradle
run: ./gradlew build
11 changes: 8 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'pl.allegro.tech.build.axion-release' version '1.10.3'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id "org.sonarqube" version "2.8"
id("org.sonarqube") version "5.1.0.4882"
id 'jacoco'
id 'java'
id 'maven-publish'
Expand All @@ -11,14 +11,19 @@ sonarqube {
properties {
property "sonar.projectKey", "kdebisschop_rundeck-nexus3-optionvalue-plugin"
property "sonar.organization", "kdebisschop"
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/test/jacocoTestReport.xml"
property "sonar.host.url", "https://sonarcloud.io"
}
}

test {
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
xml.required
csv.required
xml.required = true
csv.required = true
html.destination file("${buildDir}/jacocoHtml")
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public BranchOrVersion(String path) {
artifactId = component(path);
componentVersion = tag(path);
String sep;
if (componentVersion.matches("^.+" + BUILD_SEPARATOR_REGEX + "[a-zA-Z0-9_-]+$")) {
build = componentVersion.replaceFirst("^.+" + BUILD_SEPARATOR_REGEX + "([a-zA-Z0-9_-]+)$", "$1");
versionOrBranch = componentVersion.replaceFirst("^(.+)" + BUILD_SEPARATOR_REGEX + build + "$", "$1");
sep = componentVersion.replaceFirst("^.+(" + BUILD_SEPARATOR_REGEX + ")" + build + "$", "$1");
if (componentVersion.matches("^.+" + BUILD_SEPARATOR_REGEX + "[a-zA-Z0-9]+$")) {
versionOrBranch = componentVersion.replaceFirst("^(.+)" + BUILD_SEPARATOR_REGEX + "[a-zA-Z0-9]+$", "$1");
build = componentVersion.replaceFirst("^" + versionOrBranch + BUILD_SEPARATOR_REGEX + "([a-zA-Z0-9]+)$", "$1");
sep = componentVersion.replaceFirst("^" + versionOrBranch + "(" + BUILD_SEPARATOR_REGEX + ")" + build + "$", "$1");
} else {
build = "";
versionOrBranch = componentVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public void testOne() {
runTest(COMPONENT, "0.1.2", "_", "3");
runTest(COMPONENT, "1.2.1.2", "-", "4");
runTest(COMPONENT, "v1.2.1.5", "-", "6");
runTest(COMPONENT, "v2.2.1.", "_", "16");
runTest(COMPONENT, "v2.2.0.", "_", "beta6");
runTest(COMPONENT, "v2.2.0.", "+", "alpha1");
runTest(COMPONENT, "v2.2.1", "_", "16");
runTest(COMPONENT, "v2.2.0", "_", "beta6");
runTest(COMPONENT, "v2.2.0", "+", "alpha1");
runTest(COMPONENT, "", "", "");
}

Expand Down

0 comments on commit 5e71bfb

Please sign in to comment.