Skip to content

Commit

Permalink
Add sonar integration
Browse files Browse the repository at this point in the history
  • Loading branch information
amanteaux committed Oct 20, 2023
1 parent f2250bd commit 9779c65
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build & test with Maven
run: mvn clean test

sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<modelVersion>4.0.0</modelVersion>

<groupId>com.coreoz</groupId>
<artifactId>plume-demo-admin</artifactId>
<artifactId>plume-showcase</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>plume-demo-admin</name>
<name>plume-showcase</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
23 changes: 23 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sonar.projectKey=plume-showcase
sonar.projectName=plume-showcase
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src

# Java
# sonar.java.binaries=/usr/local/java/jdk-17/bin/
sonar.exclusions=src/main/java/com/coreoz/db/generated/*,\
src/main/java/com/coreoz/db/QuerydslGenerator.java

# Configure Lombok if needed
# sonar.java.libraries=/home/coreoz/lombok-1.18.30.jar

#Tests
# Disable some rules on some files
sonar.issue.ignore.multicriteria=j1,j2
#No literal duplication tests
sonar.issue.ignore.multicriteria.j1.ruleKey=squid:S1192
sonar.issue.ignore.multicriteria.j1.resourceKey=src/test/**/*
#No method name compliance for tests
sonar.issue.ignore.multicriteria.j2.ruleKey=squid:S00100
sonar.issue.ignore.multicriteria.j2.resourceKey=src/test/**/*

0 comments on commit 9779c65

Please sign in to comment.