Skip to content

Commit

Permalink
Setup Sonar check for master and Github pull requests (eclipse-che#18629
Browse files Browse the repository at this point in the history
)

* Setup Sonar check for master and Github pull requests

Signed-off-by: Sergii Kabashniuk <skabashniuk@redhat.com>
  • Loading branch information
skabashnyuk authored Dec 17, 2020
1 parent 3b9601c commit 5149322
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Sonar
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Sonar
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Psonar -Pintegration
42 changes: 42 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1478,5 +1478,47 @@
<skipTests>true</skipTests>
</properties>
</profile>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules />
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>eclipse</sonar.organization>
</properties>
</profile>
</profiles>
</project>
1 change: 1 addition & 0 deletions tests/legacy-e2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<com.google.guava.version>20.0</com.google.guava.version>
<log4j.version>1.2.17</log4j.version>
<org.testng.version>6.8.21</org.testng.version>
<sonar.skip>true</sonar.skip>
</properties>
<dependencyManagement>
<dependencies>
Expand Down

0 comments on commit 5149322

Please sign in to comment.