From 22bab5e24bffe06017550fe834530604b0513e03 Mon Sep 17 00:00:00 2001 From: James Mudd Date: Wed, 15 Nov 2023 21:31:05 +0000 Subject: [PATCH 01/13] Move sonarqube to github actions --- .github/workflows/sonarqube.yml | 23 +++++++++++++++++ azure-pipelines.yml | 44 ++++++--------------------------- 2 files changed, 30 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/sonarqube.yml diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 00000000..0b676799 --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,23 @@ +name: SonarQube +on: + # Trigger analysis when pushing to your main branches, and when creating a pull request. + push: + branches: + - main + - master + - develop + - 'releases/**' + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarqube: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f73e3f12..b00bc998 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,7 +3,7 @@ trigger: - master pr: - master - + jobs: - job: Linux pool: @@ -17,14 +17,14 @@ jobs: Java 11: java.version: '1.11' steps: - + # Build using a Gradle wrapper script - task: Gradle@2 displayName: Build + Test inputs: gradleWrapperFile: 'jhdf/gradlew' workingDirectory: jhdf - tasks: 'clean build jacocoTestReport' + tasks: 'clean build jacocoTestReport' publishJUnitResults: true testResultsFiles: 'jhdf/build/test-results/test/TEST-*.xml' testRunTitle: $(osName) $(Agent.JobName) @@ -47,36 +47,6 @@ jobs: tasks: 'sourcesJar javadocJar' jdkVersionOption: $(java.version) publishJUnitResults: false - - # SonarQube - - task: Gradle@2 - # Only run for Java 1.8 and not for PR - condition: and(eq(variables['java.version'], '1.11'), ne(variables['Build.Reason'], 'PullRequest')) - displayName: SonarQube - inputs: - gradleWrapperFile: 'jhdf/gradlew' - workingDirectory: jhdf - tasks: 'sonarqube' - jdkVersionOption: $(java.version) - publishJUnitResults: false - gradleOptions: '-Dsonar.login=$(sonar.login)' - - # SonarQube for Pull requests - - task: Gradle@2 - # Only run for Java 1.8 and PR - condition: and(eq(variables['java.version'], '1.11'), eq(variables['Build.Reason'], 'PullRequest')) - displayName: SonarQube PR - inputs: - gradleWrapperFile: 'jhdf/gradlew' - workingDirectory: jhdf - tasks: 'sonarqube' - jdkVersionOption: $(java.version) - publishJUnitResults: false - gradleOptions: '-Dsonar.login=$(sonar.login) - -Dsonar.pullrequest.branch=$(Build.SourceBranch) - -Dsonar.pullrequest.key=$(System.PullRequest.PullRequestNumber) - -Dsonar.pullrequest.base=$(System.PullRequest.TargetBranch) - -Dsonar.pullrequest.github.repository=$(Build.Repository.Uri)' - job: Windows pool: @@ -90,14 +60,14 @@ jobs: Java 11: java.version: '1.11' steps: - + # Build using a Gradle wrapper script - task: Gradle@2 displayName: Build/Test inputs: gradleWrapperFile: 'jhdf/gradlew' workingDirectory: jhdf - tasks: 'build' + tasks: 'build' publishJUnitResults: true testResultsFiles: 'jhdf/build/test-results/test/TEST-*.xml' testRunTitle: $(osName) $(Agent.JobName) @@ -125,14 +95,14 @@ jobs: Java 11: java.version: '1.11' steps: - + # Build using a Gradle wrapper script - task: Gradle@2 displayName: Build/Test inputs: gradleWrapperFile: 'jhdf/gradlew' workingDirectory: jhdf - tasks: 'build' + tasks: 'build' publishJUnitResults: true testResultsFiles: 'jhdf/build/test-results/test/TEST-*.xml' testRunTitle: $(osName) $(Agent.JobName) From 81d6d32ac2879ef41a9ca77d23f52cdb6266861f Mon Sep 17 00:00:00 2001 From: James Mudd Date: Wed, 15 Nov 2023 21:31:18 +0000 Subject: [PATCH 02/13] Add Java 21 CI build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9eebda9d..00964b9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ 'macos-latest', 'ubuntu-latest', 'windows-latest', ['self-hosted', 'ARM64'] ] - java: [ '8', '11', '17' ] + java: [ '8', '11', '17', '21' ] steps: - uses: actions/checkout@v4 From 53a598cff4ab104e387864c60360719897de84fd Mon Sep 17 00:00:00 2001 From: James Mudd Date: Wed, 15 Nov 2023 21:40:41 +0000 Subject: [PATCH 03/13] Use sonarcloud --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 0b676799..b592a1aa 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -20,4 +20,4 @@ jobs: uses: sonarsource/sonarqube-scan-action@master env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + SONAR_HOST_URL: https://sonarcloud.io From b82b42b6cc2cade4b5ccc705450bfb5211d8991b Mon Sep 17 00:00:00 2001 From: James Mudd Date: Wed, 15 Nov 2023 22:00:41 +0000 Subject: [PATCH 04/13] Use gradle to run --- .github/workflows/sonarqube.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index b592a1aa..f4414b67 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -16,8 +16,14 @@ jobs: steps: - uses: actions/checkout@v3 - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: https://sonarcloud.io + - name: SonarQube PR + if: github.event_name == 'pull_request' + working-directory: jhdf + run: > + ./gradlew sonarqube + -Dsonar.login=${{ secrets.SONAR_TOKEN }} + -Dsonar.pullrequest.branch=${{ github.ref }} + -Dsonar.pullrequest.key=${{ github.ref.name }} + -Dsonar.pullrequest.base=${{ github.base.ref }} + -Dsonar.pullrequest.github.repository=${{ github.server_url }}/${{ github.repository }} + From 541758c6ba27fb5256a210ed3d2872288235c9ed Mon Sep 17 00:00:00 2001 From: James Mudd Date: Wed, 15 Nov 2023 22:05:03 +0000 Subject: [PATCH 05/13] Use gradle to run 2 --- .github/workflows/sonarqube.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index f4414b67..b88faed5 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -14,14 +14,24 @@ jobs: sonarqube: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + fetch-depth: '0' + + - name: Set up JDK (x64) + uses: actions/setup-java@v3 + with: + java-version: '17' + architecture: 'x64' + distribution: 'temurin' + cache: 'gradle' - name: SonarQube PR if: github.event_name == 'pull_request' working-directory: jhdf run: > - ./gradlew sonarqube - -Dsonar.login=${{ secrets.SONAR_TOKEN }} + ./gradlew test sonar + -Dsonar.token=${{ secrets.SONAR_TOKEN }} -Dsonar.pullrequest.branch=${{ github.ref }} -Dsonar.pullrequest.key=${{ github.ref.name }} -Dsonar.pullrequest.base=${{ github.base.ref }} From fe17d9c8d7fb6eb7bd7a8944dd2d221208b6d4d0 Mon Sep 17 00:00:00 2001 From: James Mudd Date: Thu, 16 Nov 2023 08:49:17 +0000 Subject: [PATCH 06/13] Use gradle to run 3 --- .github/workflows/sonarqube.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index b88faed5..1f0b4d00 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -30,10 +30,10 @@ jobs: if: github.event_name == 'pull_request' working-directory: jhdf run: > - ./gradlew test sonar + ./gradlew -Dsonar.token=${{ secrets.SONAR_TOKEN }} -Dsonar.pullrequest.branch=${{ github.ref }} -Dsonar.pullrequest.key=${{ github.ref.name }} -Dsonar.pullrequest.base=${{ github.base.ref }} -Dsonar.pullrequest.github.repository=${{ github.server_url }}/${{ github.repository }} - + checkstyle spotbugs jacocoTestReport sonar From ee93187eda3ab7238b00744204c21cab73777c32 Mon Sep 17 00:00:00 2001 From: James Mudd Date: Fri, 17 Nov 2023 20:56:37 +0000 Subject: [PATCH 07/13] Use gradle to run 4 --- .github/workflows/sonarqube.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 1f0b4d00..9956d28d 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -29,11 +29,11 @@ jobs: - name: SonarQube PR if: github.event_name == 'pull_request' working-directory: jhdf - run: > - ./gradlew - -Dsonar.token=${{ secrets.SONAR_TOKEN }} - -Dsonar.pullrequest.branch=${{ github.ref }} - -Dsonar.pullrequest.key=${{ github.ref.name }} - -Dsonar.pullrequest.base=${{ github.base.ref }} - -Dsonar.pullrequest.github.repository=${{ github.server_url }}/${{ github.repository }} + run: | + ./gradlew \ + -Dsonar.token=${{ secrets.SONAR_TOKEN }} \ + -Dsonar.pullrequest.branch=${{ github.ref }} \ + -Dsonar.pullrequest.key=${{ github.ref.name }} \ + -Dsonar.pullrequest.base=${{ github.base.ref }} \ + -Dsonar.pullrequest.github.repository=${{ github.server_url }}/${{ github.repository }} \ checkstyle spotbugs jacocoTestReport sonar From c7cc3634866bf641a8e759f6d5a04b99d98834b5 Mon Sep 17 00:00:00 2001 From: James Mudd Date: Fri, 17 Nov 2023 21:00:11 +0000 Subject: [PATCH 08/13] Use gradle to run 5 --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 9956d28d..3263add9 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -36,4 +36,4 @@ jobs: -Dsonar.pullrequest.key=${{ github.ref.name }} \ -Dsonar.pullrequest.base=${{ github.base.ref }} \ -Dsonar.pullrequest.github.repository=${{ github.server_url }}/${{ github.repository }} \ - checkstyle spotbugs jacocoTestReport sonar + checkstyleMain checkstyleTest spotbugsMain spotbugsTest jacocoTestReport sonar From 18265a901a2c097e8da9f42fd11bf2734d2be9a4 Mon Sep 17 00:00:00 2001 From: James Mudd Date: Fri, 17 Nov 2023 21:03:44 +0000 Subject: [PATCH 09/13] Use gradle to run 6 --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 3263add9..86e894be 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -33,7 +33,7 @@ jobs: ./gradlew \ -Dsonar.token=${{ secrets.SONAR_TOKEN }} \ -Dsonar.pullrequest.branch=${{ github.ref }} \ - -Dsonar.pullrequest.key=${{ github.ref.name }} \ + -Dsonar.pullrequest.key=${{ github.event.number }} \ -Dsonar.pullrequest.base=${{ github.base.ref }} \ -Dsonar.pullrequest.github.repository=${{ github.server_url }}/${{ github.repository }} \ checkstyleMain checkstyleTest spotbugsMain spotbugsTest jacocoTestReport sonar From ab8e572891364e4519bcfac27ce81fc9ed9ca588 Mon Sep 17 00:00:00 2001 From: James Mudd Date: Fri, 17 Nov 2023 21:08:01 +0000 Subject: [PATCH 10/13] Use gradle to run 7 --- .github/workflows/sonarqube.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 86e894be..3ddd2d83 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -26,14 +26,9 @@ jobs: distribution: 'temurin' cache: 'gradle' - - name: SonarQube PR - if: github.event_name == 'pull_request' - working-directory: jhdf - run: | - ./gradlew \ - -Dsonar.token=${{ secrets.SONAR_TOKEN }} \ - -Dsonar.pullrequest.branch=${{ github.ref }} \ - -Dsonar.pullrequest.key=${{ github.event.number }} \ - -Dsonar.pullrequest.base=${{ github.base.ref }} \ - -Dsonar.pullrequest.github.repository=${{ github.server_url }}/${{ github.repository }} \ - checkstyleMain checkstyleTest spotbugsMain spotbugsTest jacocoTestReport sonar + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: ./gradlew build checkstyleMain checkstyleTest spotbugsMain spotbugsTest jacocoTestReport sonar --info From efef98f4654360a242705fa77bf4c1c487feb14b Mon Sep 17 00:00:00 2001 From: James Mudd Date: Fri, 17 Nov 2023 21:08:39 +0000 Subject: [PATCH 11/13] Use gradle to run 8 --- .github/workflows/sonarqube.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 3ddd2d83..c6349839 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -27,6 +27,7 @@ jobs: cache: 'gradle' - name: Build and analyze + working-directory: jhdf env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 63303c484bc31e29ab8c56c2c8f6d550c083609d Mon Sep 17 00:00:00 2001 From: James Mudd Date: Fri, 17 Nov 2023 21:15:01 +0000 Subject: [PATCH 12/13] Use gradle to run 9 --- .github/workflows/sonarqube.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index c6349839..9f19c135 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -26,10 +26,26 @@ jobs: distribution: 'temurin' cache: 'gradle' - - name: Build and analyze + - name: Build + working-directory: jhdf + run: ./gradlew build + + - name: Checkstyle + working-directory: jhdf + run: ./gradlew checkstyleMain checkstyleTest + + - name: SpotBugs + working-directory: jhdf + run: ./gradlew spotbugsMain spotbugsTest + + - name: Jacoco Coverage Report + working-directory: jhdf + run: ./gradlew jacocoTestReport + + - name: Sonar working-directory: jhdf env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: ./gradlew build checkstyleMain checkstyleTest spotbugsMain spotbugsTest jacocoTestReport sonar --info + run: ./gradlew sonar --info From 765694184476bb45500d4ea5e46372f4d0fcd909 Mon Sep 17 00:00:00 2001 From: James Mudd Date: Fri, 17 Nov 2023 21:19:45 +0000 Subject: [PATCH 13/13] Use gradle to run 10 --- .github/workflows/ci.yml | 2 +- .github/workflows/sonarqube.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00964b9c..9eebda9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ 'macos-latest', 'ubuntu-latest', 'windows-latest', ['self-hosted', 'ARM64'] ] - java: [ '8', '11', '17', '21' ] + java: [ '8', '11', '17' ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 9f19c135..40ba8ad8 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -38,9 +38,9 @@ jobs: working-directory: jhdf run: ./gradlew spotbugsMain spotbugsTest - - name: Jacoco Coverage Report - working-directory: jhdf - run: ./gradlew jacocoTestReport + - name: Jacoco Coverage Report + working-directory: jhdf + run: ./gradlew jacocoTestReport - name: Sonar working-directory: jhdf