Skip to content
This repository was archived by the owner on May 8, 2024. It is now read-only.

Commit 4a88bf3

Browse files
feature: add sonar check workflow
Signed-off-by: Matheus Ferreira <matheus.ferreira@zup.com.br>
1 parent d261b5a commit 4a88bf3

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: SonarQube check
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
sonar-check:
8+
name: SonarQube check
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
14+
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
20+
- name: Cache SonarQube packages
21+
uses: actions/cache@v1
22+
with:
23+
path: ~/.sonar/cache
24+
key: ${{ runner.os }}-sonar
25+
restore-keys: ${{ runner.os }}-sonar
26+
27+
- name: Cache Gradle packages
28+
uses: actions/cache@v1
29+
with:
30+
path: ~/.gradle/caches
31+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
32+
restore-keys: ${{ runner.os }}-gradle
33+
34+
- name: Build and analyze
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # Needed to get PR information, if any
37+
SONAR_TOKEN: ${{ secrets.SONAR_IDE_PIPELINE_TOKEN }}
38+
SONAR_HOST_URL: ${{ secrets.SONAR_PIPELINES_HOST_URL }}
39+
run: ./gradlew build sonarqube --info

0 commit comments

Comments
 (0)