From 30584d56e31f8bb7820fc652c247eda8e126f48a Mon Sep 17 00:00:00 2001 From: Matthew de Detrich Date: Fri, 18 Oct 2024 12:08:51 +0200 Subject: [PATCH] Replace scalafmtOnCompile with CI check --- .github/workflows/ci.yml | 2 +- .github/workflows/format.yml | 23 +++++++++++++++++++++++ .scalafmt.conf | 2 +- build.sbt | 3 --- 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f4f448c..e6c60f20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,4 +40,4 @@ jobs: if: ${{ matrix.jobtype == 1 }} shell: bash run: | - sbt -v -Dfile.encoding=UTF8 scalafmtCheckAll +test +packagedArtifacts + sbt -v -Dfile.encoding=UTF8 +test +packagedArtifacts diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..5d1aa938 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,23 @@ +name: Scalafmt + +permissions: {} + +on: + pull_request: + branches: ['**'] + +jobs: + build: + name: Code is formatted + runs-on: ubuntu-latest + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Check project is formatted + uses: jrouly/scalafmt-native-action@v3 + with: + arguments: '--list' diff --git a/.scalafmt.conf b/.scalafmt.conf index 4bcacf16..d8113ffd 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.7.4 +version = 3.8.3 maxColumn = 100 project.git = true project.excludeFilters = [ /sbt-test/, /input_sources/, /contraband-scala/ ] diff --git a/build.sbt b/build.sbt index 93fe50f2..f3c893a5 100644 --- a/build.sbt +++ b/build.sbt @@ -26,7 +26,6 @@ ThisBuild / scmInfo := { Some(ScmInfo(url(s"https://github.com/$slug"), s"git@github.com:$slug.git")) } ThisBuild / licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))) -ThisBuild / scalafmtOnCompile := true ThisBuild / developers := List( Developer("harrah", "Mark Harrah", "@harrah", url("https://github.com/harrah")), Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("http://eed3si9n.com/")), @@ -67,8 +66,6 @@ def commonSettings: Seq[Setting[_]] = Def.settings( inCompileAndTest( (console / scalacOptions) --= Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint") ), - scalafmtOnCompile := true, - Test / scalafmtOnCompile := true, Compile / publishArtifact := true, Test / publishArtifact := false, Test / parallelExecution := false