diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b68f193 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,85 @@ +name: CI + +on: + push: + branches: [ master ] + tags: + - '*' + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '12' + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt', 'project/**/*.scala') }} + + - name: Cache node_modules + uses: actions/cache@v2 + with: + path: | + ~/.npm + ~/.nvm + key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node_modules-cache-v2- + + - name: Extract Tag Name + run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV + if: ${{ startsWith(github.ref, 'refs/tags') }} + + - name: Run tests + run: | + sbt coverage test + sbt coverageAggregate coveralls + if: ${{ env.TAG_NAME == '' }} + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + + - name: Publish SNAPSHOT + run: sbt clean publish + if: ${{ !github.event.pull_request && env.TAG_NAME == '' }} + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + + - name: Publish RELEASE + run: | + mkdir ./keys + echo $PGP_PUBLIC | base64 --decode > ./keys/pubring.gpg + echo $PGP_SECRET | base64 --decode > ./keys/secring.gpg + VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)" + echo "Publish a release version=$VERSION for tag $TAG_NAME" + version=$VERSION sbt clean publishSigned sonatypeBundleRelease + if: ${{ env.TAG_NAME != '' }} + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + PGP_PUBLIC: ${{ secrets.PGP_PUBLIC }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASS: ${{ secrets.PGP_PASS }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 042ffb5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -language: scala -sudo: false -jdk: -- oraclejdk8 -dist: trusty -env: - global: - - TRAVIS_SBT_VERSION="1.2.8" - - secure: SVb4Odan6bePQ6v8BhAWYkW2JhHYiS4UojkmEZacEsobjgNAkI4qSGYjC8pcIvBUKnFPafHRG/ggtrZ8ml1beX9bXQxJsmGOutJEMuQyInPUDXdvUHABNBd/8NL8tJhZS6Ijnzbar6i78vizZNW88V9HpWwk2HZQyHw9q5mp1R0nHOG9L1474I62hnc/rclAPecWgUbiTft2mPXRohmb8aFhqAceYao+1g1LY4AuXyPiM3s4sU1YzdL/DJLWVbt8WUAmPUfiAKpGSQY98bBBxCfJrNDezIhENcY/MTo5+cGEcVtfJKu9psL5fShOPUChnnonHSb34/XWyocgN8ZrCQTfhqI1lIzB8HOc3nRiKwPfUcZ2MQ5P4fJi62rzfhEz8/r3HlvhKM+m1++wc7ocsb7+ku59xn93DWYkXKVkD2r3DnzaANd2FMFplopFSEgBJVGTKOXQSSVriMKeTpg2q13PvDhhUTIgOus4MX+n/q4XiAFLygCceRXq1mXFKi0sjWLrJkBldkg8VA1dL31RdK5ZN5K+56gSYPVhvOVeKx2URkbNDV3Y0z8rM33852VI7pdkRuGAZZFfKwVGOFlc5HcbLRln0e2oql1KtOWjyfFicT9pjHfeg2dfIrKBKMrJGavaLdh8kuX/0kKp37SdP+mJtVqJTwwoCXJol6tcl/s= - - secure: IblLuw3rbTHi3Bozgz2h5IUaL9Vf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DKxby5DFEuD0METtoYGEu7oZxRB/PZX0H6H+HmJpmPfbbgrZvQQOiTiUC+mgS2vCsQ+Zx/TWenLK9muj7YMFCJH1/PNdrNzqT74ic07dFjv9qBbVdNiLLrfLyVAhwilrkOCda+eGxmz94sTdfUggkw2Y4sgIg0vx6eyyXsac4Axi4ATuX2qhoQlRA+GmrqUsc/Se40/GnwPnJKmys0I5FB8EpQ/Wwq3CFgJ9353jFpbB0OcVcL4JskD8Mv/W1s= -before_install: -- nvm install 12 && - nvm use 12 -- node --version && - npm --version -- if [ $TRAVIS_PULL_REQUEST = 'false' ]; then - openssl aes-256-cbc -K $encrypted_76f871b6a7fb_key -iv $encrypted_76f871b6a7fb_iv -in travis/secrets.tar.enc -out travis/secrets.tar -d; - tar xv -C travis -f travis/secrets.tar; - fi -script: -- sbt clean coverage test && - sbt coverageAggregate coveralls && - if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" -o "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]; then - if [ -z "$TRAVIS_TAG" ]; then - echo "Publish a snapshot"; - sbt clean publish; - else - echo "Publish a release version=$TRAVIS_TAG"; - version=$TRAVIS_TAG sbt clean publishSigned sonatypeBundleRelease; - fi - else - echo "This is not a master branch commit. Skipping the publish/release step"; - fi -cache: - directories: - - ~/.npm - - ~/.nvm - - "$HOME/.ivy2/cache" - - "$HOME/.sbt" -before_cache: -# Cleanup the cached directories to avoid unnecessary cache updates -- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete -- find $HOME/.sbt -name "*.lock" -print -delete diff --git a/README.md b/README.md index 1bb7fb6..a93b5eb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Build Status](https://travis-ci.com/scommons/scommons-api.svg?branch=master)](https://travis-ci.com/scommons/scommons-api) +[![CI](https://github.com/scommons/scommons-api/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/scommons/scommons-api/actions/workflows/ci.yml?query=workflow%3Aci+branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/scommons/scommons-api/badge.svg?branch=master)](https://coveralls.io/github/scommons/scommons-api?branch=master) [![scala-index](https://index.scala-lang.org/scommons/scommons-api/scommons-api-core/latest.svg)](https://index.scala-lang.org/scommons/scommons-api/scommons-api-core) [![Scala.js](https://www.scala-js.org/assets/badges/scalajs-1.1.0.svg)](https://www.scala-js.org) diff --git a/pgp.sbt b/pgp.sbt index b25983a..5485218 100644 --- a/pgp.sbt +++ b/pgp.sbt @@ -1,7 +1,6 @@ +import java.util.Base64 //see: https://www.scala-sbt.org/sbt-pgp/usage.html - -useGpg := false -pgpPublicRing := file("./travis/pubring.gpg") -pgpSecretRing := file("./travis/secring.gpg") -pgpPassphrase := sys.env.get("PGP_PASS").map(_.toArray) +pgpPublicRing := file("./keys/pubring.gpg") +pgpSecretRing := file("./keys/secring.gpg") +pgpPassphrase := sys.env.get("PGP_PASS").map(p => new String(Base64.getDecoder.decode(p)).toArray) diff --git a/project/plugins.sbt b/project/plugins.sbt index 23d7ec7..48e4fbb 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,8 +1,8 @@ //resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/" resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" -addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0-SNAPSHOT").changing()) -//addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0") +//addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0-SNAPSHOT").changing()) +addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") diff --git a/project/src/main/scala/definitions/ScalaJsModule.scala b/project/src/main/scala/definitions/ScalaJsModule.scala index 9694cba..7e8d98a 100644 --- a/project/src/main/scala/definitions/ScalaJsModule.scala +++ b/project/src/main/scala/definitions/ScalaJsModule.scala @@ -5,7 +5,6 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ import sbt.Keys._ import sbt._ import scoverage.ScoverageKeys.{coverageEnabled, coverageScalacPluginVersion} -import scoverage.ScoverageSbtPlugin._ object ScalaJsModule { @@ -26,14 +25,14 @@ object ScalaJsModule { }, libraryDependencies ~= { modules => if (scalaJSVersion.startsWith("0.6")) modules - else modules.filter(_.organization != OrgScoverage) + else modules.filter(_.organization != "org.scoverage") }, libraryDependencies ++= { if (coverageEnabled.value) { if (scalaJSVersion.startsWith("0.6")) Nil else Seq( - OrgScoverage %% s"${ScalacRuntimeArtifact}_sjs1" % coverageScalacPluginVersion.value, - OrgScoverage %% ScalacPluginArtifact % coverageScalacPluginVersion.value % ScoveragePluginConfig.name + "org.scoverage" %% "scalac-scoverage-runtime_sjs1" % coverageScalacPluginVersion.value, + "org.scoverage" %% "scalac-scoverage-plugin" % coverageScalacPluginVersion.value % "scoveragePlugin" ) } else Nil diff --git a/travis/secrets.tar.enc b/travis/secrets.tar.enc deleted file mode 100644 index 2022d12..0000000 Binary files a/travis/secrets.tar.enc and /dev/null differ