diff --git a/.travis.yml b/.travis.yml index fe4bb11629..db05759cbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,42 @@ sudo: required dist: trusty - -# Tricks to avoid unnecessary cache updates before_cache: - - find $HOME/.sbt -name "*.lock" | xargs rm - - find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm - -# These directories are cached to S3 at the end of the build +- find $HOME/.sbt -name "*.lock" | xargs rm +- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm cache: directories: - - $HOME/.ivy2/cache - - $HOME/.sbt + - "$HOME/.ivy2/cache" + - "$HOME/.sbt" language: scala - jdk: - - oraclejdk8 - -script: - - sbt -jvm-opts .travis.jvmopts test -# enable scoverage after SpamSpecification timeout issue is resolved -# - sbt -jvm-opts .travis.jvmopts coverage test - -after_success: -# - sbt coverageReport coveralls - - sbt -jvm-opts .travis.jvmopts publish - +- oraclejdk8 +stages: +- test +# - coverage +- name: release + if: tag =~ ^v +- name: snapshot + if: NOT tag IS present +jobs: + include: + - stage: test + script: sbt -jvm-opts .travis.jvmopts test + # enable scoverage after SpamSpecification timeout issue is resolved + # script: sbt -jvm-opts .travis.jvmopts coverage test +# - stage: coverage +# script: sbt coverageReport coveralls + - stage: release + script: sbt -jvm-opts .travis.jvmopts publishSigned sonatypeBundleRelease + - stage: snapshot + script: sbt -jvm-opts .travis.jvmopts publish env: global: - secure: IGwd+lY2TfkAeX1SfzaYBwyhiiPaFrTxoF0e+4R1bkGxiGCce1hBYjn15z1HRfK+k3hgEZh/FBG7dv8LQfNWQ6AJY5PQ2zwckd4ArYMhTVpiY4eRzUMqO1/gjTCCbbTjfFKOMsR2pAw+TGeglqoX4eyziIaS8nR901dZcFvHuC1Fr5EdKFZ0x+WHnX8vaSQoDE4u1MoBnyo5cRVumXG+xvs1Q0nZXm/hd/Flfx5u3L7veKAkGtvbHmdsJoSSySTbc1MGYQtofQjbjd9AVvUhgfP32J63UCC2SqgWWKVvIjW+dUn414BV3lelnWR3FdzhC7AUJq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MeYCPNZZtKuV1gC4mZscvECm8r+kgB+o2G3i4tEIYcIC5Jbdcbjf4bk6uNZW/X3dna0irl/Mdswt7rTLzLan1rPz3k8Bylgs8ehETFBGr8HyNitEa8ODyaEXa84MPQaucXUmpHS+sUEhQn0Z70T70d1H9ZubUhGv9VLltNoSWkPGW5CPZlpQTHl63ZShfmylfQuQVTbVMdL8LLUHn2x2edlDKMGD8YPH5d+of0AKc3IKnlnMM36WjgYVsf1yehfLi0NH/b2Dzk7wLjetu/bw8Cu9Ne6/u0Lu83Hbh4DyS2iPQivDUGB+JXlHDFI4uji3GurnvpFDku1gbc4HVoFqhgOWyXQAiRllj2BXmq2vwp6797TUG4HrD2EVzIJV7eIZdWNN/QttZtNxNdSbBq8QQc92G2SU4q7PcogMSr0LpX05SfyL1sMgX2WeGzFzyMIu/+rAJhG0lPt7krBxEfQrRtTLdJ9eyeFjFQlxM6G/9gk68j+Nida6KunLwe9QEl2T+t1YbE4i9pndoCMJFxAOjirhw5OM3PfSWfb/mU7zXd4PSNK7RQIdOaPJff5C6UEM7h/iQ6riRZp1Pn7d/rxppTXsvUbtvwUYnkoOeUZyMvQNQsPI6Slns8jWl0zp5XiTmzSRVOuH3ME= +# decrypt the private key (exported via https://docs.scala-lang.org/overviews/contributors/index.html#export-your-pgp-key-pair ) +before_install: +- openssl aes-256-cbc -K $encrypted_98cf3af00429_key -iv $encrypted_98cf3af00429_iv + -in ci/secring.asc.enc -out ci/secring.asc -d +# import decrypted private key +before_script: gpg --import ci/secring.asc \ No newline at end of file diff --git a/build.sbt b/build.sbt index 929a3485ee..d80b2664ae 100644 --- a/build.sbt +++ b/build.sbt @@ -14,11 +14,8 @@ lazy val commonSettings = Seq( resolvers += Resolver.sonatypeRepo("public"), licenses := Seq("CC0" -> url("https://creativecommons.org/publicdomain/zero/1.0/legalcode")), homepage := Some(url("https://github.com/ScorexFoundation/sigmastate-interpreter")), + description := "Interpreter of a Sigma-State language", pomExtra := - - git@github.com:ScorexProject/scrypto.git - git@github.com:ScorexFoundation/sigmastate-interpreter.git - kushti @@ -30,14 +27,14 @@ lazy val commonSettings = Seq( Alexander Slesarenko https://github.com/aslesarenko/ + + greenhat + Denys Zadorozhnyi + https://github.com/greenhat/ + , publishMavenStyle := true, - publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isSnapshot.value) { Some("snapshots" at nexus + "content/repositories/snapshots") } - else { Some("releases" at nexus + "service/local/staging/deploy/maven2") } - } - + publishTo := sonatypePublishToBundle.value, ) enablePlugins(GitVersioning) @@ -137,13 +134,26 @@ publishArtifact in Test := true pomIncludeRepository := { _ => false } -credentials += Credentials(Path.userHome / ".sbt" / ".sigma-sonatype-credentials") +val credentialFile = Path.userHome / ".sbt" / ".sigma-sonatype-credentials" +credentials ++= (for { + file <- if (credentialFile.exists) Some(credentialFile) else None +} yield Credentials(file)).toSeq credentials ++= (for { username <- Option(System.getenv().get("SONATYPE_USERNAME")) password <- Option(System.getenv().get("SONATYPE_PASSWORD")) } yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq + +// PGP key for signing a release build published to sonatype +// signing is done by sbt-pgp plugin +// how to generate a key - https://central.sonatype.org/pages/working-with-pgp-signatures.html +// how to export a key and use it with Travis - https://docs.scala-lang.org/overviews/contributors/index.html#export-your-pgp-key-pair +pgpPublicRing := file("ci/pubring.asc") +pgpSecretRing := file("ci/secring.asc") +pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toArray) +usePgpKeyHex("28E27A67AEA38DA458C72228CA9254B5E0640FE4") + def libraryDefSettings = commonSettings ++ testSettings ++ Seq( scalacOptions ++= Seq( // s"-Xplugin:${file(".").absolutePath }/scalanizer/target/scala-2.12/scalanizer-assembly-core-opt-0d03a785-SNAPSHOT.jar" @@ -151,91 +161,102 @@ def libraryDefSettings = commonSettings ++ testSettings ++ Seq( ) lazy val common = Project("common", file("common")) - .settings(commonSettings ++ testSettings, - libraryDependencies ++= Seq( - "org.scala-lang" % "scala-reflect" % scalaVersion.value, - debox, commonsIo - )) + .settings(commonSettings ++ testSettings, + libraryDependencies ++= Seq( + "org.scala-lang" % "scala-reflect" % scalaVersion.value, + debox, commonsIo + )) + .settings(publish / skip := true) lazy val libraryapi = Project("library-api", file("library-api")) - .dependsOn(common % allConfigDependency) - .settings(libraryDefSettings :+ addCompilerPlugin(paradise), - libraryDependencies ++= Seq( - )) + .dependsOn(common % allConfigDependency) + .settings(libraryDefSettings :+ addCompilerPlugin(paradise), + libraryDependencies ++= Seq( + )) + .settings(publish / skip := true) lazy val libraryimpl = Project("library-impl", file("library-impl")) - .dependsOn(libraryapi % allConfigDependency) - .settings(libraryDefSettings, - libraryDependencies ++= Seq( debox )) + .dependsOn(libraryapi % allConfigDependency) + .settings(libraryDefSettings, + libraryDependencies ++= Seq( debox )) + .settings(publish / skip := true) lazy val core = Project("core", file("core")) - .dependsOn(common % allConfigDependency, libraryapi % allConfigDependency) - .settings(commonSettings, - libraryDependencies ++= Seq( configs, debox )) + .dependsOn(common % allConfigDependency, libraryapi % allConfigDependency) + .settings(commonSettings, + libraryDependencies ++= Seq( configs, debox )) + .settings(publish / skip := true) lazy val library = Project("library", file("library")) - .dependsOn(common % allConfigDependency, core % allConfigDependency, libraryapi, libraryimpl) - .settings(//commonSettings, - libraryDefSettings ++ testSettings, - libraryDependencies ++= Seq( debox )) + .dependsOn(common % allConfigDependency, core % allConfigDependency, libraryapi, libraryimpl) + .settings(//commonSettings, + libraryDefSettings ++ testSettings, + libraryDependencies ++= Seq( debox )) + .settings(publish / skip := true) lazy val sigmaconf = Project("sigma-conf", file("sigma-conf")) - .settings(commonSettings, - libraryDependencies ++= Seq( - plugin, libraryconf - )) + .settings(commonSettings, + libraryDependencies ++= Seq( + plugin, libraryconf + )) + .settings(publish / skip := true) lazy val scalanizer = Project("scalanizer", file("scalanizer")) - .dependsOn(sigmaconf, libraryapi, libraryimpl) - .settings(commonSettings, - libraryDependencies ++= Seq(meta, plugin), - assemblyOption in assembly ~= { _.copy(includeScala = false, includeDependency = true) }, - assemblyMergeStrategy in assembly := { - case PathList("scalan", xs @ _*) => MergeStrategy.first - case other => (assemblyMergeStrategy in assembly).value(other) - }, - artifact in(Compile, assembly) := { - val art = (artifact in(Compile, assembly)).value - art.withClassifier(Some("assembly")) - }, - addArtifact(artifact in(Compile, assembly), assembly) - ) + .dependsOn(sigmaconf, libraryapi, libraryimpl) + .settings(commonSettings, + libraryDependencies ++= Seq(meta, plugin), + assemblyOption in assembly ~= { _.copy(includeScala = false, includeDependency = true) }, + assemblyMergeStrategy in assembly := { + case PathList("scalan", xs @ _*) => MergeStrategy.first + case other => (assemblyMergeStrategy in assembly).value(other) + }, + artifact in(Compile, assembly) := { + val art = (artifact in(Compile, assembly)).value + art.withClassifier(Some("assembly")) + }, + addArtifact(artifact in(Compile, assembly), assembly) + ) + .settings(publish / skip := true) lazy val sigmaapi = Project("sigma-api", file("sigma-api")) - .dependsOn(common, libraryapi) - .settings(libraryDefSettings :+ addCompilerPlugin(paradise), - libraryDependencies ++= Seq( - macroCompat, scrypto, bouncycastleBcprov - )) + .dependsOn(common, libraryapi) + .settings(libraryDefSettings :+ addCompilerPlugin(paradise), + libraryDependencies ++= Seq( + macroCompat, scrypto, bouncycastleBcprov + )) + .settings(publish / skip := true) lazy val sigmaimpl = Project("sigma-impl", file("sigma-impl")) - .dependsOn( - sigmaapi % allConfigDependency, - libraryapi % allConfigDependency, - libraryimpl % allConfigDependency, - library % allConfigDependency) - .settings(libraryDefSettings, - libraryDependencies ++= Seq( scrypto, bouncycastleBcprov )) + .dependsOn( + sigmaapi % allConfigDependency, + libraryapi % allConfigDependency, + libraryimpl % allConfigDependency, + library % allConfigDependency) + .settings(libraryDefSettings, + libraryDependencies ++= Seq( scrypto, bouncycastleBcprov )) + .settings(publish / skip := true) lazy val sigmalibrary = Project("sigma-library", file("sigma-library")) - .dependsOn( - sigmaimpl % allConfigDependency, - common % allConfigDependency, - core % allConfigDependency, - libraryapi % allConfigDependency, - libraryimpl % allConfigDependency, - library % allConfigDependency) - .settings(libraryDefSettings, - libraryDependencies ++= Seq( - scrypto, - bouncycastleBcprov - )) + .dependsOn( + sigmaimpl % allConfigDependency, + common % allConfigDependency, + core % allConfigDependency, + libraryapi % allConfigDependency, + libraryimpl % allConfigDependency, + library % allConfigDependency) + .settings(libraryDefSettings, + libraryDependencies ++= Seq( + scrypto, + bouncycastleBcprov + )) + .settings(publish / skip := true) lazy val sigmastate = (project in file("sigmastate")) .dependsOn(sigmaimpl % allConfigDependency, sigmalibrary % allConfigDependency) .settings(libraryDefSettings) .settings(libraryDependencies ++= Seq( - scorexUtil, kiama, fastparse, circeCore, circeGeneric, circeParser)) + scorexUtil, kiama, fastparse, circeCore, circeGeneric, circeParser)) + .settings(publish / skip := true) lazy val sigma = (project in file(".")) .aggregate( diff --git a/ci/pubring.asc b/ci/pubring.asc new file mode 100644 index 0000000000..cf75b9dfab --- /dev/null +++ b/ci/pubring.asc @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBF2utdgBCAClRGOfWeus4AlHvCBgJVXH2CLqXLKCBggE2vwKbKvFdW1DTPZQ +T1RI6zBtMdaSNVm4ISO4dOO67VGdajr8/6kFt2+di2b7hMVaULf4UgYuZ+vvVUPp +3oSEJnHheh5ZfjV+jvL5GSAu+vgnC8qbPutCEpXBfx5zAOdLtiyegzx72asJvvkz +ghvyXVrg8gnXVtiSBV1EpfES7gZJmpuzv2dYrCtL2irlRlySLQ5JFKXrfOQvf4K9 +TCxRye1UNb+3ybL0ilXoRn3jDS9RLbLxiVMjjx/Bqk/mc3MNMoa+juzvI6xIxFG0 +3fwNOTXdQ6gLCjHJ9/nFvygkBW5bkeMujBhhABEBAAG0JlNpZ21hc3RhdGUgYm90 +IDxkZW55c0B6YWRvcm96aG55aS5jb20+iQFUBBMBCAA+FiEEKOJ6Z66jjaRYxyIo +ypJUteBkD+QFAl2utdgCGwMFCQPCZwAFCwkIBwIGFQoJCAsCBBYCAwECHgECF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e0iCaWyzN7P32+rJgsfCMj9FFQUxToZMY +ozM9at2zWzk9wOb41RLnY+rGBNQ3xNR23shWF4fcOwk6BIp+OYsSqnsEYYXuDw== +=huRW +-----END PGP PUBLIC KEY BLOCK----- diff --git a/ci/secring.asc.enc b/ci/secring.asc.enc new file mode 100644 index 0000000000..2cc0474c89 Binary files /dev/null and b/ci/secring.asc.enc differ diff --git a/project/plugins.sbt b/project/plugins.sbt index d4e535a944..0c2445295a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,4 +6,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") -addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") \ No newline at end of file +addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0") \ No newline at end of file