diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa63b335..2662a409 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,8 +64,11 @@ jobs: "++${{ matrix.scala }} doc" \ "++${{ matrix.scala }} mimaReportBinaryIssues" + - name: Make target directories + 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 @@ -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..30594cfd 100644 --- a/build.sbt +++ b/build.sbt @@ -5,21 +5,14 @@ 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 / baseVersion := "0.3" - -ThisBuild / organization := "org.typelevel" -ThisBuild / organizationName := "Typelevel" - -ThisBuild / publishGithubUser := "johnynek" -ThisBuild / publishFullName := "P. Oscar Boykin" +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") - -ThisBuild / spiewakCiReleaseSnapshots := true - -ThisBuild / spiewakMainBranches := List("main") +ThisBuild / tlVersionIntroduced := Map("3" -> "0.3.4") ThisBuild / githubWorkflowBuild := Seq( WorkflowStep.Run( @@ -66,19 +59,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 +78,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 @@ -115,7 +97,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, @@ -132,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( @@ -141,8 +123,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)) @@ -152,19 +133,19 @@ 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( 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 + coverageEnabled := false ) lazy val coreJVM = core.jvm.settings(jvmVersionSettings) 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")