From fb60a10f0e89e977d62e3ae2339fff1c1f48bf9e Mon Sep 17 00:00:00 2001 From: Marcin Zajaczkowski Date: Sat, 14 May 2016 21:28:13 +0200 Subject: [PATCH 1/6] Speed up Travis build --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad7126c071..eb6e4b6279 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,5 @@ jdk: - oraclejdk7 - oraclejdk8 -install: ./gradlew assemble -script: ./gradlew clean check funcTest install --stacktrace --continue && jdk_switcher use oraclejdk8 && ./scripts/runTests.sh +install: ./gradlew assemble -s +script: ./gradlew check funcTest install -s --continue && jdk_switcher use oraclejdk8 && ./scripts/runTests.sh From 430bcd016237355d5ffce2434998f701b05342b9 Mon Sep 17 00:00:00 2001 From: Marcin Zajaczkowski Date: Sat, 14 May 2016 00:06:43 +0200 Subject: [PATCH 2/6] Add SNAPSHOT archives upload --- .travis.yml | 11 +++++++++-- build.gradle | 5 ++++- gradle/release.gradle | 19 +++++++++++++++++++ gradle/releaseRoot.gradle | 16 ++++++++++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 gradle/releaseRoot.gradle diff --git a/.travis.yml b/.travis.yml index eb6e4b6279..17669d2150 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,15 @@ before_install: - "cp -r stub-runner/stub-runner-spring/src/test/resources/m2repo/repository/io/codearte/accurest/stubs $HOME/.m2/repository/io/codearte/accurest/" jdk: - - oraclejdk7 - oraclejdk8 install: ./gradlew assemble -s -script: ./gradlew check funcTest install -s --continue && jdk_switcher use oraclejdk8 && ./scripts/runTests.sh +script: ./gradlew check funcTest install -s --continue && jdk_switcher use oraclejdk8 && ./scripts/runTests.sh && jdk_switcher use $TRAVIS_JDK_VERSION && ./gradlew uploadSnapshotArchives -s + +matrix: + include: + # Automatic snapshot release only in Java 7 build + - jdk: oraclejdk7 + env: + - DO_RELEASE=true + diff --git a/build.gradle b/build.gradle index 73d3214e83..9cc73475f1 100644 --- a/build.gradle +++ b/build.gradle @@ -36,6 +36,8 @@ nexusStaging { stagingProfileId = '93c08fdebde1ff' } +apply from: "$rootDir/gradle/releaseRoot.gradle" + subprojects { apply plugin: 'groovy' apply from: "$rootDir/gradle/release.gradle" @@ -211,4 +213,5 @@ buildscript { } } -apply plugin: "com.palantir.idea-test-fix" \ No newline at end of file +apply plugin: "com.palantir.idea-test-fix" + diff --git a/gradle/release.gradle b/gradle/release.gradle index e3f5159bb1..e1c6fb4494 100644 --- a/gradle/release.gradle +++ b/gradle/release.gradle @@ -38,3 +38,22 @@ modifyPom { uploadArchives.dependsOn { check } + +task uploadSnapshotArchives { + if (shouldUploadSnapshotArchives) { + dependsOn { uploadArchives } + } + onlyIf { shouldUploadSnapshotArchives } +} + +//for Travis to leverage secure variables +project.ext { + if (!hasProperty('nexusUsername') && System.env.NEXUS_USERNAME) { + nexusUsername = System.env.NEXUS_USERNAME + } + if (!hasProperty('nexusPassword') && System.env.NEXUS_PASSWORD) { + nexusPassword = System.env.NEXUS_PASSWORD + } +} + + diff --git a/gradle/releaseRoot.gradle b/gradle/releaseRoot.gradle new file mode 100644 index 0000000000..667dcbcb82 --- /dev/null +++ b/gradle/releaseRoot.gradle @@ -0,0 +1,16 @@ +assert project == rootProject + +project.ext { + isSnapshot = project.version.endsWith("-SNAPSHOT") + currentBranch = System.env.TRAVIS_BRANCH + isPr = !isNullOrFalse(System.env.TRAVIS_PULL_REQUEST) + doRelease = !isNullOrFalse(System.env.DO_RELEASE) + shouldUploadSnapshotArchives = isSnapshot && currentBranch == 'master' && !isPr && doRelease +} + +logger.lifecycle("Automatic snapshot release: {} (isSnapshot: {}, currentBranch: {}, isPr: {}, doRelease: {})", shouldUploadSnapshotArchives, isSnapshot, currentBranch, isPr, doRelease) + +private boolean isNullOrFalse(def env) { + env == null || env == "false" || (env instanceof Boolean && !env) +} + From 3b9d86a62eaf0ddd18a478dfdc8fac54126937f8 Mon Sep 17 00:00:00 2001 From: Marcin Zajaczkowski Date: Sun, 15 May 2016 00:03:26 +0200 Subject: [PATCH 3/6] Add extra variables --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 17669d2150..1e3a304692 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,3 +21,8 @@ matrix: env: - DO_RELEASE=true +env: + global: + - secure: NbEQ9t5nGKW0LKmOSV4rTiEbYJARM2rynQBdSXkoILbp+nNaCD6uN41tUu8HrjgbjUDMepFUU+hmGQ47Q2vz5L3NzvW+oHBLgrIu6uAimpdR8qyBE899MBKPE19LsvUOeE9B9TydJgYlY+UEYgxwssUwxsN0RqyY4EErQWMNC8k= + - secure: zCjkMhjF5TbZehNmOK7EV68J35tuc0etWG/ia0eVTjgIv2kp9islJZ3+Jm/gDgkcv2Ydq3oAU2jFbVkUPSSstV3L5KANsighm2qn9tVzRrbTCfM55zcBhnoE0oZHTPNrLoScz0X5sM8Xuvi6ChjGf+lqAxnFW6tFMjx+1uhUIXU= + From f58754ecf0f74d53f038424e1e49a77dda1ddf8b Mon Sep 17 00:00:00 2001 From: Marcin Zajaczkowski Date: Sun, 15 May 2016 00:28:52 +0200 Subject: [PATCH 4/6] Add snapshot versions to documentation --- docs/src/docs/asciidoc/rest.adoc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/src/docs/asciidoc/rest.adoc b/docs/src/docs/asciidoc/rest.adoc index b956e77f29..27ccbec36a 100644 --- a/docs/src/docs/asciidoc/rest.adoc +++ b/docs/src/docs/asciidoc/rest.adoc @@ -29,6 +29,19 @@ dependencies { } ---- +====== Snapshot versions + +Add the additional snapshot repository to your build.gradle to use snapshot versions which are automatically uploaded after every successful build: + +[source,groovy,indent=0] +---- +repositories { + (...) + //Required only for SNAPSHOT versions + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } +} +---- + ===== Add maven plugin [source,xml,indent=0] @@ -375,4 +388,4 @@ Such tree will cause Accurest generating Wiremock's scenario with name `scenario - logout marked as `Step2` which will close the scenario. More details about Wiremock scenarios can be found under [http://wiremock.org/stateful-behaviour.html](http://wiremock.org/stateful-behaviour.html) -Accurest will also generate tests with guaranteed order of execution. \ No newline at end of file +Accurest will also generate tests with guaranteed order of execution. From 4fdbdb41e121b2c3fded348ba8a708b602fa2818 Mon Sep 17 00:00:00 2001 From: Marcin Zajaczkowski Date: Sun, 15 May 2016 00:41:09 +0200 Subject: [PATCH 5/6] Downgrade Axion plugin Due to a bug with three commits on release: https://github.com/allegro/axion-release-plugin/issues/132 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9cc73475f1..53eb33d85b 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { if (project.hasProperty('fatJar')) jcenter() } dependencies { - classpath "pl.allegro.tech.build:axion-release-plugin:1.3.4" + classpath "pl.allegro.tech.build:axion-release-plugin:1.3.2" classpath "com.bmuschko:gradle-nexus-plugin:2.3" classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3" if (project.hasProperty('fatJar')) classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' From 75442fb682c0d3391e6443ea8eaebe42e095a8d7 Mon Sep 17 00:00:00 2001 From: Marcin Zajaczkowski Date: Sun, 15 May 2016 00:57:43 +0200 Subject: [PATCH 6/6] Disable 'check' for uploadSnapshotArchives task To speed up the build until the reason for the second time tests execution will be found (the whole 'check' should be up-to-date).. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e3a304692..599d7dc7f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ jdk: - oraclejdk8 install: ./gradlew assemble -s -script: ./gradlew check funcTest install -s --continue && jdk_switcher use oraclejdk8 && ./scripts/runTests.sh && jdk_switcher use $TRAVIS_JDK_VERSION && ./gradlew uploadSnapshotArchives -s +script: ./gradlew check funcTest install -s --continue && jdk_switcher use oraclejdk8 && ./scripts/runTests.sh && jdk_switcher use $TRAVIS_JDK_VERSION && ./gradlew uploadSnapshotArchives -x check -s matrix: include: