Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bsideup authored Feb 11, 2018
1 parent 4e15af8 commit fe62ccf
Show file tree
Hide file tree
Showing 70 changed files with 735 additions and 2,116 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.sh text eol=lf
* text eol=lf
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ dependency-reduced-pom.xml
# Gitbook
_book/
node_modules/

.gradle/
build/
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 0 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties

This file was deleted.

37 changes: 11 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,45 @@ language: java
jdk:
- oraclejdk8

env:
global:
- secure: "lw8tahEBcjos2c5QMMoeE19AKZDDU+WoEg7bumZJ+wuLErBEwlJENYU1t1oW834s1s7wgJ1kgt3jQgO6AWxR9wkFgZC+ZMPK0y/92T4MRsmmrMJFzUiu77UGS9MBj/Hu8M7aBzFNtLf0w3JrN2IsVI1xsX2z8PkK6L/G8C/Gzac="
- # ^^ OSSRH_JIRA_USERNAME
- secure: "p8rkrCcHH5/EM7CKiPKQZCn1Lhzh7a+drGCHFrzHqWsZCapEXIgmqM0SYMnievaIBI+8IljdSkkW/BNfmIxW3fYDckLj91eEslLEhlIKDb91NtklDpr96o7on7wGF/VvpiEzIahKgp+LVsun/G1v3NU0T/RPs9QJoMmnQi4K+8I="
- # ^^ OSSRH_JIRA_PASSWORD
- secure: "CWGSIr/ig2rIWSJqnDtmrK+XcUayl80ydh+fbzwi0v4hFsbbcNzm4SXFR2+HBGTBlWpWapvJoyG2iii2RHbgxVwYSyG6fEBrxtQV1oD8B/JAJoc/VJgvCsNnO54WRACqEPgV8fUX7MfKThA4hpXL3jnhM2A8J7wM969H8e4jNHk="
- # ^^ GPG_KEY_NAME
- secure: "n2RjM3CIvtqMGMXYxjMOXjXB2R7k2lbZ2aV3fcQ0uSlrFqbzyRcTB/oa+Sft3ayUzU5S/qYjCPnNbb7P49vk1K3q5z2A9RVofFk9H90JPBz4cuuLcsuW7apcDPohDNuk47QAccsL0K+KA2AjdiQ/cIe81LWJykV+ogDI7DVXBDY="
- # ^^ GPG_PASSPHRASE

sudo: required
services:
- docker

cache:
directories:
- '$HOME/.m2'
- '$HOME/.gradle'

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

jobs:
include:
- stage: test
env: [ NAME=core ]
script: ./mvnw -pl core test
script: ./gradlew testcontainers:check

- stage: test
env: [ NAME=core ]
jdk: oraclejdk9
script:
- ./mvnw -pl core test
script: ./gradlew testcontainers:check

- env: [ NAME=selenium ]
script: ./mvnw -pl modules/selenium test
script: ./gradlew selenium:check

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

# Run Docker-in-Docker tests inside Alpine and shading tests
- env: [ NAME="docker-in-alpine-docker&shade" ]
# Run Docker-in-Docker tests inside Alpine
- env: [ NAME="docker-in-alpine-docker" ]
script:
- |
DOCKER_HOST=unix:///var/run/docker.sock DOCKER_TLS_VERIFY= docker run -t --rm \
-v "$HOME/.m2":/root/.m2/ \
-v "$HOME/.gradle":/root/.gradle/ \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)":"$(pwd)" \
-w "$(pwd)" \
openjdk:8-jdk-alpine \
./mvnw -pl core test -Dtest=*GenericContainerRuleTest
- ./mvnw test -f shade-test/pom.xml
./gradlew testcontainers:test --tests '*GenericContainerRuleTest'
- stage: deploy
sudo: false
Expand All @@ -64,7 +49,7 @@ jobs:
script: skip
deploy:
provider: script
script: release/deploy.sh
script: ./gradlew -Pversion=$TRAVIS_TAG release
on:
tags: true
branch: master
10 changes: 4 additions & 6 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ Testcontainers' release process is automated as a Travis deployment. This descri

1. Ensure that the master branch is building and that tests are passing.
1. Ensure that the [`CHANGELOG`](CHANGELOG.md) file is up to date and includes all merged features.
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).
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).
1. Check that the Travis build passed.
1. Release of published artifacts is fully automated. Once the Travis build completes, there are no further actions to perform on the repository.
1. When available through Maven Central, poke [@whichrich](https://twitter.com/whichrich) to announce the release on Twitter!

## Internal details

* 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.
* `mvn version:set` is applied to use the tag name to the version number for the build.
* An encrypted GPG key within the `release` directory is used for signing. This key file is decrypted using Travis secrets.
* Travis secrets also hold key passphrase and Maven Central API username/passwords that are used for publishing.
* The publication process is automated using `nexus-staging-maven-plugin`.
* The process is done with Gradle and Bintray.
* Bintray will automatically promote the release to Maven Central.
* Travis secrets hold Bintray username/passwords that are used for publishing.
22 changes: 22 additions & 0 deletions bom/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
description = "Testcontainers :: BOM"

publishing {
publications {
mavenJava(MavenPublication) { publication ->
artifactId = "testcontainers-bom"
artifacts = []

pom.withXml {
def dependencyManagementNode = asNode().appendNode('dependencyManagement').appendNode('dependencies')

rootProject.subprojects.findAll { it != project }.each { subProject ->
dependencyManagementNode.appendNode('dependency').with {
appendNode('groupId', subProject.group)
appendNode('artifactId',subProject.name)
appendNode('version', subProject.version)
}
}
}
}
}
}
55 changes: 55 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
plugins {
id 'io.franzbecker.gradle-lombok' version '1.11'
id 'nebula.provided-base' version '3.0.3'
id 'com.github.johnrengelman.shadow' version '2.0.2'
id "com.jfrog.bintray" version "1.8.0" apply false
}

subprojects {
apply plugin: 'nebula.provided-base'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'io.franzbecker.gradle-lombok'
apply from: "$rootDir/gradle/publishing.gradle"
apply from: "$rootDir/gradle/bintray.gradle"

group = "org.testcontainers"

sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'

lombok {
version = '1.16.20'
}

task delombok(type: io.franzbecker.gradle.lombok.task.DelombokTask) {
def outputDir = file("$buildDir/delombok")
outputs.dir(outputDir)
for (srcDir in project.sourceSets.main.java.srcDirs) {
inputs.dir(srcDir)
args(srcDir, "-d", outputDir)
}
}

project.tasks.sourceJar.from(delombok)

task release(dependsOn: bintrayUpload)

test {
testLogging {
displayGranularity 1
showStackTraces = true
exceptionFormat = 'full'
events "STARTED", "PASSED", "FAILED", "SKIPPED"
}
}

repositories {
jcenter()
}

dependencies {
testCompile 'ch.qos.logback:logback-classic:1.2.3'
}
}
44 changes: 42 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,47 @@
version: 2
executorType: machine
jobs:
build:
core:
steps:
- checkout
- run: ./mvnw -B test
- run: ./gradlew testcontainers:check
- run:
name: Save test results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
modules:
steps:
- checkout
- run: ./gradlew check -x testcontainers:check -x selenium:check
- run:
name: Save test results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
selenium:
steps:
- checkout
- run: ./gradlew selenium:check
- run:
name: Save test results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit

workflows:
version: 2
test_all:
jobs:
- core
- modules
- selenium
137 changes: 137 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
apply plugin: 'com.github.johnrengelman.shadow'

description = "Testcontainers Core"

publishing {
publications {
mavenJava(MavenPublication) { publication ->
artifacts.removeAll { it.classifier == null }
artifact project.tasks.shadowJar
}
}
}

sourceSets {
jarFileTest
}

idea.module.testSourceDirs += sourceSets.jarFileTest.allSource.srcDirs

configurations {
shaded
[runtime, compileOnly, testCompile]*.extendsFrom shaded
}

shadowJar {
configurations = [project.configurations.shaded]
classifier = null

mergeServiceFiles()

[
'META-INF/io.netty.versions.properties',
'META-INF/NOTICE',
'META-INF/NOTICE.txt',
'META-INF/LICENSE',
'META-INF/LICENSE.txt',
'META-INF/DEPENDENCIES',
'META-INF/maven/',
'META-INF/services/README.md',
'META-INF/services/com.fasterxml.jackson.core.*',
'META-INF/services/com.github.dockerjava.api.command.*',
'META-INF/services/javax.ws.rs.ext.*',
'META-INF/services/org.glassfish.hk2.extension.*',
'META-INF/services/org.jvnet.hk2.external.generator.*',
'META-INF/services/org.glassfish.jersey.internal.spi.*',
'mozilla/public-suffix-list.txt',
].each { exclude(it) }

relocate('META-INF/native/libnetty', 'META-INF/native/liborg-testcontainers-shaded-netty')

[
"org.apache.http",
"org.apache.commons.lang",
"org.glassfish",
"org.aopalliance",
"org.jvnet",
"javax.annotation",
"javax.inject",
"javax.ws.rs",
"com.fasterxml.jackson",
"jersey.repackaged",
"com.google",
"io.netty",
"org.bouncycastle",
"org.newsclub",
"org.zeroturnaround"
].each { relocate(it, "org.testcontainers.shaded.$it") }

dependencies {
include(dependency('org.apache.httpcomponents:.*'))
include(dependency('org.glassfish.*:.*'))
include(dependency('org.aopalliance.*:.*'))
include(dependency('javax.ws.rs:.*'))
include(dependency('com.fasterxml.*:.*'))
include(dependency('com.github.docker-java:.*'))
include(dependency('com.google.guava:.*'))
include(dependency('io.netty:.*'))
include(dependency('org.bouncycastle:.*'))
include(dependency('org.newsclub.*:.*'))
include(dependency('org.zeroturnaround:zt-exec'))
include(dependency('commons-lang:commons-lang'))
}
}

task jarFileTest(type: Test) {
testClassesDirs = sourceSets.jarFileTest.output.classesDirs
classpath = sourceSets.jarFileTest.runtimeClasspath

systemProperty("jarFile", shadowJar.outputs.files.singleFile)

dependsOn(shadowJar)
}
project.tasks.check.dependsOn(jarFileTest)

dependencies {
compile 'junit:junit:4.12'
compile 'org.slf4j:slf4j-api:1.7.25'
compile 'org.slf4j:slf4j-ext:1.7.25'
compile 'org.jetbrains:annotations:15.0'
compile 'javax.annotation:javax.annotation-api:1.3.1'
compile 'com.google.code.findbugs:jsr305:3.0.2'
compile 'org.apache.commons:commons-compress:1.15'
// Added for JDK9 compatibility since it's missing this package
compile 'javax.xml.bind:jaxb-api:2.3.0'
compile 'org.rnorth.duct-tape:duct-tape:1.0.6'
compile 'org.rnorth.visible-assertions:visible-assertions:2.1.0'

shaded ('com.github.docker-java:docker-java:3.0.12') {
exclude(group: 'org.glassfish.jersey.core')
exclude(group: 'org.glassfish.jersey.connectors')
exclude(group: 'log4j')
exclude(group: 'com.google.code.findbug')
}
shaded 'javax.ws.rs:javax.ws.rs-api:2.0.1'
shaded 'org.rnorth:tcp-unix-socket-proxy:1.0.1'
shaded 'org.zeroturnaround:zt-exec:1.8'
shaded 'commons-lang:commons-lang:2.6'
// docker-java uses SslConfigurator from jersey-common for TLS
shaded ('org.glassfish.jersey.core:jersey-common:2.23.1') {
// SslConfigurator doesn't use classes from dependencies
exclude(module: '*')
}

testCompile 'redis.clients:jedis:2.8.0'
testCompile 'com.rabbitmq:amqp-client:3.5.3'
testCompile 'org.mongodb:mongo-java-driver:3.0.2'
testCompile ('org.mockito:mockito-core:1.10.19') {
exclude(module: 'hamcrest-core')
}
// Synthetic JAR used for MountableFileTest and DirectoryTarResourceTest
testCompile files('testlib/repo/fakejar/fakejar/0/fakejar-0.jar')

jarFileTestCompileOnly 'org.projectlombok:lombok:1.16.20'
jarFileTestCompile 'junit:junit:4.12'
jarFileTestCompile 'org.assertj:assertj-core:3.8.0'
jarFileTestCompile 'org.ow2.asm:asm-debug-all:5.2'
}
Loading

0 comments on commit fe62ccf

Please sign in to comment.