From 3c4914d91cacd31d3614a49ec592632b3cd7141f Mon Sep 17 00:00:00 2001 From: CJ Hare Date: Fri, 12 Oct 2018 16:54:29 +1000 Subject: [PATCH] Release pipeline (#45) * Release plugin and rework of the Bintray plugin in Gradle, in-code ignoring tests that were being ignored at runtime on the CI. Signed-off-by: Adrian Sutton --- Jenkinsfile | 2 +- .../CreateAccountAcceptanceTest.java | 2 + .../RpcApisTogglesAcceptanceTest.java | 2 + .../mining/MiningAcceptanceTest.java | 2 + .../NewPendingTransactionAcceptanceTest.java | 2 + .../web3j/EventEmitterAcceptanceTest.java | 2 + build.gradle | 114 +++++++++++------- gradle.properties | 1 + 8 files changed, 83 insertions(+), 44 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bda4c2544f..27852816c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,7 +42,7 @@ node { sh './gradlew --no-daemon --parallel integrationTest' } stage('Acceptance Tests') { - sh './gradlew --no-daemon --parallel acceptanceTest --tests Web3Sha3AcceptanceTest --tests PantheonClusterAcceptanceTest --tests MiningAcceptanceTest' + sh './gradlew --no-daemon --parallel acceptanceTest' } stage('Check Licenses') { sh './gradlew --no-daemon --parallel checkLicenses' diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/CreateAccountAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/CreateAccountAcceptanceTest.java index 1a45a2d97a..251af54c06 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/CreateAccountAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/CreateAccountAcceptanceTest.java @@ -9,8 +9,10 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.account.Account; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; +@Ignore public class CreateAccountAcceptanceTest extends AcceptanceTestBase { private PantheonNode minerNode; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/RpcApisTogglesAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/RpcApisTogglesAcceptanceTest.java index 04afb62816..f9dc4dc075 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/RpcApisTogglesAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/RpcApisTogglesAcceptanceTest.java @@ -11,10 +11,12 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.web3j.protocol.Web3j; import org.web3j.protocol.exceptions.ClientConnectionException; +@Ignore public class RpcApisTogglesAcceptanceTest extends AcceptanceTestBase { private PantheonNode rpcEnabledNode; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/mining/MiningAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/mining/MiningAcceptanceTest.java index 3473d554e6..096d004a71 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/mining/MiningAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/mining/MiningAcceptanceTest.java @@ -8,8 +8,10 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.account.Account; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; +@Ignore public class MiningAcceptanceTest extends AcceptanceTestBase { private PantheonNode minerNode; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/pubsub/NewPendingTransactionAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/pubsub/NewPendingTransactionAcceptanceTest.java index fc95b6bf89..1cd04d2899 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/pubsub/NewPendingTransactionAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/pubsub/NewPendingTransactionAcceptanceTest.java @@ -16,8 +16,10 @@ import java.math.BigInteger; import io.vertx.core.Vertx; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; +@Ignore public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { private Vertx vertx; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/EventEmitterAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/EventEmitterAcceptanceTest.java index 1eae3c576f..ff398ff689 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/EventEmitterAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/EventEmitterAcceptanceTest.java @@ -13,6 +13,7 @@ import java.math.BigInteger; import java.util.concurrent.atomic.AtomicBoolean; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.web3j.crypto.Credentials; import org.web3j.protocol.core.methods.request.EthFilter; @@ -23,6 +24,7 @@ import rx.Observable; * This class is based around the EventEmitter solidity contract * */ +@Ignore public class EventEmitterAcceptanceTest extends AcceptanceTestBase { public static final BigInteger DEFAULT_GAS_PRICE = BigInteger.valueOf(1000); diff --git a/build.gradle b/build.gradle index b29557f808..ca295c1bb7 100644 --- a/build.gradle +++ b/build.gradle @@ -7,11 +7,14 @@ plugins { id 'com.github.hierynomus.license' version '0.14.0' id 'net.ltgt.errorprone' version '0.6' id 'me.champeau.gradle.jmh' version '0.4.5' apply false - id 'com.jfrog.bintray' version '1.7.3' + id 'com.jfrog.bintray' version '1.8.4' + id 'net.researchgate.release' version '2.6.0' } apply from: './versions.gradle' +group = 'tech.pegasys.pantheon' + defaultTasks 'build', 'checkLicenses', 'javadoc' def buildAliases = ['dev': [ @@ -47,15 +50,12 @@ def _strListCmdArg(name) { return _strListCmdArg(name, null) } -def baseVersion = '0.8.0' -project.version = baseVersion + '-SNAPSHOT' allprojects { apply plugin: 'java-library' apply plugin: 'io.spring.dependency-management' apply plugin: 'jacoco' apply plugin: 'net.ltgt.errorprone' - apply plugin: 'com.jfrog.bintray' apply from: "${rootDir}/gradle/versions.gradle" apply from: "${rootDir}/gradle/check-licenses.gradle" @@ -177,9 +177,6 @@ allprojects { task deploy() {} - - - subprojects { tasks.withType(Test) { @@ -231,7 +228,7 @@ subprojects { task integrationTest(type: Test, dependsOn:["compileTestJava"]){ group = "verification" - description = "Runs the Pantheon Integration Test" + description = "Runs the Pantheon integration tests" testClassesDirs = sourceSets.integrationTest.output.classesDirs classpath = sourceSets.integrationTest.runtimeClasspath @@ -259,41 +256,6 @@ subprojects { dependencies { jmh 'org.apache.logging.log4j:log4j-api' } } - - afterEvaluate { - if (project.jar.enabled) { - publishing { - publications { - MavenDeployment(MavenPublication) { - from components.java - groupId 'tech.pegasys.pantheon' - artifactId project.jar.baseName - version project.version - } - } - } - - bintray { - user = System.getenv('BINTRAY_USER') - key = System.getenv('BINTRAY_KEY') - publications = ['MavenDeployment'] - pkg { - repo = rootProject.name.toLowerCase() - name = rootProject.name.capitalize() - userOrg = 'consensys' - licenses = ['Apache-2.0'] - version { - name = project.version - desc = rootProject.name.capitalize() + ' distribution' - released = new Date() - vcsTag = project.version - } - } - } - - deploy.dependsOn bintrayUpload - } - } } jar { enabled = false } @@ -403,3 +365,69 @@ configure(subprojects.findAll {it.name != 'errorprone-checks'}) { if (!file("ethereum/referencetests/src/test/resources/README.md").exists()) { throw new GradleException("ethereum/referencetests/src/test/resources/README.md missing: please clone submodules (git submodule update --init --recursive)") } + + +apply plugin: 'net.researchgate.release' + +task releaseIntegrationTest(type: Test){ + for(TaskContainer taskList : subprojects.tasks){ + def subProjectIntegrationTask = taskList.findByName('integrationTest') + + if (subProjectIntegrationTask != null) { + dependsOn subProjectIntegrationTask + } + } +} + +task releaseReferenceTest(type: Test, dependsOn : ':ethereum:core:referenceTests'){ +} + +task releaseAcceptanceTest(type: Test, dependsOn : ':acceptance-tests:acceptanceTest') {} + +release { + preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: ' + tagCommitMessage = '[Gradle Release Plugin] - creating tag: ' + newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: ' + tagTemplate = '${version}' + versionPropertyFile = 'gradle.properties' + buildTasks = [ + 'build', + 'releaseIntegrationTest', + 'releaseAcceptanceTest', + 'releaseReferenceTest', + 'checkLicenses', + 'javadoc' + ] + + git { + requireBranch = 'release-pipeline' + pushToRemote = 'origin' + } +} + +apply plugin: 'com.jfrog.bintray' + +bintray { + user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') + key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY') + filesSpec { + from distTar.destinationDir.path + from distZip.destinationDir.path + into '.' + } + pkg { + repo = "pegasys-repo" + name = "pantheon" + userOrg = "consensys" + licenses = ["Apache-2.0"] + vcsUrl = "https://github.com/PegaSysEng/pantheon" + version { + name = project.version + released = new Date() + } + } +} + +afterReleaseBuild.dependsOn bintrayUpload +bintrayUpload.mustRunAfter(distTar) +bintrayUpload.mustRunAfter(distZip) diff --git a/gradle.properties b/gradle.properties index fad0c09400..f0184b844b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ org.gradle.jvmargs=-Xmx1g +version=0.0.8-SNAPSHOT