From 4e4abe38553c12b4dfce59dfa0a1cb16cac1bda4 Mon Sep 17 00:00:00 2001 From: Ayodeji Ogundare <63319309+ayodejidev@users.noreply.github.com> Date: Fri, 29 Nov 2024 21:32:31 +0100 Subject: [PATCH 1/2] Add Sonarcloud CI and coverage --- .github/workflows/coveralls.yml | 22 ----------------- .github/workflows/sonarcloud.yml | 42 ++++++++++++++++++++++++++++++++ pom.xml | 15 +++++++++++- 3 files changed, 56 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/coveralls.yml create mode 100644 .github/workflows/sonarcloud.yml diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml deleted file mode 100644 index 993e09df7..000000000 --- a/.github/workflows/coveralls.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Coveralls - -on: [pull_request] - -jobs: - - coveralls: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'adopt' - - name: Build & Test - run: mvn clean test - - name: Build with Maven - run: mvn test jacoco:report - - name: Coveralls Coverage Report Submission - run: mvn coveralls:report --define repoToken=${{ secrets.COVERALL_REPO_TOKEN }} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 000000000..e07764489 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,42 @@ +name: Sonarcloud CI + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + +jobs: + SonarCloud-Build: + name: SonarCloud Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'zulu' + - name: Cache SonarQube Cloud packages + uses: actions/cache@v4 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Generate coverage report + run: mvn test jacoco:report + + - name: Run SonarCloud Analysis + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn sonar:sonar -Dsonar.projectKey=Adyen_adyen-java-api-library \ No newline at end of file diff --git a/pom.xml b/pom.xml index a658dd46c..c9461bf29 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,8 @@ UTF-8 UTF-8 1.6.14 + Adyen + https://sonarcloud.io scm:git:git@github.com:Adyen/adyen-java-api-library.git @@ -78,11 +80,22 @@ 0.8.12 - default-prepare-agent + prepare-agent prepare-agent + + report + + report + + + + XML + + + From d936cb0daed6a42238327c98d1ad6ea9635dfa5f Mon Sep 17 00:00:00 2001 From: Ayodeji Ogundare <63319309+ayodejidev@users.noreply.github.com> Date: Fri, 29 Nov 2024 21:46:25 +0100 Subject: [PATCH 2/2] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c9461bf29..c121ba4d0 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ UTF-8 UTF-8 1.6.14 - Adyen + adyen https://sonarcloud.io