diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml new file mode 100644 index 00000000..4f329a14 --- /dev/null +++ b/.github/workflows/scala.yml @@ -0,0 +1,59 @@ +name: Scala CI + +on: +- push +- pull_request + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + scala: + - 2.11.12 + - 2.12.15 + - 2.13.7 + sbt-args: + - --addPluginSbtFile=project/plugins.sbt.scalajs06 + - '' + exclude: + - scala: 2.12.15 + sbt-args: --addPluginSbtFile=project/plugins.sbt.scalajs06 + - scala: 2.13.7 + sbt-args: --addPluginSbtFile=project/plugins.sbt.scalajs06 + include: + - scala: 2.12.13 + sbt-args: --addPluginSbtFile=project/plugins.sbt.scalajs06 + - scala: 2.13.4 + sbt-args: --addPluginSbtFile=project/plugins.sbt.scalajs06 + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Need the git history for sbt-dynver to determine the version + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: temurin + - name: Cache SBT + uses: actions/cache@v2 + with: + path: | + ~/.ivy2/local/ + ~/.ivy2/cache/ + ~/.sbt/ + ~/.coursier/ + key: | + ${{ runner.os }}-${{matrix.scala}}-${{ hashFiles('**/*.sbt') }} + ${{ runner.os }}-${{matrix.scala}}- + - name: Run tests + run: sbt ++${{ matrix.scala }} test + - name: Publish to Maven Central Repository + env: + GITHUB_PERSONAL_ACCESS_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}} + if: ${{ env.GITHUB_PERSONAL_ACCESS_TOKEN != '' }} + run: sbt ++${{ matrix.scala }} "set every Seq(sonatypeSessionName := \"${{github.workflow}} ${{github.run_id}}-${{github.run_number}}-${{github.run_attempt}}-$$ ${{ matrix.scala }}\", publishTo := sonatypePublishToBundle.value)" publishSigned sonatypeBundleRelease diff --git a/.gitignore b/.gitignore index d180f4bd..5701ab54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ target/ local.sbt secret/ +.metals/ +.bloop/ +metals.sbt +.bsp/ +.vscode/launch.json +*.scala.semanticdb diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..cd17bda2 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,5 @@ +image: igeolise/scalajs-test-runner:latest +vscode: + extensions: + - scala-lang.scala@0.3.8:wQBBM+lKILHBqOqlqW60xA== + - scalameta.metals@1.9.0:EyAIfy0ykjUn9htpw3f7GA== \ No newline at end of file diff --git a/.scalafmt.conf b/.scalafmt.conf index f216dbfd..26467aa1 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,2 +1,3 @@ -version = "1.5.1" -maxColumn = 120 \ No newline at end of file +runner.dialect = "scala213" +version = "3.1.1" +maxColumn = 80 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d910c33d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -sudo: required - -addons: - apt: - packages: - - graphviz - -language: scala - -scala: - - 2.11.12 - - 2.12.8 - - 2.13.0 - -jdk: - - openjdk8 - -before_cache: - - find $HOME/.sbt -name '*.lock' -delete - - find $HOME/.ivy2 -name 'ivydata-*.properties' -delete - -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt/boot/ - - $HOME/.coursier/ - -before_script: - -before_deploy: - -deploy: - - provider: script - script: sbt ++$TRAVIS_SCALA_VERSION "set every Seq(sonatypeSessionName := \"Travis Job $TRAVIS_JOB_NAME $TRAVIS_JOB_NUMBER ($TRAVIS_JOB_WEB_URL)\", publishTo := sonatypePublishToBundle.value)" publishSigned sonatypeBundleRelease - skip_cleanup: true - on: - all_branches: true - condition: $GITHUB_PERSONAL_ACCESS_TOKEN diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..32cfc61d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.watcherExclude": { + "**/target": true + } +} \ No newline at end of file diff --git a/domains-cats/build.sbt b/domains-cats/build.sbt index a17c5dfe..558d9ea0 100644 --- a/domains-cats/build.sbt +++ b/domains-cats/build.sbt @@ -4,21 +4,21 @@ libraryDependencies += "org.typelevel" %%% "cats-free" % "2.0.0" % Optional // F libraryDependencies += "org.typelevel" %%% "cats-core" % "2.0.0" -libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.8" % Test +libraryDependencies += "org.scalatest" %%% "scalatest" % "3.1.0" % Test -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-catch" % "1.5.2" +libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-catch" % "1.5.5" -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-monadic" % "1.5.2" +libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-monadic" % "1.5.5" -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-return" % "1.5.2" +libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-return" % "1.5.5" -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-shift" % "1.5.2" % Optional +libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-shift" % "1.5.5" % Optional -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-yield" % "1.5.2" % Optional +libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-yield" % "1.5.5" % Optional -addCompilerPlugin("com.thoughtworks.dsl" %% "compilerplugins-bangnotation" % "1.5.2") +addCompilerPlugin("com.thoughtworks.dsl" %% "compilerplugins-bangnotation" % "1.5.5") -addCompilerPlugin("com.thoughtworks.dsl" %% "compilerplugins-reseteverywhere" % "1.5.2") +addCompilerPlugin("com.thoughtworks.dsl" %% "compilerplugins-reseteverywhere" % "1.5.5") scalacOptions ++= { import Ordering.Implicits._ diff --git a/domains-cats/src/test/scala/com/thoughtworks/dsl/domains/catsSpec.scala b/domains-cats/src/test/scala/com/thoughtworks/dsl/domains/catsSpec.scala index f2de838c..59c2c976 100644 --- a/domains-cats/src/test/scala/com/thoughtworks/dsl/domains/catsSpec.scala +++ b/domains-cats/src/test/scala/com/thoughtworks/dsl/domains/catsSpec.scala @@ -1,14 +1,15 @@ package com.thoughtworks.dsl.domains -import org.scalatest.{FreeSpec, Matchers} import _root_.cats.instances.stream._ import com.thoughtworks.dsl.keywords.{Monadic, Shift, Yield} import com.thoughtworks.dsl.domains.cats._ +import org.scalatest.freespec.AnyFreeSpec +import org.scalatest.matchers.should.Matchers /** * @author 杨博 (Yang Bo) */ -class catsSpec extends FreeSpec with Matchers { +class catsSpec extends AnyFreeSpec with Matchers { "Given a continuation that uses Yield and Monadic expressions" - { diff --git a/project/build.properties b/project/build.properties index dfa772b9..10fd9eee 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.0 \ No newline at end of file +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt index 69831381..50b4576a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.thoughtworks.sbt-best-practice" % "sbt-best-practice" % "7.1.1") +addSbtPlugin("com.thoughtworks.sbt-best-practice" % "sbt-best-practice" % "8.2.1") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1") @@ -8,8 +8,8 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2") addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.2") -addSbtPlugin("com.thoughtworks.example" % "sbt-example" % "6.0.1") +addSbtPlugin("com.thoughtworks.example" % "sbt-example" % "7.0.0") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.31") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") diff --git a/project/plugins.sbt.scalajs06 b/project/plugins.sbt.scalajs06 new file mode 100644 index 00000000..df1f1fb1 --- /dev/null +++ b/project/plugins.sbt.scalajs06 @@ -0,0 +1,22 @@ +// An optional sbt file to replace Scala.js 1.0 with 0.6 +dependencyOverrides += Defaults.sbtPluginExtra( + "org.scala-js" % "sbt-scalajs" % "0.6.33", + sbtBinaryVersion.value, + scalaBinaryVersion.value, +) + +Compile / sourceGenerators += Def.task { + val file = (Compile / sourceManaged).value / "SkipPublishForNonScalaJSProjects.scala" + IO.write(file, """ + import scalajscrossproject.ScalaJSCrossPlugin.autoImport._ + import sbtcrossproject.CrossPlugin.autoImport._ + import sbt._, Keys._ + object SkipPublishForNonScalaJSProjects extends AutoPlugin { + override def trigger = allRequirements + override def projectSettings = Seq( + publish / skip := crossProjectPlatform.?.value != Some(JSPlatform) + ) + } + """) + Seq(file) +}.taskValue \ No newline at end of file