diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..3f87541daf --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: + - master + - develop + pull_request: + types: + - opened + - synchronize + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + name: Test and publish a snapshot + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.12.10, 2.11.12] + java: [adopt@1.11] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java and Scala + uses: olafurpg/setup-scala@v10 + with: + java-version: ${{ matrix.java }} + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: Runs tests and collect coverage + run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} coverage test coverageReport coverageAggregate + + # - name: Upload coverage report + # run: sbt ++${{ matrix.scala }} coverageReport coverageAggregate coveralls + # env: + # COVERALLS_REPO_TOKEN: $${{ secrets.COVERALLS_REPO_TOKEN }} + + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v1 + with: + fail_ci_if_error: true + + - name: Publish a snapshot ${{ github.ref }} + run: sbt ++${{ matrix.scala }} publish + env: + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..cb74691dff --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Publish a release + +on: + release: + types: [published] + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + publish_release: + name: Publish release to Sonatype + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Java and Scala + uses: olafurpg/setup-scala@v10 + with: + java-version: adopt@1.11 + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: Import GPG key + run: ci/import_gpg.sh + env: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + + - name: Publish release ${{ github.ref }} + run: sbt +publishSigned sonatypeBundleRelease + env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/.gitignore b/.gitignore index 47dc20e13e..d621df577a 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,5 @@ spam-tests/ .bloop/ .metals/ .vscode/ -project/metals.sbt \ No newline at end of file +project/metals.sbt +/project/project/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 002d418bda..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -sudo: required -dist: trusty -before_cache: -- find $HOME/.sbt -name "*.lock" | xargs rm -- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm -cache: - directories: - - "$HOME/.ivy2/cache" - - "$HOME/.sbt" -language: scala -scala: - - 2.12.10 - - 2.11.12 -jdk: -- oraclejdk8 -stages: -- test -- name: release - if: tag =~ ^v -- name: snapshot - if: "(NOT tag IS present) AND (type = push)" -jobs: - include: - - stage: test - script: sbt -jvm-opts .travis.jvmopts +coverage +test && sbt +coverageReport coverageAggregate coveralls - - stage: release - # decrypt the private key (exported via https://docs.scala-lang.org/overviews/contributors/index.html#export-your-pgp-key-pair ) - script: openssl aes-256-cbc -K $encrypted_98cf3af00429_key -iv $encrypted_98cf3af00429_iv -in ci/secring.asc.enc -out ci/secring.asc -d && gpg --import ci/secring.asc && 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+dUn414BV3lelnWR3FdzhC7AUJqYWVfSILh1aj3STnizRnjtCScmyoRz4ldUQ3jr4jBJOREUEus5YH2EqY1MGjX+8kUu9IjDYiQyNy1EdivcmMlXCOcAW2mi4rGDRxZOeFt1ZSHzxqSghZOFwvk/OFcdDzV4/3OnAcGz8LH5qjZU/edjmfkSls5CqxuAFqeD7RZWIu0ccjt6dzQZAf02lBX9kQuwIruC4x4E0iEjml7jmaEeOT4Hqk7wAo6EFMSEkj4EnS/Kln6Wr7JBut5qrMk0+PDgvxaKCaN8LeycCSQdoXfPO602WzfasNcOJexSmGMAE5NYfeXjq1h3F9AVHJ3TbNAOdlQTHbSOqt7WO10JphljYnFEu4aSzvaA3E60= - - secure: g4Egz1orKgCAgTckMYHHbpsFY8ppldLLUkBi0GasHN4M2zhfYlqzaJ+ZZ4soMPNshcS3XutGS+/ERF5zrnHF1C9h3txW6AJkgMkTF1q4UyKan25chdPnz1nNUrdQOvaCA4CzLIN3aQAHN40p44ELxfNTARTfb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E4i9pndoCMJFxAOjirhw5OM3PfSWfb/mU7zXd4PSNK7RQIdOaPJff5C6UEM7h/iQ6riRZp1Pn7d/rxppTXsvUbtvwUYnkoOeUZyMvQNQsPI6Slns8jWl0zp5XiTmzSRVOuH3ME= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..ff928680e4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,4 @@ +## Releasing +To publish release version to Sonatype, do the following: +- make a tag with version number `vX.Y.Z` (used by `sbt-dynver` to set `version` in `build.sbt`); +- use the new tag to make a Github release, which triggers [`release.yml`](.github/workflows/release.yml) workflow and publishes release version to Sonatype; diff --git a/build.sbt b/build.sbt index 0cad69bd90..e6adf65cdf 100644 --- a/build.sbt +++ b/build.sbt @@ -43,39 +43,19 @@ lazy val commonSettings = Seq( , publishMavenStyle := true, - publishTo := sonatypePublishToBundle.value + publishTo := sonatypePublishToBundle.value, + scmInfo := Some( + ScmInfo( + url("https://github.com/ScorexFoundation/sigmastate-interpreter"), + "scm:git@github.com:ScorexFoundation/sigmastate-interpreter.git" + ) + ), ) -enablePlugins(GitVersioning) - -version in ThisBuild := { - if (git.gitCurrentTags.value.nonEmpty) { - git.gitDescribedVersion.value.get - } else { - if (git.gitHeadCommit.value.contains(git.gitCurrentBranch.value)) { - // see https://docs.travis-ci.com/user/environment-variables/#default-environment-variables - if (Try(sys.env("TRAVIS")).getOrElse("false") == "true") { - // pull request number, "false" if not a pull request - if (Try(sys.env("TRAVIS_PULL_REQUEST")).getOrElse("false") != "false") { - // build is triggered by a pull request - val prBranchName = Try(sys.env("TRAVIS_PULL_REQUEST_BRANCH")).get - val prHeadCommitSha = Try(sys.env("TRAVIS_PULL_REQUEST_SHA")).get - prBranchName + "-" + prHeadCommitSha.take(8) + "-SNAPSHOT" - } else { - // build is triggered by a push - val branchName = Try(sys.env("TRAVIS_BRANCH")).get - branchName + "-" + git.gitHeadCommit.value.get.take(8) + "-SNAPSHOT" - } - } else { - git.gitHeadCommit.value.get.take(8) + "-SNAPSHOT" - } - } else { - git.gitCurrentBranch.value + "-" + git.gitHeadCommit.value.get.take(8) + "-SNAPSHOT" - } - } -} - -git.gitUncommittedChanges in ThisBuild := true +// prefix version with "-SNAPSHOT" for builds without a git tag +dynverSonatypeSnapshots in ThisBuild := true +// use "-" instead of default "+" +dynverSeparator in ThisBuild := "-" val bouncycastleBcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.64" val scrypto = "org.scorexfoundation" %% "scrypto" % "2.1.10" diff --git a/.travis.jvmopts b/ci/ci.jvmopts similarity index 100% rename from .travis.jvmopts rename to ci/ci.jvmopts diff --git a/ci/import_gpg.sh b/ci/import_gpg.sh new file mode 100755 index 0000000000..b1eb66e0bd --- /dev/null +++ b/ci/import_gpg.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# setting up gpg2 for reading passphrase from parameters +# via https://github.com/beautiful-scala/scalastyle/blob/master/.github/workflows/release.yml#L16 +# from https://github.com/olafurpg/sbt-ci-release/issues/95 + +# setup gpg +mkdir ~/.gnupg && chmod 700 ~/.gnupg +echo use-agent >> ~/.gnupg/gpg.conf +echo pinentry-mode loopback >> ~/.gnupg/gpg.conf +echo allow-loopback-pinentry >> ~/.gnupg/gpg-agent.conf +chmod 600 ~/.gnupg/* +echo RELOADAGENT | gpg-connect-agent + +# decode key +# private key should be previously exported with: +# gpg --export-secret-keys [id] | base64 | pbcopy +# and stored as github repository secret under the following name (see env var name below) +printf "$GPG_SIGNING_KEY" | base64 --decode > ~/.gnupg/private.key + +# import key +gpg --no-tty --batch --yes --import ~/.gnupg/private.key diff --git a/ci/pubring.asc b/ci/pubring.asc deleted file mode 100644 index cf75b9dfab..0000000000 --- a/ci/pubring.asc +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mQENBF2utdgBCAClRGOfWeus4AlHvCBgJVXH2CLqXLKCBggE2vwKbKvFdW1DTPZQ -T1RI6zBtMdaSNVm4ISO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6CT1S57X6nTuYRP1dcjG -GVxvlybrDIBV0oDGW0TEjGWaBwKOpqZDi8Jzj5P398nqnP0UDrW7q/qmrZcdE5ov -qYWERLqXzGwBFwARAQABiQE8BBgBCAAmFiEEKOJ6Z66jjaRYxyIoypJUteBkD+QF -Al2utdgCGwwFCQPCZwAACgkQypJUteBkD+Qbqwf+IR030kbKsE6rOLwlKUGN9pah -tZjoSxnq5K+nXn621K578z9r76rGkP84UeAvZqt2MkadhwyEqwv99DftoZCXNM8b -5oRsDOAbA0YTSPKIa8E7S8XhWzE6VCx+2DFtjrYeGhybVGd9aq6jeQgEkqioZT0n -l3acH1VsuFQdFNwBrEgAFORBt5zXtSn7lXmnOh4ZFeYCncdR3+L6nJ/PAPz0hWMz -CZjc7vGcEvAtTNb2brtHtvox0Gc0Xphe0iCaWyzN7P32+rJgsfCMj9FFQUxToZMY -ozM9at2zWzk9wOb41RLnY+rGBNQ3xNR23shWF4fcOwk6BIp+OYsSqnsEYYXuDw== -=huRW ------END PGP PUBLIC KEY BLOCK----- diff --git a/ci/secring.asc.enc b/ci/secring.asc.enc deleted file mode 100644 index 2cc0474c89..0000000000 Binary files a/ci/secring.asc.enc and /dev/null differ diff --git a/project/build.properties b/project/build.properties index 72f902892a..c06db1bb2e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.2.7 +sbt.version=1.4.5 diff --git a/project/plugins.sbt b/project/plugins.sbt index 7964090b4d..b9cfa44119 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,9 +2,9 @@ logLevel := Level.Warn addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") 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.6.1") 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 +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0") +addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") \ No newline at end of file