Skip to content

Commit e3e0e4a

Browse files
committed
Add CI/jacoco/sonar
1 parent d8d3a96 commit e3e0e4a

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: build
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- uses: actions/setup-java@v4
14+
with:
15+
java-version: 17
16+
distribution: temurin
17+
cache: 'gradle'
18+
- name: Build and Test
19+
run: ./gradlew check --info
20+
- name: Sonar Analysis
21+
run: ./gradlew jacocoTestReport sonar --info
22+
if: env.SONAR_TOKEN != null
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

build.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
plugins {
22
id 'java-library'
33
id 'io.freefair.lombok' version '8.6'
4+
id 'jacoco'
5+
id 'org.sonarqube'
46
}
57

68
java {
@@ -9,6 +11,20 @@ java {
911
}
1012
}
1113

14+
jacocoTestReport {
15+
reports {
16+
xml.required = true
17+
}
18+
}
19+
20+
sonarqube {
21+
properties {
22+
property "sonar.projectKey", "xenit-eu_java-hateoas-hal-client"
23+
property "sonar.organization", "xenit-eu"
24+
property "sonar.host.url", "https://sonarcloud.io"
25+
}
26+
}
27+
1228
test {
1329
useJUnitPlatform()
1430
}

settings.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
pluginManagement {
2+
plugins {
3+
id 'org.ajoberstar.grgit' version '5.2.2'
4+
id 'org.sonarqube' version '5.0.0.4638'
5+
}
6+
}
7+
8+
plugins {
9+
id 'org.ajoberstar.reckon.settings' version '0.18.3'
10+
id 'eu.xenit.enterprise-conventions.oss' version '0.5.1'
11+
}
12+
13+
dependencyResolutionManagement {
14+
repositories {
15+
mavenCentral()
16+
}
17+
}
18+
19+
reckon {
20+
defaultInferredScope = 'patch'
21+
snapshots()
22+
scopeCalc = calcScopeFromCommitMessages()
23+
stageCalc = { inventory, targetNormal -> java.util.Optional.empty() }
24+
}
25+
26+
rootProject.name = 'java-hateoas-hal-client'

0 commit comments

Comments
 (0)