Skip to content

Commit

Permalink
Merge pull request #1400 from Adyen/update-test-coverage-report
Browse files Browse the repository at this point in the history
Add SonarCube Analysis and coverage report
  • Loading branch information
ayodejidev authored Dec 2, 2024
2 parents 36684da + d936cb0 commit 3136ddf
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 23 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/coveralls.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<swagger-core-version>1.6.14</swagger-core-version>
<sonar.organization>adyen</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
<scm>
<connection>scm:git:[email protected]:Adyen/adyen-java-api-library.git</connection>
Expand Down Expand Up @@ -78,11 +80,22 @@
<version>0.8.12</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<formats>
<format>XML</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down

0 comments on commit 3136ddf

Please sign in to comment.