Skip to content

Commit

Permalink
Updating CI
Browse files Browse the repository at this point in the history
  • Loading branch information
SuppieRK committed Sep 18, 2024
1 parent 08715e5 commit 0596dc7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 9 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v3

- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build with Gradle
run: ./gradlew build
- name: Build with Gradle and analyze
run: ./gradlew build sonar --info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
37 changes: 30 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ plugins {
id 'idea'
id 'eclipse'

id 'jacoco'

// Publishing
id 'com.vanniktech.maven.publish' version '0.29.0'

id 'com.diffplug.spotless' version '6.22.0'
// Utility
id 'jacoco'
id 'org.sonarqube' version '4.4.1.3373'
id 'com.diffplug.spotless' version '6.25.0'
}

// Project properties
Expand Down Expand Up @@ -44,10 +45,6 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
}

test {
useJUnitPlatform()
}

task sourceJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
Expand All @@ -73,3 +70,29 @@ tasks.withType(JavaCompile).configureEach {
options.encoding = StandardCharsets.UTF_8.name()
dependsOn(spotlessJavaCheck)
}

test {
useJUnitPlatform()

// Report is always generated after tests run
finalizedBy jacocoTestReport
}

jacocoTestReport {
// Tests are required to run before generating the report
dependsOn test

reports {
html.required = true
xml.required = true
csv.required = false
}
}

sonar {
properties {
property "sonar.projectKey", "SuppieRK_java-throwable-utils"
property "sonar.organization", "suppierk"
property "sonar.host.url", "https://sonarcloud.io"
}
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ POM_DEVELOPER_URL=https://github.com/SuppieRK/

SONATYPE_CONNECT_TIMEOUT_SECONDS=300
SONATYPE_CLOSE_TIMEOUT_SECONDS=1800

# Miscellaneous
systemProp.sonar.gradle.skipCompile=true

0 comments on commit 0596dc7

Please sign in to comment.