Skip to content

Commit

Permalink
ARC-1705: Add sonar analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrichner-oviva committed May 26, 2024
1 parent 2337d7d commit 0463a9f
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Run unit tests
- name: Build and test
run: mvn -B verify
- name: Sonar Report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn test
mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
64 changes: 64 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@
<authzed.version>0.7.0</authzed.version>

<spotless.maven.plugin.version>2.43.0</spotless.maven.plugin.version>
<jacoco.version>0.8.12</jacoco.version>

<sonar.organization>oviva-ag</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.projectName>spicegen</sonar.projectName>
<sonar.projectKey>oviva-ag_spicegen</sonar.projectKey>
<sonar.moduleKey>${project.groupId}_${project.artifactId}</sonar.moduleKey>
<sonar.coverage.jacoco.xmlReportPaths>
${project.build.directory}/site/jacoco-ut/jacoco.xml,${project.build.directory}/site/jacoco-it/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<distributionManagement>
Expand Down Expand Up @@ -308,6 +318,11 @@
<artifactId>maven-invoker-plugin</artifactId>
<version>${maven.invoker.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -354,6 +369,55 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- code coverage reporting -->
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent-ut</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-ut.exec</destFile>
</configuration>
</execution>
<execution>
<id>prepare-agent-it</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
</configuration>
</execution>
<execution>
<id>report-ut</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-ut.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut
</outputDirectory>
</configuration>
</execution>
<execution>
<id>report-it</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-it.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-it
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 0463a9f

Please sign in to comment.