From 423c09af131b2a0e7aa73464eb64a9f0da145d3b Mon Sep 17 00:00:00 2001 From: Hyeon-hak Kim <07ily@naver.com> Date: Thu, 28 Mar 2024 02:00:57 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Chore=20:=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=20=EC=B4=88=EA=B8=B0=ED=99=94=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ Feat : `.gitmessage` - import from `spring-templates/java-lotto` - 백엔드 개발 간 자주 사용될 것으로 예상되는 내용으로 수정 * 🚚 Chore : Spring 프로젝트 초기화 - Java/Spring Boot - BellSoft Liberica JDK 17 - Spring Web - [spring initializr](https://start.spring.io/#!type=gradle-project-kotlin&language=java&platformVersion=3.2.4&packaging=jar&jvmVersion=17&groupId=com.concurrency&artifactId=thread&name=spring-concurrency-thread&description=Examples%20of%20Java%20Thread%20Concurrency%20in%20Spring%20Framework&packageName=com.concurrency.thread&dependencies=web) * 🐛 Fix : 경고 억제를 위한 빌드 설정 - gradle deprecated usage - jvm CDS * ✨ Feat : Build Optimizing - enable build caching - enable CDS while execution * 🚚 Chore : GitHub Actions 통합 테스트 * 🐛 Fix : 유효하지 않은 캐시키 이슈 - `.gradle/caches`에 의존성 나열 * 🐛 Fix : remove redundancy - GitHub Actions의 자체 캐싱 활용 * ✨ Feat : test 정책 변경 - `main` 브랜치만 clean test 수행 * 🐛 Fix : 캐싱 기능 * 🐛 Fix : `main` 이외 브랜치 캐싱 * 📝 Docs : PR template * 🐛 Fix : `.gitmessage` format 추가 * 🎨 Style : polishing * 🚚 Chore : simplify dependency * ✨ Feat : JDK 21 with Jacoco (#15) * 🚚 Chore : 프로젝트 초기화 (#9) * ✨ Feat : `.gitmessage` - import from `spring-templates/java-lotto` - 백엔드 개발 간 자주 사용될 것으로 예상되는 내용으로 수정 * 🚚 Chore : Spring 프로젝트 초기화 - Java/Spring Boot - BellSoft Liberica JDK 17 - Spring Web - [spring initializr](https://start.spring.io/#!type=gradle-project-kotlin&language=java&platformVersion=3.2.4&packaging=jar&jvmVersion=17&groupId=com.concurrency&artifactId=thread&name=spring-concurrency-thread&description=Examples%20of%20Java%20Thread%20Concurrency%20in%20Spring%20Framework&packageName=com.concurrency.thread&dependencies=web) * 🐛 Fix : 경고 억제를 위한 빌드 설정 - gradle deprecated usage - jvm CDS * ✨ Feat : Build Optimizing - enable build caching - enable CDS while execution * 🚚 Chore : GitHub Actions 통합 테스트 * 🐛 Fix : 유효하지 않은 캐시키 이슈 - `.gradle/caches`에 의존성 나열 * 🐛 Fix : remove redundancy - GitHub Actions의 자체 캐싱 활용 * ✨ Feat : test 정책 변경 - `main` 브랜치만 clean test 수행 * 🐛 Fix : 캐싱 기능 * 🐛 Fix : `main` 이외 브랜치 캐싱 * 📝 Docs : PR template * 🐛 Fix : `.gitmessage` format 추가 * 🎨 Style : polishing * 🚚 Chore : simplify dependency * ✨ Feat : JDK 21 with Jacoco * 🔧 Modify : codecov-action 테스트 [codecov-action](https://github.com/codecov/codecov-action) --- .github/workflows/gradle-test-main.yml | 12 ++++++-- .github/workflows/gradle-test.yml | 13 ++++++-- build.gradle.kts | 30 ++++++++++++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- ...ringThreadConcurrencyApplicationTests.java | 2 ++ 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/.github/workflows/gradle-test-main.yml b/.github/workflows/gradle-test-main.yml index 339d9ff..537f7ec 100644 --- a/.github/workflows/gradle-test-main.yml +++ b/.github/workflows/gradle-test-main.yml @@ -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 diff --git a/.github/workflows/gradle-test.yml b/.github/workflows/gradle-test.yml index a166585..3f90416 100644 --- a/.github/workflows/gradle-test.yml +++ b/.github/workflows/gradle-test.yml @@ -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 @@ -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 diff --git a/build.gradle.kts b/build.gradle.kts index c68680f..dfe6a2a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ plugins { java + jacoco id("org.springframework.boot") version "3.2.4" id("io.spring.dependency-management") version "1.1.4" } @@ -8,7 +9,7 @@ group = "com.thread" version = "0.1.0-SNAPSHOT" java { - sourceCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 } repositories { @@ -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().configureEach { + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) } apply(from = "dumpJsa.gradle.kts") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6e59778..57d44f0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/src/test/java/com/thread/concurrency/SpringThreadConcurrencyApplicationTests.java b/src/test/java/com/thread/concurrency/SpringThreadConcurrencyApplicationTests.java index 2ca0759..675a607 100644 --- a/src/test/java/com/thread/concurrency/SpringThreadConcurrencyApplicationTests.java +++ b/src/test/java/com/thread/concurrency/SpringThreadConcurrencyApplicationTests.java @@ -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[]{})); } }