diff --git a/.github/workflows/ci-server.yml b/.github/workflows/ci-server.yml index 541ff24e..c991b9e7 100644 --- a/.github/workflows/ci-server.yml +++ b/.github/workflows/ci-server.yml @@ -14,7 +14,25 @@ on: workflow_dispatch: jobs: - ci: + unit-test: + name: Unit Test + runs-on: ubuntu-latest + steps: + - name: checkout@v4 + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: adopt + cache: gradle + timeout-minutes: 3 + + - name: Test + run: ./gradlew test + + integration-test: name: Build on Cassandra runs-on: ubuntu-latest strategy: @@ -36,5 +54,5 @@ jobs: run: docker compose -f "docker/docker-compose-cassandra-${{ matrix.cassandra-version }}.yml" up -d --build --wait timeout-minutes: 3 - - name: Build - run: ./gradlew build + - name: Test + run: ./gradlew integrationTest diff --git a/build.gradle b/build.gradle index a7bff68b..2bb22c67 100644 --- a/build.gradle +++ b/build.gradle @@ -52,8 +52,17 @@ subprojects { testRuntimeOnly("org.junit.platform:junit-platform-launcher") } + tasks.register('integrationTest', Test) { + group = "verification" + useJUnitPlatform { + includeTags 'integration-test' + } + } + tasks.named('test') { - useJUnitPlatform() + useJUnitPlatform { + excludeTags 'integration-test' + } testLogging { showExceptions = true exceptionFormat = 'FULL' diff --git a/cadio-core/src/test/java/kr/hakdang/cadio/IntegrationTest.java b/cadio-core/src/test/java/kr/hakdang/cadio/IntegrationTest.java index 87f2d65a..f717efb7 100644 --- a/cadio-core/src/test/java/kr/hakdang/cadio/IntegrationTest.java +++ b/cadio-core/src/test/java/kr/hakdang/cadio/IntegrationTest.java @@ -1,6 +1,7 @@ package kr.hakdang.cadio; import com.datastax.oss.driver.api.core.CqlSession; +import org.junit.jupiter.api.Tag; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; @@ -12,6 +13,7 @@ * @author seungh0 * @since 2024-07-01 */ +@Tag("integration-test") @SpringBootTest(classes = {CoreRoot.class}) public abstract class IntegrationTest extends BaseTest { diff --git a/cadio-web/src/test/java/kr/hakdang/cadio/web/IntegrationTest.java b/cadio-web/src/test/java/kr/hakdang/cadio/web/IntegrationTest.java index fe511dbd..edbac151 100644 --- a/cadio-web/src/test/java/kr/hakdang/cadio/web/IntegrationTest.java +++ b/cadio-web/src/test/java/kr/hakdang/cadio/web/IntegrationTest.java @@ -1,6 +1,7 @@ package kr.hakdang.cadio.web; import kr.hakdang.cadio.CoreRoot; +import org.junit.jupiter.api.Tag; import org.springframework.boot.test.context.SpringBootTest; /** @@ -9,6 +10,7 @@ * @author seungh0 * @since 2024-07-01 */ +@Tag("integration-test") @SpringBootTest(classes = {CoreRoot.class}) public abstract class IntegrationTest extends BaseTest { }