Skip to content

Commit 4c22144

Browse files
committed
Merge branch 'feature/sonarqube' into feature/newCAS-v21.0.0-alpha
2 parents 6e82c1b + 5667028 commit 4c22144

2 files changed

Lines changed: 63 additions & 19 deletions

File tree

.github/workflows/build.yml

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

build.gradle

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ buildscript {
2323
classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}"
2424
classpath "io.freefair.gradle:maven-plugin:${project.gradleMavenPluginVersion}"
2525
classpath "io.freefair.gradle:lombok-plugin:${project.gradleLombokPluginVersion}"
26+
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.1.1"
2627
}
2728
}
2829

@@ -58,8 +59,13 @@ def casWebApplicationBinaryName = "cas.war"
5859
project.ext."casServerVersion" = casServerVersion
5960
project.ext."casWebApplicationBinaryName" = casWebApplicationBinaryName
6061

62+
apply plugin: "war"
6163
apply plugin: "io.freefair.war-overlay"
6264

65+
apply from: rootProject.file("gradle/tasks.gradle")
66+
apply from: rootProject.file("gradle/springboot.gradle")
67+
apply from: rootProject.file("gradle/dockerjib.gradle")
68+
6369
apply plugin: "io.freefair.lombok"
6470
lombok {
6571
config["config.stopBubbling"] = "true"
@@ -70,14 +76,30 @@ lombok {
7076
config["lombok.toString.doNotUseGetters"] = "true"
7177
}
7278

73-
apply from: rootProject.file("gradle/tasks.gradle")
74-
75-
apply plugin: "war"
7679
apply plugin: "eclipse"
80+
eclipse {
81+
classpath {
82+
downloadSources = true
83+
downloadJavadoc = true
84+
}
85+
}
86+
7787
apply plugin: "idea"
88+
idea {
89+
module {
90+
downloadJavadoc = true
91+
downloadSources = true
92+
}
93+
}
7894

79-
apply from: rootProject.file("gradle/springboot.gradle")
80-
apply from: rootProject.file("gradle/dockerjib.gradle")
95+
apply plugin: "org.sonarqube"
96+
sonarqube {
97+
properties {
98+
property "sonar.projectKey", "CenterForOpenScience_osf-cas"
99+
property "sonar.organization", "centerforopenscience"
100+
property "sonar.host.url", "https://sonarcloud.io"
101+
}
102+
}
81103

82104
dependencies {
83105
// Other CAS dependencies/modules may be listed here...
@@ -152,17 +174,3 @@ configurations.all {
152174
}
153175
}
154176
}
155-
156-
eclipse {
157-
classpath {
158-
downloadSources = true
159-
downloadJavadoc = true
160-
}
161-
}
162-
163-
idea {
164-
module {
165-
downloadJavadoc = true
166-
downloadSources = true
167-
}
168-
}

0 commit comments

Comments
 (0)