From 9f37d44098be5fe06a6a4780c615013b10dec9eb Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:05:34 +0000 Subject: [PATCH 1/9] Migrate to sbt-typelevel --- .github/workflows/ci.yml | 55 +++++++++++++++++++++++++--------------- build.sbt | 25 +++--------------- project/plugins.sbt | 4 +-- 3 files changed, 38 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa63b335..6349ef29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,11 @@ on: tags: [v*] env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} PGP_SECRET: ${{ secrets.PGP_SECRET }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: build: @@ -27,7 +28,7 @@ jobs: matrix: os: [ubuntu-latest] scala: [3.0.2, 2.11.12, 2.12.15, 2.13.8] - java: [temurin@11] + java: [temurin@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -35,12 +36,12 @@ jobs: with: fetch-depth: 0 - - name: Setup Java (temurin@11) - if: matrix.java == 'temurin@11' + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' uses: actions/setup-java@v2 with: distribution: temurin - java-version: 11 + java-version: 8 - name: Cache sbt uses: actions/cache@v2 @@ -55,7 +56,7 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Check that workflows are up to date - run: sbt ++${{ matrix.scala }} githubWorkflowCheck + run: sbt '++${{ matrix.scala }}' 'project /' githubWorkflowCheck - run: | sbt ++${{ matrix.scala }} fmtCheck \ @@ -63,6 +64,9 @@ jobs: "++${{ matrix.scala }} doc" \ "++${{ matrix.scala }} mimaReportBinaryIssues" + - name: Make target directories + run: mkdir -p target core/js/target core/jvm/target project/target + - name: Compress target directories run: tar cf targets.tar target core/js/target core/jvm/target project/target @@ -80,7 +84,7 @@ jobs: matrix: os: [ubuntu-latest] scala: [2.13.8] - java: [temurin@11] + java: [temurin@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -88,12 +92,12 @@ jobs: with: fetch-depth: 0 - - name: Setup Java (temurin@11) - if: matrix.java == 'temurin@11' + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' uses: actions/setup-java@v2 with: distribution: temurin - java-version: 11 + java-version: 8 - name: Cache sbt uses: actions/cache@v2 @@ -148,11 +152,20 @@ jobs: rm targets.tar - name: Import signing key + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' run: echo $PGP_SECRET | base64 -d | gpg --import - - run: sbt ++${{ matrix.scala }} release + - name: Import signing key and strip passphrase + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + run: | + echo "$PGP_SECRET" | base64 -d > /tmp/signing-key.gpg + echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg + (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) + + - name: Publish + run: sbt '++${{ matrix.scala }}' tlRelease - - run: sbt ++${{ matrix.scala }} docs/makeSite + - run: sbt '++${{ matrix.scala }}' docs/makeSite - uses: JamesIves/github-pages-deploy-action@3.7.1 with: @@ -172,12 +185,12 @@ jobs: - name: Checkout current branch (fast) uses: actions/checkout@v2 - - name: Setup Java (temurin@11) - if: matrix.java == 'temurin@11' + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' uses: actions/setup-java@v2 with: distribution: temurin - java-version: 11 + java-version: 8 - name: Cache sbt uses: actions/cache@v2 @@ -191,7 +204,7 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - run: sbt ++${{ matrix.scala }} docs/mdoc + - run: sbt '++${{ matrix.scala }}' docs/mdoc coverage: name: Generate coverage report @@ -205,12 +218,12 @@ jobs: - name: Checkout current branch (fast) uses: actions/checkout@v2 - - name: Setup Java (temurin@11) - if: matrix.java == 'temurin@11' + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' uses: actions/setup-java@v2 with: distribution: temurin - java-version: 11 + java-version: 8 - name: Cache sbt uses: actions/cache@v2 @@ -224,6 +237,6 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - run: sbt ++${{ matrix.scala }} coverage test coverageAggregate + - run: sbt '++${{ matrix.scala }}' coverage test coverageAggregate - run: 'bash <(curl -s https://codecov.io/bash)' diff --git a/build.sbt b/build.sbt index 6469135b..3657fb36 100644 --- a/build.sbt +++ b/build.sbt @@ -7,20 +7,12 @@ addCommandAlias("fmtCheck", "; scalafmtCheckAll; scalafmtSbtCheck") addCommandAlias("prePR", "; githubWorkflowGenerate ; +fmt; bench/compile; +test") -ThisBuild / baseVersion := "0.3" +ThisBuild / tlBaseVersion := "0.3" -ThisBuild / organization := "org.typelevel" -ThisBuild / organizationName := "Typelevel" - -ThisBuild / publishGithubUser := "johnynek" -ThisBuild / publishFullName := "P. Oscar Boykin" +ThisBuild / developers += tlGitHubDev("johnynek", "P. Oscar Boykin") ThisBuild / crossScalaVersions := List("3.0.2", "2.11.12", "2.12.15", "2.13.8") -ThisBuild / spiewakCiReleaseSnapshots := true - -ThisBuild / spiewakMainBranches := List("main") - ThisBuild / githubWorkflowBuild := Seq( WorkflowStep.Run( List( @@ -66,19 +58,8 @@ ThisBuild / githubWorkflowPublish ++= Seq( ) ) -ThisBuild / homepage := Some(url("https://github.com/typelevel/cats-parse")) - -ThisBuild / scmInfo := Some( - ScmInfo( - url("https://github.com/typelevel/cats-parse"), - "git@github.com:typelevel/cats-parse.git" - ) -) - ThisBuild / licenses := List(("MIT", url("http://opensource.org/licenses/MIT"))) -ThisBuild / testFrameworks += new TestFramework("munit.Framework") - lazy val jvmVersionSettings = VersionNumber(sys.props("java.version")) match { case v if v.matchesSemVer(SemanticSelector(">1.8")) => Def.settings( @@ -96,7 +77,7 @@ lazy val jvmVersionSettings = VersionNumber(sys.props("java.version")) match { lazy val root = project .in(file(".")) .aggregate(core.jvm, core.js, bench) - .enablePlugins(NoPublishPlugin, SonatypeCiReleasePlugin) + .enablePlugins(NoPublishPlugin) .settings(scalaVersion := "2.13.8") lazy val docs = project diff --git a/project/plugins.sbt b/project/plugins.sbt index 531eaa45..80656e73 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,9 +5,7 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3") -addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.23.0") -addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.0") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24") addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1") From 4cd008d5b82bfbc78268aa72efc0f417a22ca7f1 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:06:31 +0000 Subject: [PATCH 2/9] Fix prePR --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 3657fb36..c1836eea 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ import Dependencies._ addCommandAlias("fmt", "; scalafmtAll; scalafmtSbt") addCommandAlias("fmtCheck", "; scalafmtCheckAll; scalafmtSbtCheck") -addCommandAlias("prePR", "; githubWorkflowGenerate ; +fmt; bench/compile; +test") +tlReplaceCommandAlias("prePR", "; githubWorkflowGenerate ; +fmt; bench/compile; +test") ThisBuild / tlBaseVersion := "0.3" From b84a5b9e4198fa8169f0613ed9f29bda64fd2879 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:10:27 +0000 Subject: [PATCH 3/9] Disable fatal warnings for Scala 3 --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index c1836eea..0603a78f 100644 --- a/build.sbt +++ b/build.sbt @@ -12,6 +12,7 @@ ThisBuild / tlBaseVersion := "0.3" ThisBuild / developers += tlGitHubDev("johnynek", "P. Oscar Boykin") ThisBuild / crossScalaVersions := List("3.0.2", "2.11.12", "2.12.15", "2.13.8") +ThisBuild / tlFatalWarningsInCi := !tlIsScala3.value ThisBuild / githubWorkflowBuild := Seq( WorkflowStep.Run( From 8b3df5b9a8e1ec2a2e2c4611354f03b2a494b5b9 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:14:23 +0000 Subject: [PATCH 4/9] Set startYear --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 0603a78f..667c0fd7 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,7 @@ addCommandAlias("fmtCheck", "; scalafmtCheckAll; scalafmtSbtCheck") tlReplaceCommandAlias("prePR", "; githubWorkflowGenerate ; +fmt; bench/compile; +test") ThisBuild / tlBaseVersion := "0.3" - +ThisBuild / startYear := Some(2021) ThisBuild / developers += tlGitHubDev("johnynek", "P. Oscar Boykin") ThisBuild / crossScalaVersions := List("3.0.2", "2.11.12", "2.12.15", "2.13.8") From 7a6c98ba183962351e4eb373e7c0aea5f5d25e70 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:33:53 +0000 Subject: [PATCH 5/9] Move fatal warnings setting --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 667c0fd7..f03534b3 100644 --- a/build.sbt +++ b/build.sbt @@ -12,7 +12,6 @@ ThisBuild / startYear := Some(2021) ThisBuild / developers += tlGitHubDev("johnynek", "P. Oscar Boykin") ThisBuild / crossScalaVersions := List("3.0.2", "2.11.12", "2.12.15", "2.13.8") -ThisBuild / tlFatalWarningsInCi := !tlIsScala3.value ThisBuild / githubWorkflowBuild := Seq( WorkflowStep.Run( @@ -114,6 +113,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) .crossType(CrossType.Full) .settings( name := "cats-parse", + tlFatalWarningsInCi := !tlIsScala3.value, libraryDependencies ++= { val isScala211 = CrossVersion.partialVersion(scalaVersion.value).contains((2, 11)) Seq( From c9189d615d9d30f650f9d98b506b21af8a7d5271 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:37:19 +0000 Subject: [PATCH 6/9] Settings cleanup --- build.sbt | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/build.sbt b/build.sbt index f03534b3..20a8496f 100644 --- a/build.sbt +++ b/build.sbt @@ -96,7 +96,6 @@ lazy val docs = project "empty" -> "", "version" -> version.value ), - githubWorkflowArtifactUpload := false, git.remoteRepo := "git@github.com:typelevel/cats-parse.git", mdocIn := (Compile / baseDirectory).value / "src", Compile / paradox / sourceDirectory := mdocOut.value, @@ -123,8 +122,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) ) }, libraryDependencies ++= { - val isScala2 = CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 2) - if (isScala2) Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value) else Nil + if (tlIsScala3.value) Nil else Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value) }, scalacOptions ++= { val isScala211 = CrossVersion.partialVersion(scalaVersion.value).contains((2, 11)) @@ -138,15 +136,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) ) .jsSettings( crossScalaVersions := (ThisBuild / crossScalaVersions).value.filterNot(_.startsWith("2.11")), - Global / scalaJSStage := FastOptStage, - parallelExecution := false, - jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv(), - // batch mode decreases the amount of memory needed to compile scala.js code - scalaJSLinkerConfig := scalaJSLinkerConfig.value - .withBatchMode(scala.sys.env.get("TRAVIS").isDefined) - .withModuleKind(ModuleKind.CommonJSModule), coverageEnabled := false, - scalaJSUseMainModuleInitializer := false ) lazy val coreJVM = core.jvm.settings(jvmVersionSettings) From 97d385fd0c9a50cc6b6d7d591739bb3a56d256f7 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:39:17 +0000 Subject: [PATCH 7/9] Regenerate workflow --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6349ef29..2662a409 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,10 +65,10 @@ jobs: "++${{ matrix.scala }} mimaReportBinaryIssues" - name: Make target directories - run: mkdir -p target core/js/target core/jvm/target project/target + run: mkdir -p target docs/target core/js/target core/jvm/target project/target - name: Compress target directories - run: tar cf targets.tar target core/js/target core/jvm/target project/target + run: tar cf targets.tar target docs/target core/js/target core/jvm/target project/target - name: Upload target directories uses: actions/upload-artifact@v2 From a47aa55701761fed660bc76a5f68e5d43c52b97f Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:41:53 +0000 Subject: [PATCH 8/9] Formatting --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 20a8496f..af9e971e 100644 --- a/build.sbt +++ b/build.sbt @@ -136,7 +136,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) ) .jsSettings( crossScalaVersions := (ThisBuild / crossScalaVersions).value.filterNot(_.startsWith("2.11")), - coverageEnabled := false, + coverageEnabled := false ) lazy val coreJVM = core.jvm.settings(jvmVersionSettings) From 3007d30ba8ae2a62bd6a79965489fdc61acbcea2 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 20 Jan 2022 14:58:20 +0000 Subject: [PATCH 9/9] Fix mima for Scala 3 --- build.sbt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.sbt b/build.sbt index af9e971e..30594cfd 100644 --- a/build.sbt +++ b/build.sbt @@ -12,6 +12,7 @@ ThisBuild / startYear := Some(2021) ThisBuild / developers += tlGitHubDev("johnynek", "P. Oscar Boykin") ThisBuild / crossScalaVersions := List("3.0.2", "2.11.12", "2.12.15", "2.13.8") +ThisBuild / tlVersionIntroduced := Map("3" -> "0.3.4") ThisBuild / githubWorkflowBuild := Seq( WorkflowStep.Run( @@ -132,6 +133,14 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) mimaPreviousArtifacts := { val isScala211 = CrossVersion.partialVersion(scalaVersion.value).contains((2, 11)) if (isScala211) Set.empty else mimaPreviousArtifacts.value + }, + mimaBinaryIssueFilters ++= { + if (tlIsScala3.value) + List( + ProblemFilters.exclude[IncompatibleResultTypeProblem]("cats.parse.Parser#State.error"), + ProblemFilters.exclude[IncompatibleMethTypeProblem]("cats.parse.Parser#State.error_=") + ) + else Nil } ) .jsSettings(