Skip to content

Commit 3c99827

Browse files
committed
Sonar + kover
1 parent 73160ac commit 3c99827

File tree

2 files changed

+93
-3
lines changed

2 files changed

+93
-3
lines changed

.github/workflows/build-pr.yaml

+36-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,40 @@ jobs:
6060
- name: Last opp Jacoco enhetstester rapport
6161
uses: actions/upload-artifact@v4
6262
with:
63-
name: jacocoUT
64-
path: target/jacoco/UT/jacoco.xml
63+
name: kover
64+
path: target/site/kover/report.xml
6565
retention-days: 1
66-
overwrite: true
66+
overwrite: true
67+
68+
sonar:
69+
if: github.actor != 'dependabot[bot]'
70+
name: Sonar
71+
runs-on: ubuntu-latest
72+
needs: [ tester ]
73+
steps:
74+
- uses: actions/checkout@v4
75+
with:
76+
fetch-depth: 0
77+
- uses: actions/setup-java@v4
78+
with:
79+
java-version: 21
80+
distribution: 'temurin'
81+
cache: 'maven'
82+
- name: Last ned kover rapport
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: kover
86+
path: kover/kover
87+
- name: Cache Sonar packages
88+
uses: actions/cache@v4
89+
with:
90+
path: ~/.sonar/cache
91+
key: ${{ runner.os }}-sonar
92+
restore-keys: ${{ runner.os }}-sonar
93+
- name: Kjør Sonar
94+
env:
95+
GITHUB_USERNAME: x-access-token
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
98+
run: |
99+
mvn sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths="kover/kover/report.xml"

pom.xml

+57
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
<felles.version>3.20250311182943_dac8027</felles.version>
2727
<token-validation-spring.version>5.0.19</token-validation-spring.version>
2828
<springdoc.version>2.8.5</springdoc.version>
29+
<kover.version>0.9.1</kover.version>
30+
31+
<!-- Sonar -->
32+
<sonar-maven-plugin.version>5.0.0.4389</sonar-maven-plugin.version>
33+
<sonar.organization>navikt</sonar.organization>
34+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
35+
<sonar.sources>src/main</sonar.sources>
36+
<sonar.tests>src/test</sonar.tests>
37+
<sonar.projectKey>navikt_familie-ks-barnehagelister</sonar.projectKey>
2938
</properties>
3039

3140
<dependencyManagement>
@@ -311,6 +320,54 @@
311320
</execution>
312321
</executions>
313322
</plugin>
323+
<plugin>
324+
<groupId>org.jetbrains.kotlinx</groupId>
325+
<artifactId>kover-maven-plugin</artifactId>
326+
<version>${kover.version}</version>
327+
<executions>
328+
<execution>
329+
<id>instr</id>
330+
<goals>
331+
<goal>instrumentation</goal>
332+
</goals>
333+
</execution>
334+
<execution>
335+
<id>kover-xml</id>
336+
<goals>
337+
<goal>report-xml</goal>
338+
</goals>
339+
</execution>
340+
<execution>
341+
<id>kover-log</id>
342+
<goals>
343+
<goal>log</goal>
344+
</goals>
345+
</execution>
346+
<execution>
347+
<id>kover-html</id>
348+
<goals>
349+
<goal>report-html</goal>
350+
</goals>
351+
</execution>
352+
<execution>
353+
<id>kover-verify</id>
354+
<goals>
355+
<goal>verify</goal>
356+
</goals>
357+
</execution>
358+
<execution>
359+
<id>kover-ic</id>
360+
<goals>
361+
<goal>report-ic</goal>
362+
</goals>
363+
</execution>
364+
</executions>
365+
</plugin>
366+
<plugin>
367+
<groupId>org.sonarsource.scanner.maven</groupId>
368+
<artifactId>sonar-maven-plugin</artifactId>
369+
<version>${sonar-maven-plugin.version}</version>
370+
</plugin>
314371
</plugins>
315372
</build>
316373
</project>

0 commit comments

Comments
 (0)