diff --git a/Jenkinsfile.build b/Jenkinsfile.build index 6aaf19069f..945ccee116 100644 --- a/Jenkinsfile.build +++ b/Jenkinsfile.build @@ -4,16 +4,16 @@ pipeline { } environment { SBT_HOME = tool name: 'sbt-1.2.6', type: 'org.jvnet.hudson.plugins.SbtPluginBuilder$SbtInstallation' - SBT_OPTS = '-Xmx2g -XX:ReservedCodeCacheSize=128m -XX:+CMSClassUnloadingEnabled' + SBT_OPTS = '-Xmx2g -XX:ReservedCodeCacheSize=128m' PATH = "${env.SBT_HOME}/bin:${env.PATH}" } stages { - stage('Clean & Compile') { - steps { + stage('Cleanup') { + steps { sh 'git fetch --tags' sh 'find ~/.sbt/1.0/staging/*/waves -type d -name target | xargs -I{} rm -rf {}' sh 'find . -type d -name target | xargs -I{} rm -rf {}' - sh 'sbt "set Global / scalacOptions ++= Seq(\\"-Xfatal-warnings\\", \\"-Ywarn-unused:-imports\\");session save;cleanAll;compile"' + sh 'sbt "cleanAll"' } } stage('Release') { @@ -23,7 +23,7 @@ pipeline { } } } - + post { success { archiveArtifacts artifacts: 'release.tgz', fingerprint: true diff --git a/Jenkinsfile.tests b/Jenkinsfile.tests index af6b373fb7..9415310023 100644 --- a/Jenkinsfile.tests +++ b/Jenkinsfile.tests @@ -13,7 +13,7 @@ pipeline { PATH = "${env.SBT_HOME}/bin:${env.PATH}" } stages { - stage('Cleanup & Compile') { + stage('Cleanup') { steps { script { if (!(BRANCH_NAME ==~ /(DEX\-.*|master|version\-.*)/)) { @@ -21,29 +21,24 @@ pipeline { } } sh 'git fetch --tags' + sh 'docker system prune -f || true' + sh 'docker rmi `docker images --format "{{.Repository}}:{{.Tag}}" | grep "wavesplatform"` || true' sh 'find ~/.sbt/1.0/staging/*/waves -type d -name target | xargs -I{} rm -rf {}' - sh 'find . -type d \\( -name "test-reports" -o -name "allure-results" -o -name "target" \\) | xargs -I{} rm -rf {}' - sh 'sbt "set Global / scalacOptions ++= Seq(\\"-Xfatal-warnings\\", \\"-Ywarn-unused:-imports\\");session save;cleanAll;compile"' + sh 'find . -type d -name target | xargs -I{} rm -rf {}' + sh 'sbt "cleanAll"' } - } - stage('Run Unit Tests') { - steps { - sh 'sbt "waves-ext/test;waves-integration/test;dex/test"' - } - } - stage('Build Docker') { - steps { - sh 'docker rmi com.wavesplatform/it com.wavesplatform/node-it com.wavesplatform/dex-it || true' - sh 'sbt dex-it/docker' + } + stage('Build & Run All Tests') { + steps { + sh 'sbt "fullCheck"' } } - stage ('Run Integration Tests') { + stage ('Push images') { steps { - sh 'sbt dex-it/test' build job: 'Waves.Exchange/Matcher/Push Docker Images', propagate: false, wait: false, parameters: [ [$class: 'StringParameterValue', name: 'BRANCH', value: "${BRANCH_NAME}"] ] - } + } } } post { diff --git a/Jenkinsfile.tests.kafka b/Jenkinsfile.tests.kafka index b91077f57e..9aafd6e3e0 100644 --- a/Jenkinsfile.tests.kafka +++ b/Jenkinsfile.tests.kafka @@ -15,22 +15,18 @@ pipeline { PATH = "${env.SBT_HOME}/bin:${env.PATH}" } stages { - stage('Cleanup & Compile') { + stage('Cleanup') { steps { sh 'git fetch --tags' + sh 'docker system prune -f || true' + sh 'docker rmi `docker images --format "{{.Repository}}:{{.Tag}}" | grep "wavesplatform"` || true' sh 'find ~/.sbt/1.0/staging/*/waves -type d -name target | xargs -I{} rm -rf {}' sh 'find . -type d -name target | xargs -I{} rm -rf {}' - sh 'sbt "set Global / scalacOptions ++= Seq(\\"-Xfatal-warnings\\", \\"-Ywarn-unused:-imports\\");session save;cleanAll;compile"' + sh 'sbt "cleanAll"' } - } - stage('Run Unit Tests') { - steps { - sh 'sbt "waves-ext/test;waves-integration/test;dex/test"' - } - } + } stage('Build Docker') { - steps { - sh 'docker rmi com.wavesplatform/it com.wavesplatform/node-it com.wavesplatform/dex-it || true' + steps { sh 'sbt dex-it/docker' } } diff --git a/Jenkinsfile.tests.multiple-versions b/Jenkinsfile.tests.multiple-versions index 953f3b1d01..c01d5f69ed 100644 --- a/Jenkinsfile.tests.multiple-versions +++ b/Jenkinsfile.tests.multiple-versions @@ -11,37 +11,24 @@ pipeline { SBT_OPTS = '-Xmx2g -XX:ReservedCodeCacheSize=128m -XX:+CMSClassUnloadingEnabled' SCALATEST_INCLUDE_TAGS = 'com.wavesplatform.it.tags.DexMultipleVersions' KAFKA_SERVER = "${KAFKA_SERVER}" - DEX_MULTIPLE_VERSIONS_PREVIOUS_TAG = "${DEX_MULTIPLE_VERSIONS_PREVIOUS_TAG}" - NODE_MULTIPLE_VERSIONS_PREVIOUS_TAG = "${NODE_MULTIPLE_VERSIONS_PREVIOUS_TAG}" + OTHER_DEX_IMAGE = "${OTHER_DEX_IMAGE}" + OTHER_NODE_IMAGE = "${OTHER_NODE_IMAGE}" PATH = "${env.SBT_HOME}/bin:${env.PATH}" } stages { - stage('Cleanup & Compile') { + stage('Cleanup') { steps { sh 'git fetch --tags' + sh 'docker system prune -f || true' + sh 'docker rmi `docker images --format "{{.Repository}}:{{.Tag}}" | grep "wavesplatform"` || true' sh 'find ~/.sbt/1.0/staging/*/waves -type d -name target | xargs -I{} rm -rf {}' sh 'find . -type d -name target | xargs -I{} rm -rf {}' - sh 'sbt "set Global / scalacOptions ++= Seq(\\"-Xfatal-warnings\\", \\"-Ywarn-unused:-imports\\");session save;cleanAll;compile"' - } - } - stage('Run Unit Tests') { - steps { - sh 'sbt "waves-ext/test;waves-integration/test;dex/test"' + sh 'sbt "cleanAll"' } } stage('Build Docker') { steps { - sh 'docker rmi com.wavesplatform/it com.wavesplatform/node-it com.wavesplatform/dex-it || true' - sh "docker pull ${REGISTRY}/waves/dex/dex-it:${DEX_MULTIPLE_VERSIONS_PREVIOUS_TAG}" - sh "docker pull ${REGISTRY}/waves/dex/waves-integration-it:${NODE_MULTIPLE_VERSIONS_PREVIOUS_TAG}" - sh ''' - IMAGES=`docker image ls | grep "${REGISTRY}/waves/dex/" | awk -v r=${REGISTRY} '{gsub(r "/waves/dex/", "", $1); print $1 ":" $2}'` - for i in $IMAGES - do - docker tag ${REGISTRY}"/waves/dex/"$i "wavesplatform/"$i - done - ''' - sh 'sbt dex-it/docker' + sh 'sbt dex-it/docker' } } stage ('Run Integration Tests with multiple versions') { diff --git a/Jenkinsfile.tests.specified-versions b/Jenkinsfile.tests.specified-versions index 75d46306c1..8c7aa25048 100644 --- a/Jenkinsfile.tests.specified-versions +++ b/Jenkinsfile.tests.specified-versions @@ -16,32 +16,19 @@ pipeline { PATH = "${env.SBT_HOME}/bin:${env.PATH}" } stages { - stage('Cleanup & Compile') { + stage('Cleanup') { steps { sh 'git fetch --tags' + sh 'docker system prune -f || true' + sh 'docker rmi `docker images --format "{{.Repository}}:{{.Tag}}" | grep "wavesplatform"` || true' sh 'find ~/.sbt/1.0/staging/*/waves -type d -name target | xargs -I{} rm -rf {}' sh 'find . -type d -name target | xargs -I{} rm -rf {}' - sh 'sbt "set Global / scalacOptions ++= Seq(\\"-Xfatal-warnings\\", \\"-Ywarn-unused:-imports\\");session save;cleanAll;compile"' - } - } - stage('Run Unit Tests') { - steps { - sh 'sbt "waves-ext/test;waves-integration/test;dex/test"' + sh 'sbt "cleanAll"' } } stage('Build Docker') { steps { - sh 'docker rmi com.wavesplatform/it com.wavesplatform/node-it com.wavesplatform/dex-it || true' - sh "docker pull ${REGISTRY}/waves/dex/dex-it:${DEX_TAG}" - sh "docker pull ${REGISTRY}/waves/dex/waves-integration-it:${NODE_TAG}" - sh ''' - IMAGES=`docker image ls | grep "${REGISTRY}/waves/dex/" | awk -v r=${REGISTRY} '{gsub(r "/waves/dex/", "", $1); print $1 ":" $2}'` - for i in $IMAGES - do - docker tag ${REGISTRY}"/waves/dex/"$i "wavesplatform/"$i - done - ''' - sh 'sbt dex-it/docker' + sh 'sbt dex-it/docker' } } stage ('Run Integration Tests with specified versions') { diff --git a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/api/MultipleVersions.scala b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/api/MultipleVersions.scala index 50d38aacc3..484dfc595e 100644 --- a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/api/MultipleVersions.scala +++ b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/api/MultipleVersions.scala @@ -6,10 +6,13 @@ import com.wavesplatform.dex.it.dex.HasDex import com.wavesplatform.dex.it.docker.{DexContainer, WavesNodeContainer} trait MultipleVersions extends HasDex with HasWavesNode { self: BaseContainersKit => - private val dex2Tag = Option(System.getenv("DEX_MULTIPLE_VERSIONS_PREVIOUS_TAG")).getOrElse("latest") - private val node2Tag = Option(System.getenv("NODE_MULTIPLE_VERSIONS_PREVIOUS_TAG")).getOrElse("latest") + private lazy val dex2Image = Option(System.getenv("OTHER_DEX_IMAGE")) + .getOrElse(throw new RuntimeException("Please specify the OTHER_DEX_IMAGE environment variable")) - protected lazy val wavesNode2: WavesNodeContainer = createWavesNode("waves-2", tag = node2Tag, netAlias = None) + private lazy val node2Image = Option(System.getenv("OTHER_NODE_IMAGE")) + .getOrElse(throw new RuntimeException("Please specify the OTHER_NODE_IMAGE environment variable")) + + protected lazy val wavesNode2: WavesNodeContainer = createWavesNode("waves-2", image = node2Image, netAlias = None) protected def dex2SuiteConfig: Config = dexInitialSuiteConfig.withFallback { ConfigFactory.parseString( @@ -19,5 +22,5 @@ trait MultipleVersions extends HasDex with HasWavesNode { self: BaseContainersKi ) } - protected lazy val dex2: DexContainer = createDex("dex-2", suiteInitialConfig = dex2SuiteConfig, tag = dex2Tag) + protected lazy val dex2: DexContainer = createDex("dex-2", suiteInitialConfig = dex2SuiteConfig, image = dex2Image) } diff --git a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/api/node/HasWavesNode.scala b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/api/node/HasWavesNode.scala index a3bb64ccae..c68e084e3e 100644 --- a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/api/node/HasWavesNode.scala +++ b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/api/node/HasWavesNode.scala @@ -9,7 +9,8 @@ import com.wavesplatform.dex.it.fp.CanExtract import mouse.any._ trait HasWavesNode { self: BaseContainersKit => - private val defaultTag = Option(System.getenv("NODE_TAG")).getOrElse("latest") + protected val defaultNodeImage = "wavesplatform/waves-integration-it:latest" + private val nodeImage = Option(System.getenv("NODE_IMAGE")).getOrElse(defaultNodeImage) protected implicit def toNodeExplicitGetOps[F[_]: Functor: CanExtract](self: NodeApi[F]): NodeApiOps.ExplicitGetNodeApiOps[F] = { new NodeApiOps.ExplicitGetNodeApiOps[F](self) @@ -22,9 +23,9 @@ trait HasWavesNode { self: BaseContainersKit => protected def createWavesNode(name: String, runConfig: Config = wavesNodeRunConfig, suiteInitialConfig: Config = wavesNodeInitialSuiteConfig, - tag: String = defaultTag, + image: String = nodeImage, netAlias: Option[String] = Some(WavesNodeContainer.wavesNodeNetAlias)): WavesNodeContainer = - WavesNodeContainer(name, networkName, network, getIp(name), runConfig, suiteInitialConfig, localLogsDir, tag, netAlias) unsafeTap addKnownContainer + WavesNodeContainer(name, networkName, network, getIp(name), runConfig, suiteInitialConfig, localLogsDir, image, netAlias) unsafeTap addKnownContainer lazy val wavesNode1: WavesNodeContainer = createWavesNode("waves-1") } diff --git a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/config/GenesisConfigGenerator.scala b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/config/GenesisConfigGenerator.scala index cd29d5227f..f2183f9be7 100644 --- a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/config/GenesisConfigGenerator.scala +++ b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/config/GenesisConfigGenerator.scala @@ -114,6 +114,7 @@ object GenesisConfigGenerator { ConfigFactory.parseString( s"""waves.blockchain.custom { | address-scheme-character = "${generatorSettings.chainId.toChar}" + | functionality.min-block-time = ${settings.averageBlockDelay.toMillis}ms | genesis { | timestamp: ${settings.timestamp} | signature: ${genesisBlock.signerData.signature} diff --git a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/dex/HasDex.scala b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/dex/HasDex.scala index 12e9ba0580..913fadfaef 100644 --- a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/dex/HasDex.scala +++ b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/dex/HasDex.scala @@ -14,7 +14,8 @@ import org.apache.kafka.clients.admin.{AdminClient, NewTopic} import scala.jdk.CollectionConverters._ trait HasDex { self: BaseContainersKit => - private val defaultTag = Option(System.getenv("DEX_TAG")).getOrElse("latest") + protected val defaultDexImage = "wavesplatform/dex-it:latest" + private val dexImage = Option(System.getenv("DEX_IMAGE")).getOrElse(defaultDexImage) protected implicit def toDexExplicitGetOps[F[_]: CanExtract: Functor](self: DexApi[F]): DexApiOps.ExplicitGetDexApiOps[F] = { new DexApiOps.ExplicitGetDexApiOps[F](self) @@ -41,8 +42,8 @@ trait HasDex { self: BaseContainersKit => protected def createDex(name: String, runConfig: Config = dexRunConfig, suiteInitialConfig: Config = dexInitialSuiteConfig, - tag: String = defaultTag): DexContainer = - DexContainer(name, networkName, network, getIp(name), runConfig, suiteInitialConfig, localLogsDir, tag) unsafeTap addKnownContainer + image: String = dexImage): DexContainer = + DexContainer(name, networkName, network, getIp(name), runConfig, suiteInitialConfig, localLogsDir, image) unsafeTap addKnownContainer lazy val dex1: DexContainer = createDex("dex-1") diff --git a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/docker/DexContainer.scala b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/docker/DexContainer.scala index c622e10479..065c4821d6 100644 --- a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/docker/DexContainer.scala +++ b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/docker/DexContainer.scala @@ -51,13 +51,13 @@ object DexContainer extends ScorexLogging { runConfig: Config, suiteInitialConfig: Config, localLogsDir: Path, - tag: String)(implicit - tryHttpBackend: LoggingSttpBackend[Try, Nothing], - futureHttpBackend: LoggingSttpBackend[Future, Nothing], - ec: ExecutionContext): DexContainer = { + image: String)(implicit + tryHttpBackend: LoggingSttpBackend[Try, Nothing], + futureHttpBackend: LoggingSttpBackend[Future, Nothing], + ec: ExecutionContext): DexContainer = { val underlying = GenericContainer( - dockerImage = s"wavesplatform/dex-it:$tag", + dockerImage = image, exposedPorts = Seq(restApiPort), env = getEnv(name), waitStrategy = ignoreWaitStrategy diff --git a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/docker/WavesNodeContainer.scala b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/docker/WavesNodeContainer.scala index 7c3d25484a..df48dab596 100644 --- a/dex-it-common/src/main/scala/com/wavesplatform/dex/it/docker/WavesNodeContainer.scala +++ b/dex-it-common/src/main/scala/com/wavesplatform/dex/it/docker/WavesNodeContainer.scala @@ -66,14 +66,14 @@ object WavesNodeContainer extends ScorexLogging { runConfig: Config, suiteInitialConfig: Config, localLogsDir: Path, - tag: String, + image: String, netAlias: Option[String] = Some(wavesNodeNetAlias))(implicit tryHttpBackend: LoggingSttpBackend[Try, Nothing], futureHttpBackend: LoggingSttpBackend[Future, Nothing], ec: ExecutionContext): WavesNodeContainer = { val underlying = GenericContainer( - dockerImage = s"wavesplatform/waves-integration-it:$tag", + dockerImage = image, exposedPorts = List(restApiPort, networkPort, dexGrpcExtensionPort), env = getEnv(name, internalIp), waitStrategy = ignoreWaitStrategy diff --git a/dex-it/src/test/scala/com/wavesplatform/it/sync/networking/MultipleMatchersOrderCancelTestSuite.scala b/dex-it/src/test/scala/com/wavesplatform/it/sync/networking/MultipleMatchersOrderCancelTestSuite.scala index 4a4717277e..3bbbfd6f54 100644 --- a/dex-it/src/test/scala/com/wavesplatform/it/sync/networking/MultipleMatchersOrderCancelTestSuite.scala +++ b/dex-it/src/test/scala/com/wavesplatform/it/sync/networking/MultipleMatchersOrderCancelTestSuite.scala @@ -58,7 +58,7 @@ class MultipleMatchersOrderCancelTestSuite extends MatcherSuiteBase { val submittedOrders = (1 to 3).map { amt => mkOrderDP(acc2, wavesUsdPair, OrderType.BUY, amt.waves, amt) } - submittedOrders.foreach(placeAndAwaitAtDex(_, Status.Filled, dex2)) // <-- + submittedOrders.foreach(placeAndAwaitAtDex(_, Status.Filled, dex2)) submittedOrders.foreach(waitForOrderAtNode(_, dex2.api)) (0 to 2).foreach { i =>