diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 841e212..c8330c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,5 +19,7 @@ jobs: distribution: 'zulu' java-version: '21' cache: 'sbt' + - name: 👌 Run "pre-push" tasks (compile and style-check) + run: sbt prep - name: ✅ Generate a project and run its test run: sbt g8Test diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..de1e72a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,11 @@ +version = 3.3.0 +runner.dialect = scala213 +style = default +maxColumn = 120 +continuationIndent.callSite = 2 +align.preset = more +runner.optimizer.forceConfigStyleMinArgCount = 1 +rewrite.rules = [SortImports] +importSelectors = singleLine +project.excludeFilters = ["target/"] +project.git = true # Only format files tracked by git diff --git a/build.sbt b/build.sbt index 65dd6f0..06ae367 100644 --- a/build.sbt +++ b/build.sbt @@ -14,3 +14,20 @@ lazy val root = (project in file(".")) url("https://repo.typesafe.com/typesafe/ivy-releases/") )(Resolver.ivyStylePatterns) ) + +/** ********* COMMANDS ALIASES ******************/ +addCommandAlias("t", "test") +addCommandAlias("to", "testOnly") +addCommandAlias("tq", "testQuick") +addCommandAlias("tsf", "testShowFailed") + +addCommandAlias("c", "compile") +addCommandAlias("tc", "Test / compile") + +addCommandAlias("f", "scalafmt") // Format production files according to ScalaFmt +addCommandAlias("fc", "scalafmtCheck") // Check if production files are formatted according to ScalaFmt +addCommandAlias("tf", "Test / scalafmt") // Format test files according to ScalaFmt +addCommandAlias("tfc", "Test / scalafmtCheck") // Check if test files are formatted according to ScalaFmt + +// All the needed tasks before pushing to the repository (compile, compile test, format check in prod and test) +addCommandAlias("prep", ";c;tc;fc;tfc") diff --git a/project/sbt-scalafmt.sbt b/project/sbt-scalafmt.sbt new file mode 100644 index 0000000..83adafa --- /dev/null +++ b/project/sbt-scalafmt.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")