Skip to content

Commit

Permalink
Updating CI (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuppieRK authored Sep 18, 2024
1 parent 08715e5 commit 6ff3a5a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,27 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
java-version: 17

- 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 }}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
java-version: 17

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v3
Expand Down
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 6ff3a5a

Please sign in to comment.