Skip to content

Commit

Permalink
Merge pull request #9 from PhonePe/oss
Browse files Browse the repository at this point in the history
Sonar coverage fix
  • Loading branch information
MISBMS authored Oct 23, 2024
2 parents a7fa8f1 + 28a588c commit 6df4dfe
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '21'
java-version: '17'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sonarcloud-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
USER_NAME: ${{ secrets.PPE_USER_NAME }}
ACCESS_TOKEN: ${{ secrets.PPE_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=PhonePe_DLM
42 changes: 34 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<sonatype.central.publishing.maven.plugin.version>0.5.0</sonatype.central.publishing.maven.plugin.version>
<maven.release.plugin.version>2.5.3</maven.release.plugin.version>
<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
<maven.sonar.plugin.version>3.9.1.2184</maven.sonar.plugin.version>

<!-- Test related properties -->
<mockito.version>4.3.1</mockito.version>
Expand All @@ -97,14 +98,20 @@
<jdk.target.version>17</jdk.target.version>
<jdk.release.version>17</jdk.release.version>

<!-- Sonar properties -->
<sonar.projectKey>PhonePe_DLM</sonar.projectKey>
<sonar.organization>phonepe</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<sonar.sources>src/main</sonar.sources>
<sonar.tests>src/test</sonar.tests>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.language>java</sonar.language>
<sonar.qualitygate.wait>true</sonar.qualitygate.wait>
<sonar.exclusions>
<!-- Excluding test classes from sonar smells -->
**/src/test/com/phonepe/dlm/**/*.java,
**/src/test/com/phonepe/dlm/*.java
**/src/test/java/com/phonepe/dlm/**/*.java,
**/src/test/java/com/phonepe/dlm/*.java
</sonar.exclusions>
</properties>

Expand Down Expand Up @@ -250,9 +257,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<configuration>
<argLine>--add-opens java.base/java.nio=ALL-UNNAMED</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
Expand All @@ -275,25 +279,47 @@
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${maven.sonar.plugin.version}</version>
<executions>
<execution>
<id>sonar-run</id>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.maven.plugin.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<phase>initialize</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<append>true</append>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/src/test/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
Expand Down

0 comments on commit 6df4dfe

Please sign in to comment.