diff --git a/.github/workflows/testcontainers-lifecycle-examples.yml b/.github/workflows/testcontainers-lifecycle-examples.yml new file mode 100644 index 0000000..58ca394 --- /dev/null +++ b/.github/workflows/testcontainers-lifecycle-examples.yml @@ -0,0 +1,25 @@ +name: 'testcontainers lifecycle examples' +on: [push] +env: + JAVA_VERSION: '17' +jobs: + testcontainers-lifecycle-examples: + name: testcontainers lifecycle examples + if: github.event.inputs.trigger == '' + || !startsWith(github.event.inputs.trigger, 'm') + || !startsWith(github.event.inputs.trigger, 'M') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + # 'temurin' 'zulu' 'adopt' 'adopt-hotspot' 'adopt-openj9' 'liberica' 'microsoft' + distribution: 'temurin' + java-version: ${{ env.JAVA_VERSION }} + - uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + maven- + - run: cd $GITHUB_WORKSPACE && ./mvnw -f testcontainers-lifecycle-examples diff --git a/testcontainers-lifecycle-examples/README.md b/testcontainers-lifecycle-examples/README.md new file mode 100644 index 0000000..5590b13 --- /dev/null +++ b/testcontainers-lifecycle-examples/README.md @@ -0,0 +1,30 @@ + +```bash +# use jdk 17 +./mvnw -f testcontainers-lifecycle-examples +``` + + diff --git a/testcontainers-lifecycle-examples/pom.xml b/testcontainers-lifecycle-examples/pom.xml new file mode 100644 index 0000000..db42dc8 --- /dev/null +++ b/testcontainers-lifecycle-examples/pom.xml @@ -0,0 +1,81 @@ + + + + org.springframework.boot + spring-boot-starter-parent + 2.7.13 + + + 4.0.0 + io.github.daggerok + testcontainers-lifecycle-examples + 0.0.1-SNAPSHOT + ${project.artifactId} + ${project.artifactId} + + 17 + 1.18.3 + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + org.springframework.boot + spring-boot-starter-web + + + + org.projectlombok + lombok + true + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.testcontainers + junit-jupiter + test + + + + + + + org.testcontainers + testcontainers-bom + ${testcontainers.version} + pom + import + + + + + clean verify + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + diff --git a/testcontainers-lifecycle-examples/src/main/java/io/github/daggerok/testcontainerslifecycleexamples/TestcontainersLifecycleExamplesApplication.java b/testcontainers-lifecycle-examples/src/main/java/io/github/daggerok/testcontainerslifecycleexamples/TestcontainersLifecycleExamplesApplication.java new file mode 100644 index 0000000..1f3fdca --- /dev/null +++ b/testcontainers-lifecycle-examples/src/main/java/io/github/daggerok/testcontainerslifecycleexamples/TestcontainersLifecycleExamplesApplication.java @@ -0,0 +1,13 @@ +package io.github.daggerok.testcontainerslifecycleexamples; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class TestcontainersLifecycleExamplesApplication { + + public static void main(String[] args) { + SpringApplication.run(TestcontainersLifecycleExamplesApplication.class, args); + } + +} diff --git a/testcontainers-lifecycle-examples/src/main/resources/application.yaml b/testcontainers-lifecycle-examples/src/main/resources/application.yaml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/testcontainers-lifecycle-examples/src/main/resources/application.yaml @@ -0,0 +1 @@ + diff --git a/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/JavaTestcontainersAnnotationTests.java b/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/JavaTestcontainersAnnotationTests.java new file mode 100644 index 0000000..94e31bb --- /dev/null +++ b/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/JavaTestcontainersAnnotationTests.java @@ -0,0 +1,13 @@ +package io.github.daggerok.testcontainerslifecycleexamples; + +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Test; + +@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) +class JavaTestcontainersAnnotationTests { + + @Test + void should_test() { + } +} diff --git a/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/PlainJavaTestcontainersTests.java b/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/PlainJavaTestcontainersTests.java new file mode 100644 index 0000000..7c89018 --- /dev/null +++ b/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/PlainJavaTestcontainersTests.java @@ -0,0 +1,13 @@ +package io.github.daggerok.testcontainerslifecycleexamples; + +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Test; + +@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) +class PlainJavaTestcontainersTests { + + @Test + void should_test() { + } +} diff --git a/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/SpringBootTestcontainersAnnotationIntegrationTests.java b/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/SpringBootTestcontainersAnnotationIntegrationTests.java new file mode 100644 index 0000000..e09dabf --- /dev/null +++ b/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/SpringBootTestcontainersAnnotationIntegrationTests.java @@ -0,0 +1,15 @@ +package io.github.daggerok.testcontainerslifecycleexamples; + +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) +class SpringBootTestcontainersAnnotationIntegrationTests { + + @Test + void should_test_context() { + } +} diff --git a/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/SpringBootTestcontainersIntegrationTests.java b/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/SpringBootTestcontainersIntegrationTests.java new file mode 100644 index 0000000..836b497 --- /dev/null +++ b/testcontainers-lifecycle-examples/src/test/java/io/github/daggerok/testcontainerslifecycleexamples/SpringBootTestcontainersIntegrationTests.java @@ -0,0 +1,15 @@ +package io.github.daggerok.testcontainerslifecycleexamples; + +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) +class SpringBootTestcontainersIntegrationTests { + + @Test + void should_test_context() { + } +} diff --git a/testcontainers-lifecycle-examples/src/test/resources/application-default.yaml b/testcontainers-lifecycle-examples/src/test/resources/application-default.yaml new file mode 100644 index 0000000..5e635c6 --- /dev/null +++ b/testcontainers-lifecycle-examples/src/test/resources/application-default.yaml @@ -0,0 +1,4 @@ +spring: + output: + ansi: + enabled: always