Skip to content

Commit

Permalink
Merge pull request #78 from ThoughtWorksInc/ci
Browse files Browse the repository at this point in the history
Set up CI on GitHub Actions instead of Travis CI and upgrade some dependencies
  • Loading branch information
Atry authored Jul 10, 2022
2 parents 3a0efc9 + bbe7df4 commit e2fc4f7
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 55 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
target/
local.sbt
secret/
.metals/
.bloop/
metals.sbt
.bsp/
.vscode/launch.json
*.scala.semanticdb
5 changes: 5 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image: igeolise/scalajs-test-runner:latest
vscode:
extensions:
- [email protected]:wQBBM+lKILHBqOqlqW60xA==
- [email protected]:EyAIfy0ykjUn9htpw3f7GA==
5 changes: 3 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
version = "1.5.1"
maxColumn = 120
runner.dialect = "scala213"
version = "3.1.1"
maxColumn = 80
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.watcherExclude": {
"**/target": true
}
}
16 changes: 8 additions & 8 deletions domains-cats/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down
Original file line number Diff line number Diff line change
@@ -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" - {

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.0
sbt.version=1.5.5
8 changes: 4 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")

Expand All @@ -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")
22 changes: 22 additions & 0 deletions project/plugins.sbt.scalajs06
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e2fc4f7

Please sign in to comment.