Skip to content

Commit 0bc602a

Browse files
Merge pull request #1 from diffblue/thomas/addSonarToCI
Add Sonar to run in CI
2 parents a2192b4 + c7f5f12 commit 0bc602a

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ jobs:
2828
run: mvn spotless:check
2929

3030
- name: Run Unit and Integration Tests
31-
run: mvn install
31+
env:
32+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
33+
run: mvn install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
3234

3335
release-check:
3436
if: github.event_name == 'pull_request' && github.base_ref == 'main'

pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ limitations under the License.
3737
<google.java.format.version>1.17.0</google.java.format.version>
3838
<gpg.plugin.version>3.2.1</gpg.plugin.version>
3939
<flatten.plugin.version>1.6.0</flatten.plugin.version>
40+
<jacoco.plugin.version>0.8.12</jacoco.plugin.version>
41+
<sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
42+
<sonar.projectKey>diffblue_diffblue-sonar-plugin</sonar.projectKey>
43+
<sonar.organization>diffblue</sonar.organization>
44+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
4045
</properties>
4146

4247
<dependencyManagement>
@@ -86,6 +91,26 @@ limitations under the License.
8691
</plugins>
8792
</pluginManagement>
8893
<plugins>
94+
<plugin>
95+
<groupId>org.jacoco</groupId>
96+
<artifactId>jacoco-maven-plugin</artifactId>
97+
<version>${jacoco.plugin.version}</version>
98+
<executions>
99+
<execution>
100+
<id>prepare-agent</id>
101+
<goals>
102+
<goal>prepare-agent</goal>
103+
</goals>
104+
</execution>
105+
<execution>
106+
<id>report</id>
107+
<goals>
108+
<goal>report</goal>
109+
</goals>
110+
<phase>test</phase>
111+
</execution>
112+
</executions>
113+
</plugin>
89114
<plugin>
90115
<groupId>org.codehaus.mojo</groupId>
91116
<artifactId>flatten-maven-plugin</artifactId>

0 commit comments

Comments
 (0)