Skip to content

Commit 0fb2ca5

Browse files
authored
Merge pull request #192 from amadeus4dev/add-sonarcloud-actions
add sonarcloud actions
2 parents f529a1f + 59e4d4b commit 0fb2ca5

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/build_gradle.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ name: build
55

66
on:
77
push:
8+
branches: [ master ]
89
pull_request:
910
branches: [ master ]
11+
types: [opened, synchronize, reopened]
1012

1113
jobs:
1214
build:
@@ -36,3 +38,32 @@ jobs:
3638
run: |
3739
curl -Ls https://sh.jbang.dev | bash -s - app setup
3840
~/.jbang/bin/jbang .github/VersionLibraryVerifier.java amadeus-java/
41+
42+
sonarbuild:
43+
name: sonarcloud Build
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v2
47+
with:
48+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
49+
- name: Set up JDK 11
50+
uses: actions/setup-java@v1
51+
with:
52+
java-version: 11
53+
- name: Cache SonarCloud packages
54+
uses: actions/cache@v1
55+
with:
56+
path: ~/.sonar/cache
57+
key: ${{ runner.os }}-sonar
58+
restore-keys: ${{ runner.os }}-sonar
59+
- name: Cache Gradle packages
60+
uses: actions/cache@v1
61+
with:
62+
path: ~/.gradle/caches
63+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
64+
restore-keys: ${{ runner.os }}-gradle
65+
- name: Build and analyze
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
68+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
69+
run: ./gradlew build sonarqube --info

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
id 'checkstyle'
55
id 'com.vanniktech.maven.publish' version '0.18.0'
66
id 'jacoco'
7+
id "org.sonarqube" version "3.4.0.2513"
78
}
89

910
compileJava {
@@ -80,3 +81,11 @@ signing {
8081
useInMemoryPgpKeys(project.getProperty('SIGNING_PRIVATE_KEY'), project.getProperty('SIGNING_PASSWORD'))
8182
}
8283
}
84+
85+
sonarqube {
86+
properties {
87+
property "sonar.projectKey", "amadeus4dev_amadeus-java"
88+
property "sonar.organization", "amadeus4dev"
89+
property "sonar.host.url", "https://sonarcloud.io"
90+
}
91+
}

0 commit comments

Comments
 (0)