Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Sonar code coverage #8

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/app.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: App
name: Build

on:
push:
Expand Down Expand Up @@ -26,7 +26,18 @@ jobs:
java-version: '17'

- name: Verify
run: mvn verify -DskipITs=false
run: mvn -B verify -DskipITs=false org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=FIAP-3SOAT-G15_stock-api
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Upload Test Reports
uses: actions/upload-artifact@master
with:
name: generated-reports
path: |
target/site
target/surefire-reports.html

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Provisioning
name: Provision

on:
push:
branches:
- main
paths:
- .github/workflows/provisioning.yml
- .github/workflows/provision.yml
- 'terraform/**'
- 'src/**'
pull_request:
branches:
- main
paths:
- .github/workflows/provisioning.yml
- .github/workflows/provision.yml
- 'terraform/**'
- 'src/**'
workflow_dispatch:
Expand Down
32 changes: 32 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
<testcontainers.version>1.19.1</testcontainers.version>
<skipITs>true</skipITs>
<skipOpenAPIGen>true</skipOpenAPIGen>
<sonar.organization>fiap-3soat-g15</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.language>kotlin</sonar.language>
<sonar.verbose>true</sonar.verbose>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -350,6 +357,31 @@
<skip>${skipOpenAPIGen}</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<formats>
<format>XML</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading