Skip to content

✨ Feat : JDK 21 with Jacoco (#18) #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/gradle-test-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'liberica'
java-version: '17'
java-version: '21'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run gradlew clean test on main
run: ./gradlew clean test
run: ./gradlew clean test --warning-mode=all

- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: spring-templates/spring-concurrency-thread
fail_ci_if_error: true
verbose: true
13 changes: 11 additions & 2 deletions .github/workflows/gradle-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'liberica'
java-version: '17'
java-version: '21'

- name: Cache Gradle packages
uses: actions/cache@v4
Expand All @@ -29,4 +29,13 @@ jobs:
run: chmod +x gradlew

- name: Run gradlew test
run: ./gradlew test
run: ./gradlew test --warning-mode=all

- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: spring-templates/spring-concurrency-thread
fail_ci_if_error: true
verbose: true
flags: unittests
30 changes: 23 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
java
jacoco
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.4"
}
Expand All @@ -8,7 +9,7 @@ group = "com.thread"
version = "0.1.0-SNAPSHOT"

java {
sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
}

repositories {
Expand All @@ -18,18 +19,33 @@ repositories {
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("org.reactivestreams:reactive-streams")
testRuntimeOnly("org.apache.logging.log4j:log4j-core")
}

tasks.all {
outputs.cacheIf { true }
}

tasks {
all {
outputs.cacheIf { true }
test {
jvmArgs("-Xshare:off", "-XX:+EnableDynamicAgentLoading")
useJUnitPlatform()
finalizedBy(jacocoTestReport)
}
jacocoTestReport {
dependsOn(test)
reports {
xml.required = true
csv.required = false
html.required = false
}
}
}

tasks.test {
jvmArgs("-Xshare:off")
useJUnitPlatform()
tasks.withType<Test>().configureEach {
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
}

apply(from = "dumpJsa.gradle.kts")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

@SpringBootTest
class SpringThreadConcurrencyApplicationTests {

@Test
void contextLoads() {
assertDoesNotThrow(() -> SpringThreadConcurrencyApplication.main(new String[]{}));
}

}
Loading