Skip to content

Commit fe62ccf

Browse files
authored
* Add Gradle with dependency sync from Maven * use Gradle on CircleCI * run Maven before Gradle to create initial folders structure * Shadowing, Maven publishing, build cache * Use Gradle 4.5 * store test results in CircleCI * fix tests * Create 'target' directory before running the tests, run tests in parallel on CircleCI * run selenium tests separately * change only Kafka module * now Travis * fix Travis config * mount .gradle into alpine container * polish Gradle config, fix publishing, add Delombok, move JAR file tests to Gradle * fix tab space * do not force verbose console * fix core tests * revert KafkaContainerTest change * push only from CircleCI's master branch * remove Maven, add more info to the generated pom, remove shade-test * flat modules structure, bintray publishing, BOM, remove virtuoso module * fix CI configs (use 'testcontainers' instead of 'core') * fix TravisCI config * release with Gradle * use Gradle for database-commons * simplify BOM's code * Force LF line endings for all text files This is introduced to allow the build remote cache on Windows. * Change capitalisation of the project name to the commonly used form, Testcontainers (testcontainers#573) * Fix broken link Fixes testcontainers#578 * Add ability to specify docker image in KafkaContainer. (testcontainers#580) * Add ability to specify docker image in KafkaContainer. * Added 'kafka.container.image' property to TestcontainersConfiguration in order to have an opportunity to replace default image with testcontainers.properties. * Return version argument to KafkaContainer constructor. * use Gradle's `check` task instead of just `test`, document how to disable build caching, * fix Travis' install
1 parent 4e15af8 commit fe62ccf

File tree

70 files changed

+735
-2116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+735
-2116
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
*.sh text eol=lf
1+
* text eol=lf

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ dependency-reduced-pom.xml
4343
# Gitbook
4444
_book/
4545
node_modules/
46+
47+
.gradle/
48+
build/

.mvn/wrapper/maven-wrapper.jar

-46.5 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,45 @@ language: java
22
jdk:
33
- oraclejdk8
44

5-
env:
6-
global:
7-
- secure: "lw8tahEBcjos2c5QMMoeE19AKZDDU+WoEg7bumZJ+wuLErBEwlJENYU1t1oW834s1s7wgJ1kgt3jQgO6AWxR9wkFgZC+ZMPK0y/92T4MRsmmrMJFzUiu77UGS9MBj/Hu8M7aBzFNtLf0w3JrN2IsVI1xsX2z8PkK6L/G8C/Gzac="
8-
- # ^^ OSSRH_JIRA_USERNAME
9-
- secure: "p8rkrCcHH5/EM7CKiPKQZCn1Lhzh7a+drGCHFrzHqWsZCapEXIgmqM0SYMnievaIBI+8IljdSkkW/BNfmIxW3fYDckLj91eEslLEhlIKDb91NtklDpr96o7on7wGF/VvpiEzIahKgp+LVsun/G1v3NU0T/RPs9QJoMmnQi4K+8I="
10-
- # ^^ OSSRH_JIRA_PASSWORD
11-
- secure: "CWGSIr/ig2rIWSJqnDtmrK+XcUayl80ydh+fbzwi0v4hFsbbcNzm4SXFR2+HBGTBlWpWapvJoyG2iii2RHbgxVwYSyG6fEBrxtQV1oD8B/JAJoc/VJgvCsNnO54WRACqEPgV8fUX7MfKThA4hpXL3jnhM2A8J7wM969H8e4jNHk="
12-
- # ^^ GPG_KEY_NAME
13-
- secure: "n2RjM3CIvtqMGMXYxjMOXjXB2R7k2lbZ2aV3fcQ0uSlrFqbzyRcTB/oa+Sft3ayUzU5S/qYjCPnNbb7P49vk1K3q5z2A9RVofFk9H90JPBz4cuuLcsuW7apcDPohDNuk47QAccsL0K+KA2AjdiQ/cIe81LWJykV+ogDI7DVXBDY="
14-
- # ^^ GPG_PASSPHRASE
15-
165
sudo: required
176
services:
187
- docker
198

209
cache:
2110
directories:
22-
- '$HOME/.m2'
11+
- '$HOME/.gradle'
2312

2413
install:
25-
- echo "MAVEN_OPTS='-XX:+TieredCompilation -XX:TieredStopAtLevel=1'" > ~/.mavenrc
26-
- ./mvnw -T4 -DskipTests=true -Dmaven.javadoc.skip=true install
14+
- ./gradlew build -x check
2715

2816
jobs:
2917
include:
3018
- stage: test
3119
env: [ NAME=core ]
32-
script: ./mvnw -pl core test
20+
script: ./gradlew testcontainers:check
3321

3422
- stage: test
3523
env: [ NAME=core ]
3624
jdk: oraclejdk9
37-
script:
38-
- ./mvnw -pl core test
25+
script: ./gradlew testcontainers:check
3926

4027
- env: [ NAME=selenium ]
41-
script: ./mvnw -pl modules/selenium test
28+
script: ./gradlew selenium:check
4229

4330
- env: [ NAME=modules ]
44-
script: ./mvnw -pl !core,!modules/selenium test
31+
script: ./gradlew check -x testcontainers:check -x selenium:check
4532

46-
# Run Docker-in-Docker tests inside Alpine and shading tests
47-
- env: [ NAME="docker-in-alpine-docker&shade" ]
33+
# Run Docker-in-Docker tests inside Alpine
34+
- env: [ NAME="docker-in-alpine-docker" ]
4835
script:
4936
- |
5037
DOCKER_HOST=unix:///var/run/docker.sock DOCKER_TLS_VERIFY= docker run -t --rm \
51-
-v "$HOME/.m2":/root/.m2/ \
38+
-v "$HOME/.gradle":/root/.gradle/ \
5239
-v /var/run/docker.sock:/var/run/docker.sock \
5340
-v "$(pwd)":"$(pwd)" \
5441
-w "$(pwd)" \
5542
openjdk:8-jdk-alpine \
56-
./mvnw -pl core test -Dtest=*GenericContainerRuleTest
57-
58-
- ./mvnw test -f shade-test/pom.xml
43+
./gradlew testcontainers:test --tests '*GenericContainerRuleTest'
5944
6045
- stage: deploy
6146
sudo: false
@@ -64,7 +49,7 @@ jobs:
6449
script: skip
6550
deploy:
6651
provider: script
67-
script: release/deploy.sh
52+
script: ./gradlew -Pversion=$TRAVIS_TAG release
6853
on:
6954
tags: true
7055
branch: master

RELEASING.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ Testcontainers' release process is automated as a Travis deployment. This descri
66

77
1. Ensure that the master branch is building and that tests are passing.
88
1. Ensure that the [`CHANGELOG`](CHANGELOG.md) file is up to date and includes all merged features.
9-
1. Create a new release on GitHub. **The tag name is used as the Maven version**, so please keep the tag name plain (e.g. 1.2.3).
9+
1. Create a new release on GitHub. **The tag name is used as the version**, so please keep the tag name plain (e.g. 1.2.3).
1010
1. Check that the Travis build passed.
1111
1. Release of published artifacts is fully automated. Once the Travis build completes, there are no further actions to perform on the repository.
1212
1. When available through Maven Central, poke [@whichrich](https://twitter.com/whichrich) to announce the release on Twitter!
1313

1414
## Internal details
1515

16-
* The signing and publishing steps are initiated as a script-type Travis CI deployment phase. The [`release/deploy.sh`](release/deploy.sh) script performs this process.
17-
* `mvn version:set` is applied to use the tag name to the version number for the build.
18-
* An encrypted GPG key within the `release` directory is used for signing. This key file is decrypted using Travis secrets.
19-
* Travis secrets also hold key passphrase and Maven Central API username/passwords that are used for publishing.
20-
* The publication process is automated using `nexus-staging-maven-plugin`.
16+
* The process is done with Gradle and Bintray.
17+
* Bintray will automatically promote the release to Maven Central.
18+
* Travis secrets hold Bintray username/passwords that are used for publishing.

bom/build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
description = "Testcontainers :: BOM"
2+
3+
publishing {
4+
publications {
5+
mavenJava(MavenPublication) { publication ->
6+
artifactId = "testcontainers-bom"
7+
artifacts = []
8+
9+
pom.withXml {
10+
def dependencyManagementNode = asNode().appendNode('dependencyManagement').appendNode('dependencies')
11+
12+
rootProject.subprojects.findAll { it != project }.each { subProject ->
13+
dependencyManagementNode.appendNode('dependency').with {
14+
appendNode('groupId', subProject.group)
15+
appendNode('artifactId',subProject.name)
16+
appendNode('version', subProject.version)
17+
}
18+
}
19+
}
20+
}
21+
}
22+
}

build.gradle

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
plugins {
2+
id 'io.franzbecker.gradle-lombok' version '1.11'
3+
id 'nebula.provided-base' version '3.0.3'
4+
id 'com.github.johnrengelman.shadow' version '2.0.2'
5+
id "com.jfrog.bintray" version "1.8.0" apply false
6+
}
7+
8+
subprojects {
9+
apply plugin: 'nebula.provided-base'
10+
apply plugin: 'java'
11+
apply plugin: 'idea'
12+
apply plugin: 'io.franzbecker.gradle-lombok'
13+
apply from: "$rootDir/gradle/publishing.gradle"
14+
apply from: "$rootDir/gradle/bintray.gradle"
15+
16+
group = "org.testcontainers"
17+
18+
sourceCompatibility = 1.8
19+
targetCompatibility = 1.8
20+
compileJava.options.encoding = 'UTF-8'
21+
22+
lombok {
23+
version = '1.16.20'
24+
}
25+
26+
task delombok(type: io.franzbecker.gradle.lombok.task.DelombokTask) {
27+
def outputDir = file("$buildDir/delombok")
28+
outputs.dir(outputDir)
29+
for (srcDir in project.sourceSets.main.java.srcDirs) {
30+
inputs.dir(srcDir)
31+
args(srcDir, "-d", outputDir)
32+
}
33+
}
34+
35+
project.tasks.sourceJar.from(delombok)
36+
37+
task release(dependsOn: bintrayUpload)
38+
39+
test {
40+
testLogging {
41+
displayGranularity 1
42+
showStackTraces = true
43+
exceptionFormat = 'full'
44+
events "STARTED", "PASSED", "FAILED", "SKIPPED"
45+
}
46+
}
47+
48+
repositories {
49+
jcenter()
50+
}
51+
52+
dependencies {
53+
testCompile 'ch.qos.logback:logback-classic:1.2.3'
54+
}
55+
}

circle.yml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,47 @@
11
version: 2
22
executorType: machine
33
jobs:
4-
build:
4+
core:
55
steps:
66
- checkout
7-
- run: ./mvnw -B test
7+
- run: ./gradlew testcontainers:check
8+
- run:
9+
name: Save test results
10+
command: |
11+
mkdir -p ~/junit/
12+
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
13+
when: always
14+
- store_test_results:
15+
path: ~/junit
16+
modules:
17+
steps:
18+
- checkout
19+
- run: ./gradlew check -x testcontainers:check -x selenium:check
20+
- run:
21+
name: Save test results
22+
command: |
23+
mkdir -p ~/junit/
24+
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
25+
when: always
26+
- store_test_results:
27+
path: ~/junit
28+
selenium:
29+
steps:
30+
- checkout
31+
- run: ./gradlew selenium:check
32+
- run:
33+
name: Save test results
34+
command: |
35+
mkdir -p ~/junit/
36+
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
37+
when: always
38+
- store_test_results:
39+
path: ~/junit
40+
41+
workflows:
42+
version: 2
43+
test_all:
44+
jobs:
45+
- core
46+
- modules
47+
- selenium

core/build.gradle

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
apply plugin: 'com.github.johnrengelman.shadow'
2+
3+
description = "Testcontainers Core"
4+
5+
publishing {
6+
publications {
7+
mavenJava(MavenPublication) { publication ->
8+
artifacts.removeAll { it.classifier == null }
9+
artifact project.tasks.shadowJar
10+
}
11+
}
12+
}
13+
14+
sourceSets {
15+
jarFileTest
16+
}
17+
18+
idea.module.testSourceDirs += sourceSets.jarFileTest.allSource.srcDirs
19+
20+
configurations {
21+
shaded
22+
[runtime, compileOnly, testCompile]*.extendsFrom shaded
23+
}
24+
25+
shadowJar {
26+
configurations = [project.configurations.shaded]
27+
classifier = null
28+
29+
mergeServiceFiles()
30+
31+
[
32+
'META-INF/io.netty.versions.properties',
33+
'META-INF/NOTICE',
34+
'META-INF/NOTICE.txt',
35+
'META-INF/LICENSE',
36+
'META-INF/LICENSE.txt',
37+
'META-INF/DEPENDENCIES',
38+
'META-INF/maven/',
39+
'META-INF/services/README.md',
40+
'META-INF/services/com.fasterxml.jackson.core.*',
41+
'META-INF/services/com.github.dockerjava.api.command.*',
42+
'META-INF/services/javax.ws.rs.ext.*',
43+
'META-INF/services/org.glassfish.hk2.extension.*',
44+
'META-INF/services/org.jvnet.hk2.external.generator.*',
45+
'META-INF/services/org.glassfish.jersey.internal.spi.*',
46+
'mozilla/public-suffix-list.txt',
47+
].each { exclude(it) }
48+
49+
relocate('META-INF/native/libnetty', 'META-INF/native/liborg-testcontainers-shaded-netty')
50+
51+
[
52+
"org.apache.http",
53+
"org.apache.commons.lang",
54+
"org.glassfish",
55+
"org.aopalliance",
56+
"org.jvnet",
57+
"javax.annotation",
58+
"javax.inject",
59+
"javax.ws.rs",
60+
"com.fasterxml.jackson",
61+
"jersey.repackaged",
62+
"com.google",
63+
"io.netty",
64+
"org.bouncycastle",
65+
"org.newsclub",
66+
"org.zeroturnaround"
67+
].each { relocate(it, "org.testcontainers.shaded.$it") }
68+
69+
dependencies {
70+
include(dependency('org.apache.httpcomponents:.*'))
71+
include(dependency('org.glassfish.*:.*'))
72+
include(dependency('org.aopalliance.*:.*'))
73+
include(dependency('javax.ws.rs:.*'))
74+
include(dependency('com.fasterxml.*:.*'))
75+
include(dependency('com.github.docker-java:.*'))
76+
include(dependency('com.google.guava:.*'))
77+
include(dependency('io.netty:.*'))
78+
include(dependency('org.bouncycastle:.*'))
79+
include(dependency('org.newsclub.*:.*'))
80+
include(dependency('org.zeroturnaround:zt-exec'))
81+
include(dependency('commons-lang:commons-lang'))
82+
}
83+
}
84+
85+
task jarFileTest(type: Test) {
86+
testClassesDirs = sourceSets.jarFileTest.output.classesDirs
87+
classpath = sourceSets.jarFileTest.runtimeClasspath
88+
89+
systemProperty("jarFile", shadowJar.outputs.files.singleFile)
90+
91+
dependsOn(shadowJar)
92+
}
93+
project.tasks.check.dependsOn(jarFileTest)
94+
95+
dependencies {
96+
compile 'junit:junit:4.12'
97+
compile 'org.slf4j:slf4j-api:1.7.25'
98+
compile 'org.slf4j:slf4j-ext:1.7.25'
99+
compile 'org.jetbrains:annotations:15.0'
100+
compile 'javax.annotation:javax.annotation-api:1.3.1'
101+
compile 'com.google.code.findbugs:jsr305:3.0.2'
102+
compile 'org.apache.commons:commons-compress:1.15'
103+
// Added for JDK9 compatibility since it's missing this package
104+
compile 'javax.xml.bind:jaxb-api:2.3.0'
105+
compile 'org.rnorth.duct-tape:duct-tape:1.0.6'
106+
compile 'org.rnorth.visible-assertions:visible-assertions:2.1.0'
107+
108+
shaded ('com.github.docker-java:docker-java:3.0.12') {
109+
exclude(group: 'org.glassfish.jersey.core')
110+
exclude(group: 'org.glassfish.jersey.connectors')
111+
exclude(group: 'log4j')
112+
exclude(group: 'com.google.code.findbug')
113+
}
114+
shaded 'javax.ws.rs:javax.ws.rs-api:2.0.1'
115+
shaded 'org.rnorth:tcp-unix-socket-proxy:1.0.1'
116+
shaded 'org.zeroturnaround:zt-exec:1.8'
117+
shaded 'commons-lang:commons-lang:2.6'
118+
// docker-java uses SslConfigurator from jersey-common for TLS
119+
shaded ('org.glassfish.jersey.core:jersey-common:2.23.1') {
120+
// SslConfigurator doesn't use classes from dependencies
121+
exclude(module: '*')
122+
}
123+
124+
testCompile 'redis.clients:jedis:2.8.0'
125+
testCompile 'com.rabbitmq:amqp-client:3.5.3'
126+
testCompile 'org.mongodb:mongo-java-driver:3.0.2'
127+
testCompile ('org.mockito:mockito-core:1.10.19') {
128+
exclude(module: 'hamcrest-core')
129+
}
130+
// Synthetic JAR used for MountableFileTest and DirectoryTarResourceTest
131+
testCompile files('testlib/repo/fakejar/fakejar/0/fakejar-0.jar')
132+
133+
jarFileTestCompileOnly 'org.projectlombok:lombok:1.16.20'
134+
jarFileTestCompile 'junit:junit:4.12'
135+
jarFileTestCompile 'org.assertj:assertj-core:3.8.0'
136+
jarFileTestCompile 'org.ow2.asm:asm-debug-all:5.2'
137+
}

0 commit comments

Comments
 (0)