diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8599b7c..57880cad 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: @@ -28,11 +29,16 @@ jobs: os: [ubuntu-latest] scala: [2.12.15, 3.1.0, 2.13.7] java: [temurin@8, temurin@11] + ci: [ciJS, ciJVM] exclude: - scala: 2.12.15 java: temurin@11 - scala: 3.1.0 java: temurin@11 + - ci: ciJS + java: temurin@11 + - ci: ciJS + scala: 2.12.15 runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -67,6 +73,7 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Setup NodeJS v14 LTS + if: matrix.ci == 'ciJS' uses: actions/setup-node@v2 with: node-version: 14 @@ -75,17 +82,17 @@ jobs: run: sbt ++${{ matrix.scala }} githubWorkflowCheck - if: matrix.scala != '2.12.15' - run: sbt ++${{ matrix.scala }} ci + run: sbt ++${{ matrix.scala }} '${{ matrix.ci }}' - name: Run sbt scripted tests if: matrix.scala == '2.12.15' run: sbt ++${{ matrix.scala }} scripted - name: Make target directories - run: mkdir -p target lambda-cloudformation-custom-resource/.js/target lambda-http4s/.jvm/target core/.js/target examples/.js/target lambda-http4s/.js/target core/.jvm/target lambda/js/target examples/.jvm/target lambda/jvm/target sbt-lambda/target lambda-cloudformation-custom-resource/.jvm/target project/target + run: mkdir -p target lambda-cloudformation-custom-resource/.js/target lambda-http4s/.jvm/target .js/target core/.js/target examples/.js/target lambda-http4s/.js/target core/.jvm/target .jvm/target lambda/js/target .native/target examples/.jvm/target lambda/jvm/target sbt-lambda/target lambda-cloudformation-custom-resource/.jvm/target project/target - name: Compress target directories - run: tar cf targets.tar target lambda-cloudformation-custom-resource/.js/target lambda-http4s/.jvm/target core/.js/target examples/.js/target lambda-http4s/.js/target core/.jvm/target lambda/js/target examples/.jvm/target lambda/jvm/target sbt-lambda/target lambda-cloudformation-custom-resource/.jvm/target project/target + run: tar cf targets.tar target lambda-cloudformation-custom-resource/.js/target lambda-http4s/.jvm/target .js/target core/.js/target examples/.js/target lambda-http4s/.js/target core/.jvm/target .jvm/target lambda/js/target .native/target examples/.jvm/target lambda/jvm/target sbt-lambda/target lambda-cloudformation-custom-resource/.jvm/target project/target - name: Upload target directories uses: actions/upload-artifact@v2 @@ -166,6 +173,14 @@ jobs: rm targets.tar - name: Import signing key + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' run: echo $PGP_SECRET | base64 -d | gpg --import + - 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) + - run: sbt ++${{ matrix.scala }} release diff --git a/build.sbt b/build.sbt index c5bac1d0..0effc838 100644 --- a/build.sbt +++ b/build.sbt @@ -16,43 +16,21 @@ name := "feral" -ThisBuild / baseVersion := "0.1" - -ThisBuild / organization := "org.typelevel" -ThisBuild / organizationName := "Typelevel" +ThisBuild / tlBaseVersion := "0.1" +ThisBuild / startYear := Some(2021) ThisBuild / developers := List( - Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")), - Developer("bpholt", "Brian Holt", "@bpholt", url("https://github.com/bpholt")), - Developer("djspiewak", "Daniel Spiewak", "@djspiewak", url("https://github.com/djspiewak")) + tlGitHubDev("armanbilge", "Arman Bilge"), + tlGitHubDev("bpholt", "Brian Holt"), + tlGitHubDev("djspiewak", "Daniel Spiewak") ) -enablePlugins(SonatypeCiReleasePlugin) -ThisBuild / spiewakCiReleaseSnapshots := true -ThisBuild / spiewakMainBranches := Seq("main") -ThisBuild / homepage := Some(url("https://github.com/typelevel/feral")) -ThisBuild / scmInfo := Some( - ScmInfo(url("https://github.com/typelevel/feral"), "git@github.com:typelevel/feral.git")) +enablePlugins(TypelevelCiReleasePlugin) +ThisBuild / tlCiReleaseBranches := Seq("main") ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8"), JavaSpec.temurin("11")) -ThisBuild / githubWorkflowBuildMatrixExclusions ++= { - for { - scala <- (ThisBuild / crossScalaVersions).value.init - java <- (ThisBuild / githubWorkflowJavaVersions).value.tail - } yield MatrixExclude(Map("scala" -> scala, "java" -> java.render)) -} - -ThisBuild / githubWorkflowGeneratedUploadSteps ~= { steps => - val mkdirStep = steps.headOption match { - case Some(WorkflowStep.Run(command :: _, _, _, _, _, _)) => - WorkflowStep.Run( - commands = List(command.replace("tar cf targets.tar", "mkdir -p")), - name = Some("Make target directories") - ) - case _ => sys.error("Can't generate make target dirs workflow step") - } - mkdirStep +: steps -} +ThisBuild / githubWorkflowBuildMatrixExclusions += + MatrixExclude(Map("ci" -> "ciJS", "scala" -> Scala212)) ThisBuild / githubWorkflowBuild ~= { steps => val ciStep = steps.headOption match { @@ -68,16 +46,12 @@ ThisBuild / githubWorkflowBuild ~= { steps => List(ciStep, scriptedStep) } -replaceCommandAlias( - "ci", - "; project /; headerCheckAll; scalafmtCheckAll; scalafmtSbtCheck; clean; testIfRelevant; mimaReportBinaryIssuesIfRelevant" -) - ThisBuild / githubWorkflowBuildPreamble += WorkflowStep.Use( UseRef.Public("actions", "setup-node", "v2"), name = Some("Setup NodeJS v14 LTS"), - params = Map("node-version" -> "14") + params = Map("node-version" -> "14"), + cond = Some("matrix.ci == 'ciJS'") ) val Scala212 = "2.12.15" @@ -94,32 +68,18 @@ val munitVersion = "0.7.29" val munitCEVersion = "1.0.7" lazy val commonSettings = Seq( - crossScalaVersions := Seq(Scala3, Scala213), - scalacOptions ++= { - if (isDotty.value && githubIsWorkflowBuild.value) - Seq("-Xfatal-warnings") - else - Seq.empty - } + crossScalaVersions := Seq(Scala3, Scala213) ) lazy val root = - project - .in(file(".")) - .aggregate( - core.js, - core.jvm, - lambda.js, - lambda.jvm, - sbtLambda, - lambdaHttp4s.js, - lambdaHttp4s.jvm, - lambdaCloudFormationCustomResource.js, - lambdaCloudFormationCustomResource.jvm, - examples.js, - examples.jvm - ) - .enablePlugins(NoPublishPlugin) + tlCrossRootProject.aggregate( + core, + lambda, + sbtLambda, + lambdaHttp4s, + lambdaCloudFormationCustomResource, + examples + ) lazy val core = crossProject(JSPlatform, JVMPlatform) .crossType(CrossType.Pure) @@ -144,7 +104,7 @@ lazy val lambda = crossProject(JSPlatform, JVMPlatform) "org.typelevel" %%% "munit-cats-effect-3" % "1.0.7" % Test ), libraryDependencies ++= { - if (isDotty.value) Nil + if (tlIsScala3.value) Nil else Seq( "io.circe" %%% "circe-literal" % circeVersion % Test, diff --git a/project/plugins.sbt b/project/plugins.sbt index 0b367d43..766368b2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,4 @@ -addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2") -addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.23.0") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") +resolvers += Resolver.sonatypeRepo("snapshots") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4-690c2d9-SNAPSHOT") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")