Skip to content

Commit 3136ddf

Browse files
authored
Merge pull request #1400 from Adyen/update-test-coverage-report
Add SonarCube Analysis and coverage report
2 parents 36684da + d936cb0 commit 3136ddf

File tree

3 files changed

+56
-23
lines changed

3 files changed

+56
-23
lines changed

.github/workflows/coveralls.yml

-22
This file was deleted.

.github/workflows/sonarcloud.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Sonarcloud CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
SonarCloud-Build:
12+
name: SonarCloud Build
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: 17
22+
distribution: 'zulu'
23+
- name: Cache SonarQube Cloud packages
24+
uses: actions/cache@v4
25+
with:
26+
path: ~/.sonar/cache
27+
key: ${{ runner.os }}-sonar
28+
restore-keys: ${{ runner.os }}-sonar
29+
- name: Cache Maven packages
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.m2
33+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
34+
restore-keys: ${{ runner.os }}-m2
35+
- name: Generate coverage report
36+
run: mvn test jacoco:report
37+
38+
- name: Run SonarCloud Analysis
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
42+
run: mvn sonar:sonar -Dsonar.projectKey=Adyen_adyen-java-api-library

pom.xml

+14-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2727
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2828
<swagger-core-version>1.6.14</swagger-core-version>
29+
<sonar.organization>adyen</sonar.organization>
30+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
2931
</properties>
3032
<scm>
3133
<connection>scm:git:[email protected]:Adyen/adyen-java-api-library.git</connection>
@@ -78,11 +80,22 @@
7880
<version>0.8.12</version>
7981
<executions>
8082
<execution>
81-
<id>default-prepare-agent</id>
83+
<id>prepare-agent</id>
8284
<goals>
8385
<goal>prepare-agent</goal>
8486
</goals>
8587
</execution>
88+
<execution>
89+
<id>report</id>
90+
<goals>
91+
<goal>report</goal>
92+
</goals>
93+
<configuration>
94+
<formats>
95+
<format>XML</format>
96+
</formats>
97+
</configuration>
98+
</execution>
8699
</executions>
87100
</plugin>
88101
<plugin>

0 commit comments

Comments
 (0)