From 2198ea02d82e4c2b31a06bc83c49a0ab7db315db Mon Sep 17 00:00:00 2001 From: Tobias Schulte Date: Wed, 14 Oct 2015 22:54:04 +0200 Subject: [PATCH 1/5] chore(integration): fix handling of exitValue != 0 --- .../integration/SemanticReleasePluginIntegrationSpec.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/groovy/de/gliderpilot/gradle/semanticrelease/integration/SemanticReleasePluginIntegrationSpec.groovy b/src/test/groovy/de/gliderpilot/gradle/semanticrelease/integration/SemanticReleasePluginIntegrationSpec.groovy index bf09e9a..2e91be5 100644 --- a/src/test/groovy/de/gliderpilot/gradle/semanticrelease/integration/SemanticReleasePluginIntegrationSpec.groovy +++ b/src/test/groovy/de/gliderpilot/gradle/semanticrelease/integration/SemanticReleasePluginIntegrationSpec.groovy @@ -298,7 +298,7 @@ class SemanticReleasePluginIntegrationSpec extends IntegrationSpec { } def exitValue = process.waitFor() if (exitValue != 0) - throw new RuntimeException("failed to execute ${command.join(' ')}") + throw new RuntimeException("failed to execute ${args.join(' ')}") return lastLine } From 79ba9a9d93dfd8851a5db18e3b7345d6ca921d3f Mon Sep 17 00:00:00 2001 From: Tobias Schulte Date: Fri, 16 Oct 2015 20:02:25 +0200 Subject: [PATCH 2/5] chore(tests): Tests can be run for forked repos Closes #11 --- ...SemanticReleaseChangeLogServiceSpec.groovy | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/test/groovy/de/gliderpilot/gradle/semanticrelease/SemanticReleaseChangeLogServiceSpec.groovy b/src/test/groovy/de/gliderpilot/gradle/semanticrelease/SemanticReleaseChangeLogServiceSpec.groovy index 1bb5b14..75b036f 100644 --- a/src/test/groovy/de/gliderpilot/gradle/semanticrelease/SemanticReleaseChangeLogServiceSpec.groovy +++ b/src/test/groovy/de/gliderpilot/gradle/semanticrelease/SemanticReleaseChangeLogServiceSpec.groovy @@ -181,6 +181,7 @@ class SemanticReleaseChangeLogServiceSpec extends Specification { given: grgit = Grgit.open() changeLogService = new SemanticReleaseChangeLogService(grgit, tagStrategy) + String mnemo = changeLogService.mnemo() when: def commits = [ @@ -191,21 +192,21 @@ class SemanticReleaseChangeLogServiceSpec extends Specification { 'feat: baz\n\nCloses #159\n\nBREAKING CHANGE: This and that', 'foo bar'] def expected = """\ - # [2.0.0](https://github.com/tschulte/gradle-semantic-release-plugin/compare/v1.0.0...v2.0.0) (${ + # [2.0.0](https://github.com/$mnemo/compare/v1.0.0...v2.0.0) (${ new java.sql.Date(System.currentTimeMillis()) }) ### Bug Fixes - * no component ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567), closes #456, #789) + * no component ([1234567](https://github.com/$mnemo/commit/1234567), closes #456, #789) * **component1:** - * foo ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567), closes #123, #124) - * bar ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567)) - * **component2:** baz ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567), closes #123, #124) + * foo ([1234567](https://github.com/$mnemo/commit/1234567), closes #123, #124) + * bar ([1234567](https://github.com/$mnemo/commit/1234567)) + * **component2:** baz ([1234567](https://github.com/$mnemo/commit/1234567), closes #123, #124) ### Features - * baz ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567), closes #159) + * baz ([1234567](https://github.com/$mnemo/commit/1234567), closes #159) ### BREAKING CHANGES @@ -221,9 +222,12 @@ class SemanticReleaseChangeLogServiceSpec extends Specification { given: grgit = Grgit.open() changeLogService = new SemanticReleaseChangeLogService(grgit, tagStrategy) - changeLogService.github = new MkGithub("tschulte") - changeLogService.github.repos().create(Json.createObjectBuilder().add("name", "gradle-semantic-release-plugin").build()) - def coordinates = new Coordinates.Simple("tschulte/gradle-semantic-release-plugin") + String mnemo = changeLogService.mnemo() + String user = mnemo.substring(0, mnemo.indexOf("/")) + String repo = mnemo.substring(mnemo.indexOf("/") + 1) + changeLogService.github = new MkGithub(user) + changeLogService.github.repos().create(Json.createObjectBuilder().add("name", repo).build()) + def coordinates = new Coordinates.Simple("$mnemo") changeLogService.github.repos().get(coordinates).git().references().create("refs/tags/v1.0.0", "affe") changeLogService.changeLog = { List commits, ReleaseVersion version -> "${'changelog'}" From d74e7334f5a39815fd493bade89791e7522eae5b Mon Sep 17 00:00:00 2001 From: Tobias Schulte Date: Fri, 16 Oct 2015 21:39:59 +0200 Subject: [PATCH 3/5] chore(coverage): collect jacoco coverage during integration build --- .../SemanticReleasePluginIntegrationSpec.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/groovy/de/gliderpilot/gradle/semanticrelease/integration/SemanticReleasePluginIntegrationSpec.groovy b/src/test/groovy/de/gliderpilot/gradle/semanticrelease/integration/SemanticReleasePluginIntegrationSpec.groovy index 2e91be5..df5a0c7 100644 --- a/src/test/groovy/de/gliderpilot/gradle/semanticrelease/integration/SemanticReleasePluginIntegrationSpec.groovy +++ b/src/test/groovy/de/gliderpilot/gradle/semanticrelease/integration/SemanticReleasePluginIntegrationSpec.groovy @@ -19,6 +19,9 @@ import nebula.test.IntegrationSpec import spock.lang.Requires import spock.lang.Unroll +import java.lang.management.ManagementFactory +import java.lang.management.RuntimeMXBean + /** * Created by tobias on 7/2/15. */ @@ -28,6 +31,7 @@ import spock.lang.Unroll class SemanticReleasePluginIntegrationSpec extends IntegrationSpec { def setup() { + setupJvmArguments() setupGit() // create the gradle wrapper before the project is setup setupGradleWrapper() @@ -37,6 +41,13 @@ class SemanticReleasePluginIntegrationSpec extends IntegrationSpec { push() } + def setupJvmArguments() { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean() + String buildDir = new File('build').canonicalPath + jvmArguments = runtimeMxBean.getInputArguments().collect { it.replaceAll(/([:=])build/, '$1' + buildDir) } + file('gradle.properties') << "org.gradle.jvmargs=${jvmArguments.join(' ')}" + } + /** * Gradle-git seems to have issues when run using the nebula integration spec. * This results in the integration spec to publish to the real repo -- even creating tags there. From 312ea435442b417347c92177b8f65a93dc06085e Mon Sep 17 00:00:00 2001 From: Tobias Schulte Date: Fri, 16 Oct 2015 21:44:42 +0200 Subject: [PATCH 4/5] chore(coverage): try using jacoco instead of cobertura for coveralls --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cebef65..6d7f8b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ before_install: install: - echo "skip default gradlew assemble" script: -- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./gradlew release cobertura -Dorg.ajoberstar.grgit.auth.username=${GH_TOKEN} -Dorg.ajoberstar.grgit.auth.password -Dgradle.publish.key=${GRADLE_KEY} -Dgradle.publish.secret=${GRADLE_SECRET} --info --stacktrace || ./gradlew build cobertura --info --stacktrace' +- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./gradlew release -Dorg.ajoberstar.grgit.auth.username=${GH_TOKEN} -Dorg.ajoberstar.grgit.auth.password -Dgradle.publish.key=${GRADLE_KEY} -Dgradle.publish.secret=${GRADLE_SECRET} --info --stacktrace || ./gradlew build --info --stacktrace' after_success: From facce7b5cb0429b55c29d44d9b008256a9f930fe Mon Sep 17 00:00:00 2001 From: Tobias Schulte Date: Fri, 16 Oct 2015 22:45:29 +0200 Subject: [PATCH 5/5] chore(coverage): call jacocoTestReport in travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6d7f8b7..e4a3a49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,4 +27,4 @@ script: after_success: - - ./gradlew coveralls + - ./gradlew jacocoTestReport coveralls