diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..4af5711 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,32 @@ +name: Build +on: + pull_request: + branches: + - '*' + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Branch Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Java And Sbt + uses: olafurpg/setup-scala@v14 + with: + java-version: corretto@1.17 + - name: Cache + uses: actions/cache@v4 + with: + path: | + $HOME/.cache/coursier + $HOME/.ivy2/cache + $HOME/.sbt + key: ${{ runner.os }}-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - name: Build + run: sbt build + - name: Upload To Codecov + uses: codecov/codecov-action@v5 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index a3268f7..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: CI -on: - pull_request: - branches: - - '*' - push: - branches: - - main -jobs: - build: - name: Test - strategy: - matrix: - scala: - - 2.13.10 - java: - - corretto@1.11 - - corretto@1.17 - os: - - ubuntu-22.04 - runs-on: ${{ matrix.os }} - steps: - - name: Branch Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install Java And Sbt - uses: olafurpg/setup-scala@v13 - with: - java-version: ${{ matrix.java }} - - name: Cache - uses: actions/cache@v3 - with: - path: | - $HOME/.cache/coursier - $HOME/.ivy2/cache - $HOME/.sbt/boot/ - $HOME/.sbt - target - project/target - key: ${{ runner.os }}-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - name: Test (${{ matrix.scala }}, ${{ matrix.java }}) - run: sbt ++${{ matrix.scala }} fullTest - - name: Upload To Codecov - uses: codecov/codecov-action@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5eed122..f2e7fdf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,12 +5,12 @@ on: tags: ["*"] jobs: publish: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: olafurpg/setup-scala@v13 + - uses: olafurpg/setup-scala@v14 - run: sbt ci-release env: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} diff --git a/.gitignore b/.gitignore index 80d24b4..373499d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,17 @@ +# ------------------ autogenerated file - do not edit ------------------- +# This file was generated by sbt-laserdisc-defaults +# +# Please check in any changes generated in this file (for IDE support) +# +# To make changes, please publish a new version of the plugin at: +# https://github.com/laserdisc-io/sbt-laserdisc-defaults +# +# To temporarily disable generation, set this at the top of build.sbt: +# ThisBuild / laserdiscGitIgnoreGenOn := false +# ----------------------------------------------------------------------- + +# tip: use a "global" gitignore (core.excludesfile) for your own, local, personal preferences +# See: https://gist.github.com/subfuzion/db7f57fff2fb6998a16c # scala / sbt / java project/project/ diff --git a/.scalafmt.conf b/.scalafmt.conf index f74d16c..34ae598 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,12 +1,25 @@ -version=3.6.1 +# ------------------ autogenerated file - do not edit ------------------- +# This file was generated by sbt-laserdisc-defaults +# +# Please check in any changes generated in this file (for IDE support) +# +# To make changes, please publish a new version of the plugin at: +# https://github.com/laserdisc-io/sbt-laserdisc-defaults +# +# To temporarily disable generation, set this at the top of build.sbt: +# ThisBuild / laserdiscScalaFmtGenOn := false +# ----------------------------------------------------------------------- + +version=3.8.3 maxColumn = 140 style = default align.preset = more -runner.dialect = scala213source3 +project.layout = StandardConvention +runner.dialect = scala3 fileOverride { - "glob:**/scala-3.0+/**" { runner.dialect = scala3 } + "lang:scala-2" = scala213source3 } danglingParentheses.preset = true diff --git a/build.sbt b/build.sbt index 0761e97..215f6a0 100644 --- a/build.sbt +++ b/build.sbt @@ -1,44 +1,15 @@ -ThisBuild / scalaVersion := "2.13.10" +import laserdisc.sbt.CompileTarget.Scala2And3 +import laserdisc.sbt.LaserDiscDevelopers -lazy val publishSettings = Seq( - Test / publishArtifact := false, - pomIncludeRepository := (_ => false), - organization := "io.laserdisc", - homepage := Some(url("http://laserdisc.io/console4s")), - developers := List(Developer("barryoneill", "Barry O'Neill", "", url("https://github.com/barryoneill"))), - licenses := Seq("MIT" -> url("https://raw.githubusercontent.com/laserdisc-io/console4s/master/LICENSE")), - scmInfo := Some( - ScmInfo( - url("https://github.com/laserdisc-io/console4s/tree/master"), - "scm:git:git@github.com:laserdisc-io/console4s.git", - "scm:git:git@github.com:laserdisc-io/console4s.git" - ) - ) -) +ThisBuild / laserdiscCompileTarget := Scala2And3 +ThisBuild / laserdiscRepoName := "console4s" +ThisBuild / coverageEnabled := true + +val root = (project in file(".")) + .settings( + name := "console4s", + developers := List(LaserDiscDevelopers.Barry), + Dependencies.Testing, -val root = - (project in file(".")) - .settings( - name := "console4s", - Dependencies.Testing, - publishSettings, - Seq( - addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"), - scalacOptions ++= Seq( - "-encoding", - "UTF-8", - "-deprecation", - "-unchecked", - "-feature", - "-language:higherKinds", - "-language:implicitConversions", - "-language:postfixOps", - "-Xlint:_,-byname-implicit", - "-Xfatal-warnings" - ) - ), - addCommandAlias("format", ";scalafmtAll;scalafmtSbt"), - addCommandAlias("checkFormat", ";scalafmtCheckAll;scalafmtSbtCheck"), - addCommandAlias("fullTest", ";clean;checkFormat;test") - ) - .enablePlugins(GitVersioning) + ) + .enablePlugins(LaserDiscDefaultsPlugin) diff --git a/project/build.properties b/project/build.properties index ff2eef0..8bfed43 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1,13 @@ -sbt.version = 1.8.0 \ No newline at end of file +# ------------------ autogenerated file - do not edit ------------------- +# This file was generated by sbt-laserdisc-defaults +# +# Please check in any changes generated in this file (for IDE support) +# +# To make changes, please publish a new version of the plugin at: +# https://github.com/laserdisc-io/sbt-laserdisc-defaults +# +# To temporarily disable generation, set this at the top of build.sbt: +# ThisBuild / laserdiscSBTVersionGenOn := false +# ----------------------------------------------------------------------- + +sbt.version = 1.10.5 \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index b1ac62f..b5351d3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,2 @@ -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.2") +addSbtPlugin("io.laserdisc" % "sbt-laserdisc-defaults" % "0.1.1") diff --git a/src/main/scala/io/laserdisc/console4s/tree/package.scala b/src/main/scala/io/laserdisc/console4s/tree/package.scala index 259086a..2ee2e4c 100644 --- a/src/main/scala/io/laserdisc/console4s/tree/package.scala +++ b/src/main/scala/io/laserdisc/console4s/tree/package.scala @@ -24,8 +24,10 @@ package object tree { .mkString("") val extraLinePrefix = - s"$prefix${pos.childToken}${config.blank * (config.nodeWidth + 1)}${if (numChildren > 0) config.pipe + (config.blank * 2) - else config.empty}" + s"$prefix${pos.childToken}${config.blank * (config.nodeWidth + 1)}${ + if (numChildren > 0) config.pipe + (config.blank * 2) + else config.empty + }" val contents: String = nc.show(node).split("\\n").toList match {