From 7fac69919b0f3d6c8f2bab1cd417b872a4336ac7 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 1 Oct 2021 11:30:55 -0600 Subject: [PATCH] replace Travis-CI with GitHub Actions and also: * upgrade to sbt-scala-module 3.0.0 (was 2.4.0) * add JDK 17 to crossbuild --- .github/workflows/ci.yml | 25 ++++++++++++++++ .github/workflows/release.yml | 21 ++++++++++++++ .travis.yml | 25 ---------------- build.sbt | 2 ++ build.sh | 54 ----------------------------------- project/plugins.sbt | 2 +- 6 files changed, 49 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml delete mode 100755 build.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b06fd7c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: test +on: + push: + branches: + - main + pull_request: +jobs: + test: + strategy: + fail-fast: false + matrix: + java: [8, 11, 17] + scala: [2.13.6] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: coursier/cache-action@v6 + - uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: ${{matrix.java}} + - name: Test + run: sbt ++${{matrix.scala}} test package diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..dc33711 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Release +on: + push: + tags: ["*"] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 8 + - run: sbt versionCheck ci-release + env: + PGP_PASSPHRASE: ${{secrets.PGP_PASSPHRASE}} + PGP_SECRET: ${{secrets.PGP_SECRET}} + SONATYPE_PASSWORD: ${{secrets.SONATYPE_PASSWORD}} + SONATYPE_USERNAME: ${{secrets.SONATYPE_USERNAME}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 19f62c9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: ~> 1.0 # needed for imports - -import: scala/scala-dev:travis/default.yml - -language: scala - -scala: - - 2.13.6 - -env: - - SCALAJS_BUILD= ADOPTOPENJDK=8 - - SCALAJS_BUILD= ADOPTOPENJDK=11 - - SCALAJS_BUILD= ADOPTOPENJDK=17 - - SCALAJS_BUILD=true ADOPTOPENJDK=8 - - SCALAJS_BUILD=true ADOPTOPENJDK=11 - - SCALAJS_BUILD=true ADOPTOPENJDK=17 - -install: - - git fetch --tags # get all tags for sbt-dynver - -script: ./build.sh - -notifications: - email: - - seth.tisue@lightbend.com diff --git a/build.sbt b/build.sbt index 198e550..1a53815 100644 --- a/build.sbt +++ b/build.sbt @@ -1,3 +1,5 @@ +ThisBuild / scalaVersion := "2.13.6" + lazy val root = project.in(file(".")) .aggregate(scalaLibraryNextJVM, scalaLibraryNextJS) .settings( diff --git a/build.sh b/build.sh deleted file mode 100755 index a147701..0000000 --- a/build.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -set -e - -# Builds of tagged revisions are published to sonatype staging. - -# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. -# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. - -# sbt-dynver sets the version number from the tag -# sbt-travisci sets the Scala version from the travis job matrix - -# To back-publish an existing release for a new Scala / Scala.js / Scala Native version: -# - check out the tag for the version that needs to be published -# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary -# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g., -# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`) - -isReleaseJob() { - if [[ "$ADOPTOPENJDK" == "8" ]]; then - true - else - false - fi -} - -if [[ "$SCALAJS_BUILD" == "true" ]]; then - projectPrefix="scalaLibraryNextJS/" -else - projectPrefix="scalaLibraryNextJVM/" -fi - -verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#.*)?$" - -if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - versionCheckTask="versionCheck" - releaseTask="ci-release" - if ! isReleaseJob; then - echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" - exit 0 - fi -fi - -# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions -export CI_RELEASE="${projectPrefix}publishSigned" -export CI_SNAPSHOT_RELEASE="${projectPrefix}publish" - -# default is sonatypeBundleRelease, which closes and releases the staging repo -# see https://github.com/xerial/sbt-sonatype#commands -# for now, until we're confident in the new release scripts, just close the staging repo. -export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" - -sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $versionCheckTask $releaseTask diff --git a/project/plugins.sbt b/project/plugins.sbt index e1e1b9e..7d7de94 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.4.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")