From f3f3fdcb1f3cfc7276ed25ab79abad5b9b04b43c Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 23 Jan 2022 04:46:19 +0000 Subject: [PATCH 01/99] Keep publish secrets scoped to publish job --- .github/workflows/ci.yml | 9 +++++---- .../org/typelevel/sbt/TypelevelCiSigningPlugin.scala | 2 +- .../scala/org/typelevel/sbt/gha/GenerativeKeys.scala | 2 ++ .../scala/org/typelevel/sbt/gha/GenerativePlugin.scala | 2 ++ .../typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e64f644..a9bd9eb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,6 @@ on: tags: [v*] env: - 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: @@ -93,6 +89,11 @@ jobs: scala: [2.12.15] java: [temurin@8] runs-on: ${{ matrix.os }} + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} steps: - name: Checkout current branch (full) uses: actions/checkout@v2 diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala index c6ffed9b..0a0eee64 100644 --- a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -29,7 +29,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin { override def trigger = allRequirements override def buildSettings = Seq( - githubWorkflowEnv ++= Map( + githubWorkflowPublishEnv ++= Map( "PGP_SECRET" -> s"$${{ secrets.PGP_SECRET }}", "PGP_PASSPHRASE" -> s"$${{ secrets.PGP_PASSPHRASE }}" ), diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index 7bb296f0..f60c473a 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -98,6 +98,8 @@ trait GenerativeKeys { lazy val githubWorkflowEnv = settingKey[Map[String, String]]( s"A map of static environment variable assignments global to the workflow (default: { GITHUB_TOKEN: $${{ secrets.GITHUB_TOKEN }} })") + lazy val githubWorkflowPublishEnv = settingKey[Map[String, String]]( + s"A map of additional static environment variable assignments scoped to the publish job (default empty)") lazy val githubWorkflowAddedJobs = settingKey[Seq[WorkflowJob]]( "A list of additional jobs to add to the CI workflow (default: [])") } diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index b54169a0..189d790a 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -532,6 +532,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowTargetTags := Seq(), githubWorkflowTargetPaths := Paths.None, githubWorkflowEnv := Map("GITHUB_TOKEN" -> s"$${{ secrets.GITHUB_TOKEN }}"), + githubWorkflowPublishEnv := Map.empty, githubWorkflowAddedJobs := Seq() ) @@ -683,6 +684,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowPublish.value.toList ::: githubWorkflowPublishPostamble.value.toList, cond = Some(s"github.event_name != 'pull_request' && $publicationCond"), + env = githubWorkflowPublishEnv.value, scalas = List(scalaVersion.value), javas = List(githubWorkflowJavaVersions.value.head), needs = List("build") diff --git a/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala b/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala index abf17803..467b783b 100644 --- a/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala +++ b/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala @@ -41,7 +41,7 @@ object TypelevelSonatypeCiReleasePlugin extends AutoPlugin { Seq(tlCiReleaseTags := true, tlCiReleaseBranches := Seq()) override def buildSettings = Seq( - githubWorkflowEnv ++= Map( + githubWorkflowPublishEnv ++= Map( "SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}", "SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}" ), From 2373e7099c3f481b6af9c90ae6ed1c9f637baf0f Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 23 Jan 2022 05:33:08 +0000 Subject: [PATCH 02/99] Revert "Keep publish secrets scoped to publish job" This reverts commit f3f3fdcb1f3cfc7276ed25ab79abad5b9b04b43c. --- .github/workflows/ci.yml | 9 ++++----- .../org/typelevel/sbt/TypelevelCiSigningPlugin.scala | 2 +- .../scala/org/typelevel/sbt/gha/GenerativeKeys.scala | 2 -- .../scala/org/typelevel/sbt/gha/GenerativePlugin.scala | 2 -- .../typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b371003d..74907504 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,10 @@ on: tags: [v*] env: + 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: @@ -92,11 +96,6 @@ jobs: scala: [2.12.15] java: [temurin@8] runs-on: ${{ matrix.os }} - env: - PGP_SECRET: ${{ secrets.PGP_SECRET }} - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} steps: - name: Checkout current branch (full) uses: actions/checkout@v2 diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala index 0a0eee64..c6ffed9b 100644 --- a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -29,7 +29,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin { override def trigger = allRequirements override def buildSettings = Seq( - githubWorkflowPublishEnv ++= Map( + githubWorkflowEnv ++= Map( "PGP_SECRET" -> s"$${{ secrets.PGP_SECRET }}", "PGP_PASSPHRASE" -> s"$${{ secrets.PGP_PASSPHRASE }}" ), diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index f60c473a..7bb296f0 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -98,8 +98,6 @@ trait GenerativeKeys { lazy val githubWorkflowEnv = settingKey[Map[String, String]]( s"A map of static environment variable assignments global to the workflow (default: { GITHUB_TOKEN: $${{ secrets.GITHUB_TOKEN }} })") - lazy val githubWorkflowPublishEnv = settingKey[Map[String, String]]( - s"A map of additional static environment variable assignments scoped to the publish job (default empty)") lazy val githubWorkflowAddedJobs = settingKey[Seq[WorkflowJob]]( "A list of additional jobs to add to the CI workflow (default: [])") } diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index 4657b3fd..a1ef6d2d 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -532,7 +532,6 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowTargetTags := Seq(), githubWorkflowTargetPaths := Paths.None, githubWorkflowEnv := Map("GITHUB_TOKEN" -> s"$${{ secrets.GITHUB_TOKEN }}"), - githubWorkflowPublishEnv := Map.empty, githubWorkflowAddedJobs := Seq() ) @@ -676,7 +675,6 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowPublish.value.toList ::: githubWorkflowPublishPostamble.value.toList, cond = Some(publicationCond.value), - env = githubWorkflowPublishEnv.value, scalas = List(scalaVersion.value), javas = List(githubWorkflowJavaVersions.value.head), needs = List("build") diff --git a/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala b/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala index 467b783b..abf17803 100644 --- a/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala +++ b/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala @@ -41,7 +41,7 @@ object TypelevelSonatypeCiReleasePlugin extends AutoPlugin { Seq(tlCiReleaseTags := true, tlCiReleaseBranches := Seq()) override def buildSettings = Seq( - githubWorkflowPublishEnv ++= Map( + githubWorkflowEnv ++= Map( "SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}", "SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}" ), From 1ba78de3ecd68b66e2f7303c37cddf48d8581397 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 23 Jan 2022 05:38:47 +0000 Subject: [PATCH 03/99] Keep secrets scoped to steps --- .github/workflows/ci.yml | 17 +++++++++++------ .../sbt/TypelevelCiSigningPlugin.scala | 15 +++++++++------ .../sbt/TypelevelSonatypeCiReleasePlugin.scala | 11 ++++++----- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74907504..4ccaa28d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,6 @@ on: tags: [v*] env: - 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: @@ -132,17 +128,26 @@ jobs: rm targets.tar - name: Import signing key - if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' + if: secrets.PGP_SECRET != '' && secrets.PGP_PASSPHRASE == '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} run: echo $PGP_SECRET | base64 -d | gpg --import - name: Import signing key and strip passphrase - if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + if: secrets.PGP_SECRET != '' && secrets.PGP_PASSPHRASE != '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.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 + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} run: sbt '++${{ matrix.scala }}' tlRelease site: diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala index c6ffed9b..a60967dd 100644 --- a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -29,15 +29,12 @@ object TypelevelCiSigningPlugin extends AutoPlugin { override def trigger = allRequirements override def buildSettings = Seq( - githubWorkflowEnv ++= Map( - "PGP_SECRET" -> s"$${{ secrets.PGP_SECRET }}", - "PGP_PASSPHRASE" -> s"$${{ secrets.PGP_PASSPHRASE }}" - ), githubWorkflowPublishPreamble := Seq( WorkflowStep.Run( // if your key is not passphrase-protected List("echo $PGP_SECRET | base64 -d | gpg --import"), name = Some("Import signing key"), - cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''") + cond = Some("secrets.PGP_SECRET != '' && secrets.PGP_PASSPHRASE == ''"), + env = env ), WorkflowStep.Run( // if your key is passphrase-protected List( @@ -46,7 +43,8 @@ object TypelevelCiSigningPlugin extends AutoPlugin { "(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 = Some("Import signing key and strip passphrase"), - cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''") + cond = Some("secrets.PGP_SECRET != '' && secrets.PGP_PASSPHRASE != ''"), + env = env ) ) ) @@ -57,4 +55,9 @@ object TypelevelCiSigningPlugin extends AutoPlugin { gpgWarnOnFailure := isSnapshot.value ) + private val env = Map( + "PGP_SECRET" -> s"$${{ secrets.PGP_SECRET }}", + "PGP_PASSPHRASE" -> s"$${{ secrets.PGP_PASSPHRASE }}" + ) + } diff --git a/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala b/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala index abf17803..ad201be9 100644 --- a/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala +++ b/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala @@ -41,10 +41,6 @@ object TypelevelSonatypeCiReleasePlugin extends AutoPlugin { Seq(tlCiReleaseTags := true, tlCiReleaseBranches := Seq()) override def buildSettings = Seq( - githubWorkflowEnv ++= Map( - "SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}", - "SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}" - ), githubWorkflowPublishTargetBranches := { val branches = tlCiReleaseBranches.value.map(b => RefPredicate.Equals(Ref.Branch(b))) @@ -59,7 +55,12 @@ object TypelevelSonatypeCiReleasePlugin extends AutoPlugin { }, githubWorkflowTargetTags += "v*", githubWorkflowPublish := Seq( - WorkflowStep.Sbt(List("tlRelease"), name = Some("Publish")) + WorkflowStep.Sbt(List("tlRelease"), name = Some("Publish"), env = env) ) ) + + private val env = Map( + "SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}", + "SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}" + ) } From f867dce78144a9226b854dc839db19c642250b37 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 23 Jan 2022 06:11:24 +0000 Subject: [PATCH 04/99] Try an experiment --- .github/workflows/ci.yml | 9 +++++++-- build.sbt | 4 ++++ .../org/typelevel/sbt/TypelevelCiSigningPlugin.scala | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ccaa28d..344a3443 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,11 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - if: env.TEST == 'itworked' + env: + TEST: itworked + run: exit + - name: Check that workflows are up to date run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck @@ -128,14 +133,14 @@ jobs: rm targets.tar - name: Import signing key - if: secrets.PGP_SECRET != '' && secrets.PGP_PASSPHRASE == '' + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' env: PGP_SECRET: ${{ secrets.PGP_SECRET }} PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} run: echo $PGP_SECRET | base64 -d | gpg --import - name: Import signing key and strip passphrase - if: secrets.PGP_SECRET != '' && secrets.PGP_PASSPHRASE != '' + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' env: PGP_SECRET: ${{ secrets.PGP_SECRET }} PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} diff --git a/build.sbt b/build.sbt index 95d14f7f..99ec62a4 100644 --- a/build.sbt +++ b/build.sbt @@ -8,6 +8,10 @@ ThisBuild / developers := List( tlGitHubDev("ChristopherDavenport", "Christopher Davenport"), tlGitHubDev("djspiewak", "Daniel Spiewak") ) +ThisBuild / githubWorkflowBuildPreamble += WorkflowStep.Run( + List("exit"), + cond = Some("env.TEST == 'itworked'"), + env = Map("TEST" -> "itworked")) lazy val root = tlCrossRootProject.aggregate( kernel, diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala index a60967dd..1f15c791 100644 --- a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -33,7 +33,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin { WorkflowStep.Run( // if your key is not passphrase-protected List("echo $PGP_SECRET | base64 -d | gpg --import"), name = Some("Import signing key"), - cond = Some("secrets.PGP_SECRET != '' && secrets.PGP_PASSPHRASE == ''"), + cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''"), env = env ), WorkflowStep.Run( // if your key is passphrase-protected @@ -43,7 +43,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin { "(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 = Some("Import signing key and strip passphrase"), - cond = Some("secrets.PGP_SECRET != '' && secrets.PGP_PASSPHRASE != ''"), + cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''"), env = env ) ) From 520f571c3086d3ec2ef21292cfcd671c4456313a Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 23 Jan 2022 06:12:50 +0000 Subject: [PATCH 05/99] I guess it works --- .github/workflows/ci.yml | 5 ----- build.sbt | 4 ---- 2 files changed, 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 344a3443..fb0f92e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,11 +52,6 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - if: env.TEST == 'itworked' - env: - TEST: itworked - run: exit - - name: Check that workflows are up to date run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck diff --git a/build.sbt b/build.sbt index 99ec62a4..95d14f7f 100644 --- a/build.sbt +++ b/build.sbt @@ -8,10 +8,6 @@ ThisBuild / developers := List( tlGitHubDev("ChristopherDavenport", "Christopher Davenport"), tlGitHubDev("djspiewak", "Daniel Spiewak") ) -ThisBuild / githubWorkflowBuildPreamble += WorkflowStep.Run( - List("exit"), - cond = Some("env.TEST == 'itworked'"), - env = Map("TEST" -> "itworked")) lazy val root = tlCrossRootProject.aggregate( kernel, From e205fa7f6c9108dc0340dac7c920eb00165cc0c1 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 23 Jan 2022 06:44:01 +0000 Subject: [PATCH 06/99] Bump base version to 0.5 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 95d14f7f..e73dfb38 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ name := "sbt-typelevel" -ThisBuild / tlBaseVersion := "0.4" +ThisBuild / tlBaseVersion := "0.5" ThisBuild / crossScalaVersions := Seq("2.12.15") ThisBuild / developers := List( tlGitHubDev("armanbilge", "Arman Bilge"), From 786063065ede3f8d1c6a9b94995a48dcf3a25eb9 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 28 Jan 2022 19:15:29 +0100 Subject: [PATCH 07/99] Update mdoc, sbt-mdoc to 2.3.0 --- site/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/build.sbt b/site/build.sbt index 218aaa8f..0a1a57c4 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.0") addSbtPlugin("org.planet42" % "laika-sbt" % "0.18.1") From ae6eed52d36fc8ab4b5a8454bda16b941aece423 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 29 Jan 2022 05:31:01 +0100 Subject: [PATCH 08/99] Update scalafmt-core to 3.4.0 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 7df3bb51..c3fe570c 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.3.3 +version = 3.4.0 runner.dialect = scala212source3 From d4770ff0e34a547560f6c47e61e09d2be181eacc Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 1 Feb 2022 02:30:43 +0000 Subject: [PATCH 09/99] Don't set version scheme in settings plugin --- .../main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 7d41a241..d534b69f 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -40,7 +40,6 @@ object TypelevelSettingsPlugin extends AutoPlugin { ) override def projectSettings = Seq( - versionScheme := Some("early-semver"), pomIncludeRepository := { _ => false }, libraryDependencies ++= { if (tlIsScala3.value) From 4dba0c1c2b668624caa19cc90c31b714c3a8d1e4 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 2 Mar 2022 00:07:48 +0000 Subject: [PATCH 10/99] Update to actions/checkout@v3 --- .github/workflows/ci.yml | 6 +++--- .../src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f972f13b..924762a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -97,7 +97,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -163,7 +163,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 9506e9f6..8cacac48 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -26,12 +26,12 @@ sealed trait WorkflowStep extends Product with Serializable { object WorkflowStep { val CheckoutFull: WorkflowStep = Use( - UseRef.Public("actions", "checkout", "v2"), + UseRef.Public("actions", "checkout", "v3"), name = Some("Checkout current branch (full)"), params = Map("fetch-depth" -> "0")) val Checkout: WorkflowStep = Use( - UseRef.Public("actions", "checkout", "v2"), + UseRef.Public("actions", "checkout", "v3"), name = Some("Checkout current branch (fast)")) def SetupJava(versions: List[JavaSpec]): List[WorkflowStep] = From 309f723dd9ec89a8403eae593ce8887cfbf2c610 Mon Sep 17 00:00:00 2001 From: David Gregory Date: Mon, 14 Mar 2022 10:25:53 +0000 Subject: [PATCH 11/99] Port sbt project naming macro for tlCrossRootProject - resolves #169 --- .editorconfig | 11 +++ .../org/typelevel/sbt/CrossRootProject.scala | 12 ++-- .../sbt/CrossRootProjectMacros.scala | 68 +++++++++++++++++++ .../org/typelevel/sbt/TypelevelCiPlugin.scala | 3 +- 4 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 .editorconfig create mode 100644 ci/src/main/scala/org/typelevel/sbt/CrossRootProjectMacros.scala diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..0e7d8d87 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{scala,sbt}] +indent_style = space +indent_size = 2 diff --git a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala index 6cc4e678..07bd4c76 100644 --- a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala +++ b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala @@ -99,11 +99,13 @@ object CrossRootProject { def unapply(root: CrossRootProject): Some[(Project, Project, Project, Project)] = Some((root.all, root.jvm, root.js, root.native)) - private[sbt] def apply(): CrossRootProject = new CrossRootProject( - Project("root", file(".")), - Project("rootJVM", file(".jvm")), - Project("rootJS", file(".js")), - Project("rootNative", file(".native")) + def apply(): CrossRootProject = CrossRootProject("root") + + def apply(name: String): CrossRootProject = new CrossRootProject( + Project(name, file(".")), + Project(s"${name}JVM", file(".jvm")), + Project(s"${name}JS", file(".js")), + Project(s"${name}Native", file(".native")) ).enablePlugins(NoPublishPlugin, TypelevelCiCrossPlugin) } diff --git a/ci/src/main/scala/org/typelevel/sbt/CrossRootProjectMacros.scala b/ci/src/main/scala/org/typelevel/sbt/CrossRootProjectMacros.scala new file mode 100644 index 00000000..5e819ad8 --- /dev/null +++ b/ci/src/main/scala/org/typelevel/sbt/CrossRootProjectMacros.scala @@ -0,0 +1,68 @@ +/* + * Copyright 2022 Typelevel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.typelevel.sbt + +import scala.annotation.tailrec +import scala.reflect.macros.blackbox + +private[sbt] object CrossRootProjectMacros { + + // Copied from sbt.std.KeyMacro + def definingValName(c: blackbox.Context, invalidEnclosingTree: String => String): String = { + import c.universe.{Apply => ApplyTree, _} + val methodName = c.macroApplication.symbol.name + def processName(n: Name): String = + n.decodedName + .toString + .trim // trim is not strictly correct, but macros don't expose the API necessary + @tailrec def enclosingVal(trees: List[c.Tree]): String = { + trees match { + case ValDef(_, name, _, _) :: _ => processName(name) + case (_: ApplyTree | _: Select | _: TypeApply) :: xs => enclosingVal(xs) + // lazy val x: X = has this form for some reason (only when the explicit type is present, though) + case Block(_, _) :: DefDef(mods, name, _, _, _, _) :: _ if mods.hasFlag(Flag.LAZY) => + processName(name) + case _ => + c.error(c.enclosingPosition, invalidEnclosingTree(methodName.decodedName.toString)) + "" + } + } + enclosingVal(enclosingTrees(c).toList) + } + + // Copied from sbt.std.KeyMacro + def enclosingTrees(c: blackbox.Context): Seq[c.Tree] = + c.asInstanceOf[reflect.macros.runtime.Context] + .callsiteTyper + .context + .enclosingContextChain + .map(_.tree.asInstanceOf[c.Tree]) + + def crossRootProjectImpl(c: blackbox.Context): c.Expr[CrossRootProject] = { + import c.universe._ + + val enclosingValName = definingValName( + c, + methodName => + s"""$methodName must be directly assigned to a val, such as `val x = $methodName`. Alternatively, you can use `org.typelevel.sbt.CrossRootProject.apply`""" + ) + + val name = c.Expr[String](Literal(Constant(enclosingValName))) + + reify { CrossRootProject(name.splice) } + } +} diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index 211da306..335f99ac 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -21,6 +21,7 @@ import org.typelevel.sbt.gha.GenerativePlugin import org.typelevel.sbt.gha.GitHubActionsPlugin import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ import com.typesafe.tools.mima.plugin.MimaPlugin +import scala.language.experimental.macros object TypelevelCiPlugin extends AutoPlugin { @@ -28,7 +29,7 @@ object TypelevelCiPlugin extends AutoPlugin { override def trigger = allRequirements object autoImport { - def tlCrossRootProject: CrossRootProject = CrossRootProject() + def tlCrossRootProject: CrossRootProject = macro CrossRootProjectMacros.crossRootProjectImpl } override def buildSettings = Seq( From 729f6dbe3dd51afb501a76db6bdb428da7d891a8 Mon Sep 17 00:00:00 2001 From: David Gregory Date: Tue, 15 Mar 2022 13:23:48 +0000 Subject: [PATCH 12/99] Ensure that the root project ID is no longer hardcoded anywhere --- .../org/typelevel/sbt/CrossRootProject.scala | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala index 07bd4c76..fb257f66 100644 --- a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala +++ b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala @@ -20,8 +20,8 @@ import sbt._ import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ /** - * Simultaneously creates a `root`, `rootJVM`, `rootJS`, and `rootNative` project, and - * automatically enables the `NoPublishPlugin`. + * Simultaneously creates a root project, a Scala JVM subproject, a Scala.js subproject, a Scala + * Native subproject and automatically enables the `NoPublishPlugin`. */ final class CrossRootProject private ( val all: Project, @@ -96,16 +96,16 @@ final class CrossRootProject private ( } object CrossRootProject { - def unapply(root: CrossRootProject): Some[(Project, Project, Project, Project)] = - Some((root.all, root.jvm, root.js, root.native)) + def unapply(rootProject: CrossRootProject): Some[(Project, Project, Project, Project)] = + Some((rootProject.all, rootProject.jvm, rootProject.js, rootProject.native)) def apply(): CrossRootProject = CrossRootProject("root") - def apply(name: String): CrossRootProject = new CrossRootProject( - Project(name, file(".")), - Project(s"${name}JVM", file(".jvm")), - Project(s"${name}JS", file(".js")), - Project(s"${name}Native", file(".native")) + def apply(id: String): CrossRootProject = new CrossRootProject( + Project(id, file(".")), + Project(s"${id}JVM", file(".jvm")), + Project(s"${id}JS", file(".js")), + Project(s"${id}Native", file(".native")) ).enablePlugins(NoPublishPlugin, TypelevelCiCrossPlugin) } @@ -128,8 +128,10 @@ object TypelevelCiJVMPlugin extends AutoPlugin { override def requires = TypelevelCiCrossPlugin override def buildSettings: Seq[Setting[_]] = Seq( - githubWorkflowBuildMatrixAdditions ~= { matrix => - matrix.updated("project", matrix("project") ::: "rootJVM" :: Nil) + githubWorkflowBuildMatrixAdditions := { + val matrix = githubWorkflowBuildMatrixAdditions.value + val rootProject = (LocalRootProject / Keys.thisProject).value + matrix.updated("project", matrix("project") ::: s"${rootProject.id}JVM" :: Nil) } ) } @@ -138,22 +140,28 @@ object TypelevelCiJSPlugin extends AutoPlugin { override def requires = TypelevelCiCrossPlugin override def buildSettings: Seq[Setting[_]] = Seq( - githubWorkflowBuildMatrixAdditions ~= { matrix => - matrix.updated("project", matrix("project") ::: "rootJS" :: Nil) + githubWorkflowBuildMatrixAdditions := { + val matrix = githubWorkflowBuildMatrixAdditions.value + val rootProject = (LocalRootProject / Keys.thisProject).value + matrix.updated("project", matrix("project") ::: s"${rootProject.id}JS" :: Nil) }, githubWorkflowBuildMatrixExclusions ++= { + val rootProject = (LocalRootProject / Keys.thisProject).value githubWorkflowJavaVersions .value .tail - .map(java => MatrixExclude(Map("project" -> "rootJS", "java" -> java.render))) + .map(java => + MatrixExclude(Map("project" -> s"${rootProject.id}JS", "java" -> java.render))) }, - githubWorkflowBuild ~= { steps => + githubWorkflowBuild := { + val steps = githubWorkflowBuild.value + val rootProject = (LocalRootProject / Keys.thisProject).value steps.flatMap { case testStep @ WorkflowStep.Sbt(List("test"), _, _, _, _, _) => val fastOptStep = WorkflowStep.Sbt( List("Test/scalaJSLinkerResult"), name = Some("scalaJSLink"), - cond = Some("matrix.project == 'rootJS'") + cond = Some(s"matrix.project == '${rootProject.id}JS'") ) List(fastOptStep, testStep) case step => List(step) @@ -167,22 +175,28 @@ object TypelevelCiNativePlugin extends AutoPlugin { override def requires = TypelevelCiCrossPlugin override def buildSettings: Seq[Setting[_]] = Seq( - githubWorkflowBuildMatrixAdditions ~= { matrix => - matrix.updated("project", matrix("project") ::: "rootNative" :: Nil) + githubWorkflowBuildMatrixAdditions := { + val matrix = githubWorkflowBuildMatrixAdditions.value + val rootProject = (LocalRootProject / Keys.thisProject).value + matrix.updated("project", matrix("project") ::: s"${rootProject.id}Native" :: Nil) }, githubWorkflowBuildMatrixExclusions ++= { + val rootProject = (LocalRootProject / Keys.thisProject).value githubWorkflowJavaVersions .value .tail - .map(java => MatrixExclude(Map("project" -> "rootNative", "java" -> java.render))) + .map(java => + MatrixExclude(Map("project" -> s"${rootProject.id}Native", "java" -> java.render))) }, - githubWorkflowBuild ~= { steps => + githubWorkflowBuild := { + val steps = githubWorkflowBuild.value + val rootProject = (LocalRootProject / Keys.thisProject).value steps.flatMap { case testStep @ WorkflowStep.Sbt(List("test"), _, _, _, _, _) => val nativeLinkStep = WorkflowStep.Sbt( List("Test/nativeLink"), name = Some("nativeLink"), - cond = Some("matrix.project == 'rootNative'") + cond = Some(s"matrix.project == '${rootProject.id}Native'") ) List(nativeLinkStep, testStep) case step => List(step) From 614d03dd94cea1f6c712adf943cce67ac9381fe3 Mon Sep 17 00:00:00 2001 From: David Gregory Date: Mon, 21 Mar 2022 09:32:25 +0000 Subject: [PATCH 13/99] Address PR comments --- build.sbt | 2 +- ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 71e71b7f..85649435 100644 --- a/build.sbt +++ b/build.sbt @@ -14,7 +14,7 @@ ThisBuild / mergifyStewardConfig ~= { _.map(_.copy(mergeMinors = true)) } ThisBuild / mergifySuccessConditions += MergifyCondition.Custom("#approved-reviews-by>=1") ThisBuild / mergifyLabelPaths += { "docs" -> file("docs") } -lazy val root = tlCrossRootProject.aggregate( +lazy val `sbt-typelevel` = tlCrossRootProject.aggregate( kernel, noPublish, settings, diff --git a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala index fb257f66..51776179 100644 --- a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala +++ b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala @@ -20,8 +20,9 @@ import sbt._ import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ /** - * Simultaneously creates a root project, a Scala JVM subproject, a Scala.js subproject, a Scala - * Native subproject and automatically enables the `NoPublishPlugin`. + * Simultaneously creates a root project, a Scala JVM aggregate project, + * a Scala.js aggregate project, a Scala Native aggregate project and + * automatically enables the `NoPublishPlugin`. */ final class CrossRootProject private ( val all: Project, @@ -99,8 +100,6 @@ object CrossRootProject { def unapply(rootProject: CrossRootProject): Some[(Project, Project, Project, Project)] = Some((rootProject.all, rootProject.jvm, rootProject.js, rootProject.native)) - def apply(): CrossRootProject = CrossRootProject("root") - def apply(id: String): CrossRootProject = new CrossRootProject( Project(id, file(".")), Project(s"${id}JVM", file(".jvm")), From cb8f5dfade9de1ef8e99da87a148efdd3bcd2a22 Mon Sep 17 00:00:00 2001 From: David Gregory Date: Mon, 21 Mar 2022 09:37:26 +0000 Subject: [PATCH 14/99] Update references to root project name --- .github/workflows/ci.yml | 12 ++++++------ .mergify.yml | 2 +- .../scala/org/typelevel/sbt/CrossRootProject.scala | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94c56137..44c2652d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: os: [ubuntu-latest] scala: [2.12.15] java: [temurin@8] - project: [rootJVM] + project: [sbt-typelevelJVM] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -81,11 +81,11 @@ jobs: - name: Make target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: mkdir -p github/target github-actions/target kernel/target versioning/target ci-release/target target .js/target mdocs/target site/target ci-signing/target mergify/target unidoc/target mima/target .jvm/target .native/target no-publish/target sonatype/target ci/target sonatype-ci-release/target core/target settings/target project/target + run: mkdir -p github/target github-actions/target kernel/target versioning/target ci-release/target .jvm/target mdocs/target site/target ci-signing/target mergify/target unidoc/target .native/target mima/target no-publish/target sonatype/target ci/target sonatype-ci-release/target core/target settings/target target .js/target project/target - name: Compress target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: tar cf targets.tar github/target github-actions/target kernel/target versioning/target ci-release/target target .js/target mdocs/target site/target ci-signing/target mergify/target unidoc/target mima/target .jvm/target .native/target no-publish/target sonatype/target ci/target sonatype-ci-release/target core/target settings/target project/target + run: tar cf targets.tar github/target github-actions/target kernel/target versioning/target ci-release/target .jvm/target mdocs/target site/target ci-signing/target mergify/target unidoc/target .native/target mima/target no-publish/target sonatype/target ci/target sonatype-ci-release/target core/target settings/target target .js/target project/target - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') @@ -138,12 +138,12 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - name: Download target directories (2.12.15, rootJVM) + - name: Download target directories (2.12.15, sbt-typelevelJVM) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-sbt-typelevelJVM - - name: Inflate target directories (2.12.15, rootJVM) + - name: Inflate target directories (2.12.15, sbt-typelevelJVM) run: | tar xf targets.tar rm targets.tar diff --git a/.mergify.yml b/.mergify.yml index 9533a3ab..de3ae80a 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -12,7 +12,7 @@ pull_request_rules: - or: - body~=labels:.*early-semver-patch - body~=labels:.*early-semver-minor - - status-success=Build and Test (ubuntu-latest, 2.12.15, temurin@8, rootJVM) + - status-success=Build and Test (ubuntu-latest, 2.12.15, temurin@8, sbt-typelevelJVM) - '#approved-reviews-by>=1' actions: merge: {} diff --git a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala index 51776179..f17a4fcf 100644 --- a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala +++ b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala @@ -20,9 +20,8 @@ import sbt._ import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ /** - * Simultaneously creates a root project, a Scala JVM aggregate project, - * a Scala.js aggregate project, a Scala Native aggregate project and - * automatically enables the `NoPublishPlugin`. + * Simultaneously creates a root project, a Scala JVM aggregate project, a Scala.js aggregate + * project, a Scala Native aggregate project and automatically enables the `NoPublishPlugin`. */ final class CrossRootProject private ( val all: Project, From 8dc9da4a98ec0a3a03e2f5c3d527ddb6e33aaa03 Mon Sep 17 00:00:00 2001 From: David Gregory Date: Mon, 21 Mar 2022 13:54:20 +0000 Subject: [PATCH 15/99] Extract root project ID into a Def.setting --- .../org/typelevel/sbt/CrossRootProject.scala | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala index f17a4fcf..f2c3de3e 100644 --- a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala +++ b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala @@ -107,6 +107,15 @@ object CrossRootProject { ).enablePlugins(NoPublishPlugin, TypelevelCiCrossPlugin) } +/** + * This trait provides an anonymous setting giving access to the local root project ID. + */ +private[sbt] trait RootProjectId { + protected def rootProjectId = Def.setting { + (LocalRootProject / Keys.thisProject).value.id + } +} + /** * This plugin is used internally by CrossRootProject. */ @@ -122,44 +131,39 @@ object TypelevelCiCrossPlugin extends AutoPlugin { // The following plugins are used internally to support CrossRootProject. -object TypelevelCiJVMPlugin extends AutoPlugin { +object TypelevelCiJVMPlugin extends AutoPlugin with RootProjectId { override def requires = TypelevelCiCrossPlugin override def buildSettings: Seq[Setting[_]] = Seq( githubWorkflowBuildMatrixAdditions := { val matrix = githubWorkflowBuildMatrixAdditions.value - val rootProject = (LocalRootProject / Keys.thisProject).value - matrix.updated("project", matrix("project") ::: s"${rootProject.id}JVM" :: Nil) + matrix.updated("project", matrix("project") ::: s"${rootProjectId.value}JVM" :: Nil) } ) } -object TypelevelCiJSPlugin extends AutoPlugin { +object TypelevelCiJSPlugin extends AutoPlugin with RootProjectId { override def requires = TypelevelCiCrossPlugin override def buildSettings: Seq[Setting[_]] = Seq( githubWorkflowBuildMatrixAdditions := { val matrix = githubWorkflowBuildMatrixAdditions.value - val rootProject = (LocalRootProject / Keys.thisProject).value - matrix.updated("project", matrix("project") ::: s"${rootProject.id}JS" :: Nil) + matrix.updated("project", matrix("project") ::: s"${rootProjectId.value}JS" :: Nil) }, githubWorkflowBuildMatrixExclusions ++= { - val rootProject = (LocalRootProject / Keys.thisProject).value githubWorkflowJavaVersions .value .tail .map(java => - MatrixExclude(Map("project" -> s"${rootProject.id}JS", "java" -> java.render))) + MatrixExclude(Map("project" -> s"${rootProjectId.value}JS", "java" -> java.render))) }, githubWorkflowBuild := { - val steps = githubWorkflowBuild.value - val rootProject = (LocalRootProject / Keys.thisProject).value - steps.flatMap { + githubWorkflowBuild.value.flatMap { case testStep @ WorkflowStep.Sbt(List("test"), _, _, _, _, _) => val fastOptStep = WorkflowStep.Sbt( List("Test/scalaJSLinkerResult"), name = Some("scalaJSLink"), - cond = Some(s"matrix.project == '${rootProject.id}JS'") + cond = Some(s"matrix.project == '${rootProjectId.value}JS'") ) List(fastOptStep, testStep) case step => List(step) @@ -169,32 +173,29 @@ object TypelevelCiJSPlugin extends AutoPlugin { } -object TypelevelCiNativePlugin extends AutoPlugin { +object TypelevelCiNativePlugin extends AutoPlugin with RootProjectId { override def requires = TypelevelCiCrossPlugin override def buildSettings: Seq[Setting[_]] = Seq( githubWorkflowBuildMatrixAdditions := { val matrix = githubWorkflowBuildMatrixAdditions.value - val rootProject = (LocalRootProject / Keys.thisProject).value - matrix.updated("project", matrix("project") ::: s"${rootProject.id}Native" :: Nil) + matrix.updated("project", matrix("project") ::: s"${rootProjectId.value}Native" :: Nil) }, githubWorkflowBuildMatrixExclusions ++= { - val rootProject = (LocalRootProject / Keys.thisProject).value githubWorkflowJavaVersions .value .tail .map(java => - MatrixExclude(Map("project" -> s"${rootProject.id}Native", "java" -> java.render))) + MatrixExclude( + Map("project" -> s"${rootProjectId.value}Native", "java" -> java.render))) }, githubWorkflowBuild := { - val steps = githubWorkflowBuild.value - val rootProject = (LocalRootProject / Keys.thisProject).value - steps.flatMap { + githubWorkflowBuild.value.flatMap { case testStep @ WorkflowStep.Sbt(List("test"), _, _, _, _, _) => val nativeLinkStep = WorkflowStep.Sbt( List("Test/nativeLink"), name = Some("nativeLink"), - cond = Some(s"matrix.project == '${rootProject.id}Native'") + cond = Some(s"matrix.project == '${rootProjectId.value}Native'") ) List(nativeLinkStep, testStep) case step => List(step) From 08dc90aa37ef1c5a31a87335c75ad4c27cf6365a Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Mon, 21 Mar 2022 08:03:46 -0700 Subject: [PATCH 16/99] Set default `tlJdkRelease := Some(8)` --- .../main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 44850a86..1323c244 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -39,7 +39,7 @@ object TypelevelSettingsPlugin extends AutoPlugin { override def globalSettings = Seq( tlFatalWarnings := false, - tlJdkRelease := None, + tlJdkRelease := Some(8), Def.derive(scalaVersion := crossScalaVersions.value.last, default = true) ) From 5089ac6e8a8e8697c3247da01f3dcf1cd4b33e50 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 22 Mar 2022 17:10:44 -0700 Subject: [PATCH 17/99] Update sbt-header to 5.6.5 --- core/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/build.sbt b/core/build.sbt index 52b22066..3275f185 100644 --- a/core/build.sbt +++ b/core/build.sbt @@ -1,3 +1,3 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.5") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") From 4a8db2d0d13cd19831697bba91bc3559c1c6a04a Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 23 Mar 2022 18:19:40 -0700 Subject: [PATCH 18/99] Revert "Update mdoc, sbt-mdoc to 2.3.0" --- site/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/build.sbt b/site/build.sbt index 0a1a57c4..218aaa8f 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.0") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24") addSbtPlugin("org.planet42" % "laika-sbt" % "0.18.1") From 20e944c9b0422b82ab50edb1165f570b5a5623f2 Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Sun, 27 Mar 2022 15:08:40 -0400 Subject: [PATCH 19/99] Update sbt-mdoc to 2.3.2 --- site/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/build.sbt b/site/build.sbt index 64e5969e..aab94c01 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2") addSbtPlugin("org.planet42" % "laika-sbt" % "0.18.2") From 79b42412e5e95ca373e7cc7ddd3cbf3eca0b3ba2 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 29 Mar 2022 15:02:50 +0000 Subject: [PATCH 20/99] Update sbt-git to 2.0.0 --- github/build.sbt | 2 +- settings/build.sbt | 2 +- versioning/build.sbt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/github/build.sbt b/github/build.sbt index 389f9956..bf56a8a9 100644 --- a/github/build.sbt +++ b/github/build.sbt @@ -1,2 +1,2 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "2.0.0") diff --git a/settings/build.sbt b/settings/build.sbt index 688233f6..ae94a757 100644 --- a/settings/build.sbt +++ b/settings/build.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "2.0.0") diff --git a/versioning/build.sbt b/versioning/build.sbt index 688233f6..ae94a757 100644 --- a/versioning/build.sbt +++ b/versioning/build.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "2.0.0") From ad7f9c9374551192b20e79b0d64008dfbc8cf670 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 29 Mar 2022 15:08:42 +0000 Subject: [PATCH 21/99] Update coordinates --- github/build.sbt | 2 +- settings/build.sbt | 2 +- versioning/build.sbt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/github/build.sbt b/github/build.sbt index bf56a8a9..5d1244e6 100644 --- a/github/build.sbt +++ b/github/build.sbt @@ -1,2 +1,2 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "2.0.0") +addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0") diff --git a/settings/build.sbt b/settings/build.sbt index ae94a757..34e16ce0 100644 --- a/settings/build.sbt +++ b/settings/build.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "2.0.0") +addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0") diff --git a/versioning/build.sbt b/versioning/build.sbt index ae94a757..34e16ce0 100644 --- a/versioning/build.sbt +++ b/versioning/build.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "2.0.0") +addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0") From eddda0e9d8b5b96160887f2e5f01ae97975a1fe8 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 29 Mar 2022 15:12:28 +0000 Subject: [PATCH 22/99] ... and the package --- .../org/typelevel/sbt/TypelevelScalaJSGitHubPlugin.scala | 2 +- .../scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 4 ++-- .../scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/github/src/main/scala/org/typelevel/sbt/TypelevelScalaJSGitHubPlugin.scala b/github/src/main/scala/org/typelevel/sbt/TypelevelScalaJSGitHubPlugin.scala index 5707302d..bdfb06a8 100644 --- a/github/src/main/scala/org/typelevel/sbt/TypelevelScalaJSGitHubPlugin.scala +++ b/github/src/main/scala/org/typelevel/sbt/TypelevelScalaJSGitHubPlugin.scala @@ -18,7 +18,7 @@ package org.typelevel.sbt import sbt._, Keys._ import org.scalajs.sbtplugin.ScalaJSPlugin -import com.typesafe.sbt.SbtGit.git +import com.github.sbt.git.SbtGit.git import org.typelevel.sbt.kernel.GitHelper object TypelevelScalaJSGitHubPlugin extends AutoPlugin { diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 1323c244..1534c36f 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -17,8 +17,8 @@ package org.typelevel.sbt import sbt._, Keys._ -import com.typesafe.sbt.GitPlugin -import com.typesafe.sbt.SbtGit.git +import com.github.sbt.git.GitPlugin +import com.github.sbt.git.SbtGit.git import org.typelevel.sbt.kernel.V import org.typelevel.sbt.kernel.GitHelper diff --git a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala index 083bf8db..cdbd5443 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala @@ -17,8 +17,8 @@ package org.typelevel.sbt import sbt._, Keys._ -import com.typesafe.sbt.GitPlugin -import com.typesafe.sbt.SbtGit.git +import com.github.sbt.git.GitPlugin +import com.github.sbt.git.SbtGit.git import org.typelevel.sbt.kernel.V import scala.util.Try From ce8bf4704cdd32df8d476d09129a7f3baa2c3274 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 29 Mar 2022 15:45:27 +0000 Subject: [PATCH 23/99] Update actions to latest --- .github/workflows/ci.yml | 22 +++++++++---------- .../typelevel/sbt/gha/GenerativePlugin.scala | 6 ++--- .../org/typelevel/sbt/gha/WorkflowStep.scala | 8 +++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44c2652d..d5b3ee90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,21 +36,21 @@ jobs: - name: Download Java (temurin@8) id: download-java-temurin-8 if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v1 + uses: typelevel/download-java@v2 with: distribution: temurin java-version: 8 - name: Setup Java (temurin@8) if: matrix.java == 'temurin@8' - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.sbt @@ -89,7 +89,7 @@ jobs: - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }} path: targets.tar @@ -113,21 +113,21 @@ jobs: - name: Download Java (temurin@8) id: download-java-temurin-8 if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v1 + uses: typelevel/download-java@v2 with: distribution: temurin java-version: 8 - name: Setup Java (temurin@8) if: matrix.java == 'temurin@8' - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.sbt @@ -139,7 +139,7 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Download target directories (2.12.15, sbt-typelevelJVM) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-sbt-typelevelJVM @@ -189,21 +189,21 @@ jobs: - name: Download Java (temurin@8) id: download-java-temurin-8 if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v1 + uses: typelevel/download-java@v2 with: distribution: temurin java-version: 8 - name: Setup Java (temurin@8) if: matrix.java == 'temurin@8' - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.sbt diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index 9346535b..936b17a6 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -592,7 +592,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} (List("os", "java", "scala") ::: keys).map(k => s"$${{ matrix.$k }}").mkString("-") val upload = WorkflowStep.Use( - UseRef.Public("actions", "upload-artifact", "v2"), + UseRef.Public("actions", "upload-artifact", "v3"), name = Some(s"Upload target directories"), params = Map("name" -> s"target-$artifactId", "path" -> "targets.tar"), cond = Some(publicationCond.value) @@ -639,7 +639,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} val pretty = v.mkString(", ") val download = WorkflowStep.Use( - UseRef.Public("actions", "download-artifact", "v2"), + UseRef.Public("actions", "download-artifact", "v3"), name = Some(s"Download target directories ($pretty)"), params = Map("name" -> s"target-$${{ matrix.os }}-$${{ matrix.java }}-${v.mkString("-")}") @@ -662,7 +662,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} Seq( WorkflowStep.Use( - UseRef.Public("actions", "cache", "v2"), + UseRef.Public("actions", "cache", "v3"), name = Some("Cache sbt"), params = Map( "path" -> Seq( diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index fde725af..4ac539d5 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -49,14 +49,14 @@ object WorkflowStep { val id = s"download-java-${dist.rendering}-$version" List( WorkflowStep.Use( - UseRef.Public("typelevel", "download-java", "v1"), + UseRef.Public("typelevel", "download-java", "v2"), name = Some(s"Download Java (${jv.render})"), id = Some(id), cond = cond, params = Map("distribution" -> dist.rendering, "java-version" -> version) ), WorkflowStep.Use( - UseRef.Public("actions", "setup-java", "v2"), + UseRef.Public("actions", "setup-java", "v3"), name = Some(s"Setup Java (${jv.render})"), cond = cond, params = Map( @@ -69,7 +69,7 @@ object WorkflowStep { case jv @ JavaSpec(dist, version) => WorkflowStep.Use( - UseRef.Public("actions", "setup-java", "v2"), + UseRef.Public("actions", "setup-java", "v3"), name = Some(s"Setup Java (${jv.render})"), cond = Some(s"matrix.java == '${jv.render}'"), params = Map("distribution" -> dist.rendering, "java-version" -> version) @@ -77,7 +77,7 @@ object WorkflowStep { } val Tmate: WorkflowStep = - Use(UseRef.Public("mxschmitt", "action-tmate", "v2"), name = Some("Setup tmate session")) + Use(UseRef.Public("mxschmitt", "action-tmate", "v3"), name = Some("Setup tmate session")) def ComputeVar(name: String, cmd: String): WorkflowStep = Run( From dad0f80da63030cb5242573788f6b25d1a56556e Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 22 May 2022 17:03:49 +0000 Subject: [PATCH 24/99] Auto-populate developers w/ GH info --- build.sbt | 2 +- .../typelevel/sbt/TypelevelGitHubPlugin.scala | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index acee116c..e1f557e5 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ ThisBuild / tlBaseVersion := "0.4" ThisBuild / tlCiReleaseBranches := Seq("series/0.4") ThisBuild / tlSitePublishBranch := Some("series/0.4") ThisBuild / crossScalaVersions := Seq("2.12.15") -ThisBuild / developers := List( +ThisBuild / developers ++= List( tlGitHubDev("armanbilge", "Arman Bilge"), tlGitHubDev("rossabaker", "Ross A. Baker"), tlGitHubDev("ChristopherDavenport", "Christopher Davenport"), diff --git a/github/src/main/scala/org/typelevel/sbt/TypelevelGitHubPlugin.scala b/github/src/main/scala/org/typelevel/sbt/TypelevelGitHubPlugin.scala index 49530dc5..466cf698 100644 --- a/github/src/main/scala/org/typelevel/sbt/TypelevelGitHubPlugin.scala +++ b/github/src/main/scala/org/typelevel/sbt/TypelevelGitHubPlugin.scala @@ -46,7 +46,21 @@ object TypelevelGitHubPlugin extends AutoPlugin { sLog.value.info(s"set scmInfo to https://github.com/$user/$repo") gitHubScmInfo(user, repo) }, - homepage := homepage.value.orElse(scmInfo.value.map(_.browseUrl)) + homepage := homepage.value.orElse(scmInfo.value.map(_.browseUrl)), + developers := { + gitHubUserRepo + .value + .toList + .map { + case (user, repo) => + Developer( + user, + s"$repo contributors", + s"@$user", + url(s"https://github.com/$user/$repo/contributors") + ) + } + } ) private def gitHubScmInfo(user: String, repo: String) = From f932e4d7f729396c24330ed4af3dab50dd07e831 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 12 Jun 2022 18:21:40 +0100 Subject: [PATCH 25/99] use setup-java cache=sbt support --- .../typelevel/sbt/gha/GenerativePlugin.scala | 24 +------------------ .../org/typelevel/sbt/gha/WorkflowStep.scala | 5 ++-- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index 936b17a6..dc1415d6 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -655,29 +655,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} Seq() } }, - githubWorkflowGeneratedCacheSteps := { - val hashes = githubWorkflowDependencyPatterns.value map { glob => - s"$${{ hashFiles('$glob') }}" - } - - Seq( - WorkflowStep.Use( - UseRef.Public("actions", "cache", "v3"), - name = Some("Cache sbt"), - params = Map( - "path" -> Seq( - "~/.sbt", - "~/.ivy2/cache", - "~/.coursier/cache/v1", - "~/.cache/coursier/v1", - "~/AppData/Local/Coursier/Cache/v1", - "~/Library/Caches/Coursier/v1" - ).mkString("\n"), - "key" -> s"$${{ runner.os }}-sbt-cache-v2-${hashes.mkString("-")}" - ) - ) - ) - }, + githubWorkflowGeneratedCacheSteps := Seq(), githubWorkflowJobSetup := { val autoCrlfOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) { List( diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 4ac539d5..6800707a 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -62,7 +62,8 @@ object WorkflowStep { params = Map( "distribution" -> "jdkfile", "java-version" -> version, - "jdkFile" -> s"$${{ steps.$id.outputs.jdkFile }}" + "jdkFile" -> s"$${{ steps.$id.outputs.jdkFile }}", + "cache" -> "sbt" ) ) ) @@ -72,7 +73,7 @@ object WorkflowStep { UseRef.Public("actions", "setup-java", "v3"), name = Some(s"Setup Java (${jv.render})"), cond = Some(s"matrix.java == '${jv.render}'"), - params = Map("distribution" -> dist.rendering, "java-version" -> version) + params = Map("distribution" -> dist.rendering, "java-version" -> version, "cache" -> "sbt") ) :: Nil } From 61563092601f2e5d1709b45d81f6ce4b61d3c0ff Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 12 Jun 2022 18:24:37 +0100 Subject: [PATCH 26/99] Update ci.yml --- .github/workflows/ci.yml | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5b3ee90..7b6ff767 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,18 +48,7 @@ jobs: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - - - name: Cache sbt - uses: actions/cache@v3 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + cache: sbt - name: Check that workflows are up to date run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck @@ -125,18 +114,7 @@ jobs: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - - - name: Cache sbt - uses: actions/cache@v3 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + cache: sbt - name: Download target directories (2.12.15, sbt-typelevelJVM) uses: actions/download-artifact@v3 @@ -201,18 +179,7 @@ jobs: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - - - name: Cache sbt - uses: actions/cache@v3 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + cache: sbt - name: Generate site run: sbt '++${{ matrix.scala }}' docs/tlSite From b4961455ad5c0071b5cfc1ca0f6376c88db83d10 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 12 Jun 2022 18:31:28 +0100 Subject: [PATCH 27/99] Update WorkflowStep.scala --- .../src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 6800707a..38c7bea1 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -73,7 +73,8 @@ object WorkflowStep { UseRef.Public("actions", "setup-java", "v3"), name = Some(s"Setup Java (${jv.render})"), cond = Some(s"matrix.java == '${jv.render}'"), - params = Map("distribution" -> dist.rendering, "java-version" -> version, "cache" -> "sbt") + params = + Map("distribution" -> dist.rendering, "java-version" -> version, "cache" -> "sbt") ) :: Nil } From febf8b1f753d290636b05a5245d32d0fcd66744f Mon Sep 17 00:00:00 2001 From: satorg Date: Mon, 20 Jun 2022 02:55:48 -0700 Subject: [PATCH 28/99] re-enable unused warnings for Scala 2.12 --- .../org/typelevel/sbt/TypelevelPlugin.scala | 6 ------ .../typelevel/sbt/gha/GenerativePlugin.scala | 1 - .../typelevel/sbt/mergify/MergifyAction.scala | 3 ++- .../sbt/mergify/MergifyCondition.scala | 2 ++ .../sbt/TypelevelSettingsPlugin.scala | 21 ++++++++----------- 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala index e9b1e847..64865f0a 100644 --- a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala +++ b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala @@ -110,10 +110,4 @@ object TypelevelPlugin extends AutoPlugin { // override for bincompat override def projectSettings = immutable.Seq.empty - - private val primaryJavaCond = Def.setting { - val java = githubWorkflowJavaVersions.value.head - s"matrix.java == '${java.render}'" - } - } diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index 936b17a6..4e8efc9a 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -614,7 +614,6 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} key -> values.take(1) // we only want the primary value } - val keys = "scala" :: additions.keys.toList.sorted val oses = githubWorkflowOSes.value.toList val scalas = githubWorkflowScalaVersions.value.toList val javas = githubWorkflowJavaVersions.value.toList diff --git a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala index 9c96203e..e4beb9f7 100644 --- a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala +++ b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala @@ -18,6 +18,7 @@ package org.typelevel.sbt.mergify import io.circe.Encoder import io.circe.syntax._ +import scala.annotation.nowarn sealed abstract class MergifyAction { private[mergify] def name = getClass.getSimpleName.toLowerCase @@ -57,6 +58,6 @@ object MergifyAction { } } + @nowarn("cat=unused") private[this] object Dummy extends MergifyAction - } diff --git a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala index ea6f8c29..8ce19276 100644 --- a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala +++ b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala @@ -18,6 +18,7 @@ package org.typelevel.sbt.mergify import io.circe.Encoder import io.circe.syntax._ +import scala.annotation.nowarn sealed abstract class MergifyCondition @@ -44,5 +45,6 @@ object MergifyCondition { implicit def encoder: Encoder[Or] = Encoder.forProduct1("or")(_.conditions) } + @nowarn("cat=unused") private[this] final object Dummy extends MergifyCondition // break exhaustivity checking } diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 8f2c58d7..588bda66 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -86,23 +86,20 @@ object TypelevelSettingsPlugin extends AutoPlugin { val warnings211 = Seq("-Ywarn-numeric-widen") // In 2.10 this produces a some strange spurious error - val warnings212 = Seq("-Xlint:-unused,_") + val warnings212 = Seq.empty[String] - val removed213 = Set("-Xlint:-unused,_", "-Xlint") + val removed213 = Set( + "-Xlint", + "-Ywarn-dead-code", // superseded by "-Wdead-code" + "-Ywarn-numeric-widen" // superseded by "-Wnumeric-widen" + ) val warnings213 = Seq( - "-Xlint:deprecation", - "-Wunused:nowarn", "-Wdead-code", "-Wextra-implicit", "-Wnumeric-widen", - "-Wunused:implicits", - "-Wunused:explicits", - "-Wunused:imports", - "-Wunused:locals", - "-Wunused:params", - "-Wunused:patvars", - "-Wunused:privates", - "-Wvalue-discard" + "-Wunused", // all choices are enabled by default + "-Wvalue-discard", + "-Xlint:deprecation" ) val warningsDotty = Seq.empty From 17bf2cbd8988a2b9448ebba88761f6a695a63dcf Mon Sep 17 00:00:00 2001 From: satorg Date: Mon, 20 Jun 2022 18:16:22 -0700 Subject: [PATCH 29/99] add priate `unused` method for testing scalacOptions --- .../scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 588bda66..69212167 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -21,15 +21,14 @@ import com.github.sbt.git.SbtGit.git import org.typelevel.sbt.kernel.GitHelper import org.typelevel.sbt.kernel.V import sbt._ -import sbt._ import sbtcrossproject.CrossPlugin.autoImport._ import sbtcrossproject.CrossType import java.io.File import java.lang.management.ManagementFactory +import scala.annotation.nowarn import scala.util.Try -import Keys._ import Keys._ object TypelevelSettingsPlugin extends AutoPlugin { @@ -317,4 +316,7 @@ object TypelevelSettingsPlugin extends AutoPlugin { oldSchool ++ newSchool ++ old } } + + @nowarn("cat=unused") + private[this] def unused(): Unit = () } From ec12ba12b86b0524c8965bede21e41f209b40420 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 21 Jun 2022 01:38:15 +0000 Subject: [PATCH 30/99] scalafixAll --- .../src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala | 1 + .../main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala | 1 + 2 files changed, 2 insertions(+) diff --git a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala index e4beb9f7..c83accd6 100644 --- a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala +++ b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyAction.scala @@ -18,6 +18,7 @@ package org.typelevel.sbt.mergify import io.circe.Encoder import io.circe.syntax._ + import scala.annotation.nowarn sealed abstract class MergifyAction { diff --git a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala index 8ce19276..9049ef7b 100644 --- a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala +++ b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyCondition.scala @@ -18,6 +18,7 @@ package org.typelevel.sbt.mergify import io.circe.Encoder import io.circe.syntax._ + import scala.annotation.nowarn sealed abstract class MergifyCondition From 2c3470dc275cb5b37d25ea71c0f67415b9dfdb52 Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Tue, 21 Jun 2022 19:45:38 -0400 Subject: [PATCH 31/99] Add FAQ about ScalaJS version --- docs/faq.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/faq.md b/docs/faq.md index 559fce19..23d5e781 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -95,3 +95,14 @@ ThisBuild / tlSonatypeUseLegacyHost := false ## How do I publish a website like this one? Check out the [**sbt-typelevel-site**](site.md) plugin. + +## How do I manage my ScalaJS version? + +We recommend explicitly setting your ScalaJS version in `project/plugins.sbt`. + +``` +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0") +``` + +**sbt-typelevel** ships with a conservative ScalaJS version to enable certain settings. +If one of your dependencies requires a newer ScalaJS version you may experience failures in the `scalaJSLink` CI step. From 283232ada091026bd0932d03a32fcb3d94f85385 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 21 Jun 2022 18:32:08 -0700 Subject: [PATCH 32/99] Oh no, I've become one of *those* people --- docs/faq.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 23d5e781..8e4f561f 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -96,13 +96,13 @@ ThisBuild / tlSonatypeUseLegacyHost := false Check out the [**sbt-typelevel-site**](site.md) plugin. -## How do I manage my ScalaJS version? +## How do I manage my Scala.js version? -We recommend explicitly setting your ScalaJS version in `project/plugins.sbt`. +We recommend explicitly setting your Scala.js version in `project/plugins.sbt`. -``` +```scala addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0") ``` -**sbt-typelevel** ships with a conservative ScalaJS version to enable certain settings. -If one of your dependencies requires a newer ScalaJS version you may experience failures in the `scalaJSLink` CI step. +**sbt-typelevel** ships with a conservative Scala.js version to enable certain settings. +If one of your dependencies requires a newer Scala.js version you may experience failures in the `scalaJSLink` CI step. From 9773637dab4eed5a263b74c70ccb7530be19d76e Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Tue, 12 Jul 2022 05:22:21 +0000 Subject: [PATCH 33/99] Update sbt to 1.7.1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c8fcab54..22af2628 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.2 +sbt.version=1.7.1 From 207c09c35175f7a54c91244d517872d4d7a64973 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 16 Jul 2022 18:04:05 +0000 Subject: [PATCH 34/99] Add `with`-builders to `WorkflowStep` --- .../org/typelevel/sbt/gha/WorkflowStep.scala | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 4ac539d5..f03b2585 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -21,6 +21,11 @@ sealed trait WorkflowStep extends Product with Serializable { def name: Option[String] def cond: Option[String] def env: Map[String, String] + + def withId(id: Option[String]): WorkflowStep + def withName(name: Option[String]): WorkflowStep + def withCond(cond: Option[String]): WorkflowStep + def withEnv(env: Map[String, String]): WorkflowStep } object WorkflowStep { @@ -96,7 +101,13 @@ object WorkflowStep { cond: Option[String] = None, env: Map[String, String] = Map(), params: Map[String, String] = Map()) - extends WorkflowStep + extends WorkflowStep { + def withId(id: Option[String]) = copy(id = id) + def withName(name: Option[String]) = copy(name = name) + def withCond(cond: Option[String]) = copy(cond = cond) + def withEnv(env: Map[String, String]) = copy(env = env) + } + final case class Sbt( commands: List[String], id: Option[String] = None, @@ -104,7 +115,13 @@ object WorkflowStep { cond: Option[String] = None, env: Map[String, String] = Map(), params: Map[String, String] = Map()) - extends WorkflowStep + extends WorkflowStep { + def withId(id: Option[String]) = copy(id = id) + def withName(name: Option[String]) = copy(name = name) + def withCond(cond: Option[String]) = copy(cond = cond) + def withEnv(env: Map[String, String]) = copy(env = env) + } + final case class Use( ref: UseRef, params: Map[String, String] = Map(), @@ -112,5 +129,10 @@ object WorkflowStep { name: Option[String] = None, cond: Option[String] = None, env: Map[String, String] = Map()) - extends WorkflowStep + extends WorkflowStep { + def withId(id: Option[String]) = copy(id = id) + def withName(name: Option[String]) = copy(name = name) + def withCond(cond: Option[String]) = copy(cond = cond) + def withEnv(env: Map[String, String]) = copy(env = env) + } } From adeee57ac0746fe7527dfb036cd8cf31986d8d4f Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 16 Jul 2022 18:22:59 +0000 Subject: [PATCH 35/99] Add dependency submission job --- .github/workflows/ci.yml | 62 +++++++++++++++++++ .../org/typelevel/sbt/TypelevelCiPlugin.scala | 27 +++++++- .../org/typelevel/sbt/gha/WorkflowStep.scala | 6 ++ 3 files changed, 94 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 950d6e34..f57b6199 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -208,6 +208,68 @@ jobs: SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} run: sbt '++${{ matrix.scala }}' tlRelease + dependency-submission: + name: Submit Dependencies + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.12.16] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Download Java (temurin@8) + id: download-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: typelevel/download-java@v2 + with: + distribution: temurin + java-version: 8 + + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v3 + with: + distribution: jdkfile + java-version: 8 + jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + + - name: Download Java (temurin@17) + id: download-java-temurin-17 + if: matrix.java == 'temurin@17' + uses: typelevel/download-java@v2 + with: + distribution: temurin + java-version: 17 + + - name: Setup Java (temurin@17) + if: matrix.java == 'temurin@17' + uses: actions/setup-java@v3 + with: + distribution: jdkfile + java-version: 17 + jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} + + - name: Cache sbt + uses: actions/cache@v3 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: Submit Dependencies + if: github.event_name != 'pull_request' + uses: scalacenter/sbt-dependency-submission@v2 + site: name: Generate Site strategy: diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index 59dd18d2..e3e8b8e5 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -20,10 +20,13 @@ import com.typesafe.tools.mima.plugin.MimaPlugin import org.typelevel.sbt.gha.GenerativePlugin import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ import org.typelevel.sbt.gha.GitHubActionsPlugin +import org.typelevel.sbt.gha.WorkflowStep import sbt._ import scala.language.experimental.macros +import Keys._ + object TypelevelCiPlugin extends AutoPlugin { override def requires = GitHubActionsPlugin && GenerativePlugin && MimaPlugin @@ -42,6 +45,9 @@ object TypelevelCiPlugin extends AutoPlugin { settingKey[Boolean]("Whether to do MiMa binary issues check in CI (default: true)") lazy val tlCiDocCheck = settingKey[Boolean]("Whether to build API docs in CI (default: true)") + + lazy val tlCiDependencyGraphJob = + settingKey[Boolean]("Whether to add a job to submit dependencies to GH (default: true)") } import autoImport._ @@ -52,6 +58,7 @@ object TypelevelCiPlugin extends AutoPlugin { tlCiScalafixCheck := false, tlCiMimaBinaryIssueCheck := true, tlCiDocCheck := true, + tlCiDependencyGraphJob := true, githubWorkflowTargetBranches ++= Seq( "!update/**", // ignore steward branches "!pr/**" // escape-hatch to disable ci on a branch @@ -125,7 +132,25 @@ object TypelevelCiPlugin extends AutoPlugin { style ++ test ++ scalafix ++ mima ++ doc }, - githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")) + githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")), + githubWorkflowAddedJobs ++= { + val dependencySubmission = + if (tlCiDependencyGraphJob.value) + List( + WorkflowJob( + "dependency-submission", + "Submit Dependencies", + scalas = List(scalaVersion.value), + javas = List(githubWorkflowJavaVersions.value.head), + steps = githubWorkflowJobSetup.value.toList :+ + WorkflowStep + .DependencySubmission + .withCond(Some("github.event_name != 'pull_request'")) + )) + else Nil + + dependencySubmission + } ) private val primaryJavaCond = Def.setting { diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index f03b2585..243f6d62 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -84,6 +84,12 @@ object WorkflowStep { val Tmate: WorkflowStep = Use(UseRef.Public("mxschmitt", "action-tmate", "v3"), name = Some("Setup tmate session")) + val DependencySubmission: WorkflowStep = + Use( + UseRef.Public("scalacenter", "sbt-dependency-submission", "v2"), + name = Some("Submit Dependencies") + ) + def ComputeVar(name: String, cmd: String): WorkflowStep = Run( List("echo \"" + name + "=$(" + cmd + ")\" >> $GITHUB_ENV"), From 17f8ff42867e40b9c262a28de5e3e2560e75fa96 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 16 Jul 2022 23:47:09 +0000 Subject: [PATCH 36/99] Move submit-deps cond to job-level, not step-level --- .github/workflows/ci.yml | 2 +- ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f57b6199..213c0be9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -210,6 +210,7 @@ jobs: dependency-submission: name: Submit Dependencies + if: github.event_name != 'pull_request' strategy: matrix: os: [ubuntu-latest] @@ -267,7 +268,6 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Submit Dependencies - if: github.event_name != 'pull_request' uses: scalacenter/sbt-dependency-submission@v2 site: diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index e3e8b8e5..cd129d9a 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -143,9 +143,8 @@ object TypelevelCiPlugin extends AutoPlugin { scalas = List(scalaVersion.value), javas = List(githubWorkflowJavaVersions.value.head), steps = githubWorkflowJobSetup.value.toList :+ - WorkflowStep - .DependencySubmission - .withCond(Some("github.event_name != 'pull_request'")) + WorkflowStep.DependencySubmission, + cond = Some("github.event_name != 'pull_request'") )) else Nil From bae5df2683a941d26922a0d02f44a95ae92b6ea9 Mon Sep 17 00:00:00 2001 From: satorg Date: Sat, 16 Jul 2022 23:42:55 -0700 Subject: [PATCH 37/99] fix settings for Scala 2.12 unused warnings --- .../main/scala/org/typelevel/sbt/kernel/V.scala | 4 ++-- .../typelevel/sbt/TypelevelSettingsPlugin.scala | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala index 48ebc6f8..0108ae6d 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala @@ -43,8 +43,8 @@ private[sbt] final case class V( if (y != 0) return y (this.patch, that.patch) match { case (None, None) => 0 - case (None, Some(patch)) => 1 - case (Some(patch), None) => -1 + case (None, Some(_)) => 1 + case (Some(_), None) => -1 case (Some(thisPatch), Some(thatPatch)) => val z = thisPatch.compare(thatPatch) if (z != 0) return z diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index a3f884dc..eea42053 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -85,10 +85,17 @@ object TypelevelSettingsPlugin extends AutoPlugin { val warnings211 = Seq("-Ywarn-numeric-widen") // In 2.10 this produces a some strange spurious error - val warnings212 = Seq.empty[String] + val removed212 = Set( + "-Xlint" + ) + val warnings212 = Seq( + "-Xlint:_,-unused", + "-Ywarn-unused:_,-nowarn" // '-nowarn' because 2.13 can detect more unused cases than 2.12 + ) val removed213 = Set( - "-Xlint", + "-Xlint:_,-unused", + "-Ywarn-unused:_,-nowarn", // mostly superseded by "-Wunused" "-Ywarn-dead-code", // superseded by "-Wdead-code" "-Ywarn-numeric-widen" // superseded by "-Wnumeric-widen" ) @@ -108,10 +115,11 @@ object TypelevelSettingsPlugin extends AutoPlugin { warningsDotty case V(V(2, minor, _, _)) if minor >= 13 => - (warnings211 ++ warnings212 ++ warnings213 ++ warningsNsc).filterNot(removed213) + (warnings211 ++ warnings212 ++ warnings213 ++ warningsNsc) + .filterNot(removed212 ++ removed213) case V(V(2, minor, _, _)) if minor >= 12 => - warnings211 ++ warnings212 ++ warningsNsc + (warnings211 ++ warnings212 ++ warningsNsc).filterNot(removed212) case V(V(2, minor, _, _)) if minor >= 11 => warnings211 ++ warningsNsc From 348e3536f0aa45171d234977b038e08a72e8aee0 Mon Sep 17 00:00:00 2001 From: satorg Date: Sun, 17 Jul 2022 16:29:00 -0700 Subject: [PATCH 38/99] '-Ywarn-unused' add '-privates' --- .../sbt/TypelevelSettingsPlugin.scala | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index eea42053..05eacaab 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -80,22 +80,25 @@ object TypelevelSettingsPlugin extends AutoPlugin { } }, scalacOptions ++= { - val warningsNsc = Seq("-Xlint", "-Ywarn-dead-code") + val warningsNsc = Seq( + "-Xlint", + "-Ywarn-dead-code" + ) - val warnings211 = - Seq("-Ywarn-numeric-widen") // In 2.10 this produces a some strange spurious error + val warnings211 = Seq( + "-Ywarn-numeric-widen" // In 2.10 this produces a some strange spurious error + ) val removed212 = Set( "-Xlint" ) val warnings212 = Seq( - "-Xlint:_,-unused", - "-Ywarn-unused:_,-nowarn" // '-nowarn' because 2.13 can detect more unused cases than 2.12 + "-Xlint:_,-unused", // "unused" provided by '-Ywarn-unused' + "-Ywarn-unused:_,-nowarn,-privates" // '-nowarn' because 2.13 can detect more unused cases than 2.12 ) val removed213 = Set( - "-Xlint:_,-unused", - "-Ywarn-unused:_,-nowarn", // mostly superseded by "-Wunused" + "-Ywarn-unused:_,-nowarn,-privates", // mostly superseded by "-Wunused" "-Ywarn-dead-code", // superseded by "-Wdead-code" "-Ywarn-numeric-widen" // superseded by "-Wnumeric-widen" ) @@ -104,8 +107,7 @@ object TypelevelSettingsPlugin extends AutoPlugin { "-Wextra-implicit", "-Wnumeric-widen", "-Wunused", // all choices are enabled by default - "-Wvalue-discard", - "-Xlint:deprecation" + "-Wvalue-discard" ) val warningsDotty = Seq.empty From 388580951f112b088969afd51da0ab195ad594d5 Mon Sep 17 00:00:00 2001 From: satorg Date: Sun, 17 Jul 2022 17:58:28 -0700 Subject: [PATCH 39/99] remove '-Xlint:implicit-recursion' for 2.13 --- .../typelevel/sbt/TypelevelSettingsPlugin.scala | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 05eacaab..987e6172 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -93,11 +93,17 @@ object TypelevelSettingsPlugin extends AutoPlugin { "-Xlint" ) val warnings212 = Seq( - "-Xlint:_,-unused", // "unused" provided by '-Ywarn-unused' - "-Ywarn-unused:_,-nowarn,-privates" // '-nowarn' because 2.13 can detect more unused cases than 2.12 + // Tune '-Xlint': + // - remove 'unused' because it is configured by '-Ywarn-unused' + "-Xlint:_,-unused", + // Tune '-Ywarn-unused': + // - remove 'nowarn' because 2.13 can detect more unused cases than 2.12 + // - remove 'privates' because 2.12 can incorrectly detect some private objects as unused + "-Ywarn-unused:_,-nowarn,-privates" ) val removed213 = Set( + "-Xlint:_,-unused", // reconfigured for 2.13 "-Ywarn-unused:_,-nowarn,-privates", // mostly superseded by "-Wunused" "-Ywarn-dead-code", // superseded by "-Wdead-code" "-Ywarn-numeric-widen" // superseded by "-Wnumeric-widen" @@ -107,7 +113,11 @@ object TypelevelSettingsPlugin extends AutoPlugin { "-Wextra-implicit", "-Wnumeric-widen", "-Wunused", // all choices are enabled by default - "-Wvalue-discard" + "-Wvalue-discard", + // Tune '-Xlint': + // - remove 'unused' because it is configured by '-Wunused' + // - remove 'implicit-recursion' due to backward incompatibility with 2.12 + "-Xlint:_,-unused,-implicit-recursion" ) val warningsDotty = Seq.empty From 29a6280dfa44f54b8209d507fffd91225ead9931 Mon Sep 17 00:00:00 2001 From: satorg Date: Sun, 17 Jul 2022 22:05:27 -0700 Subject: [PATCH 40/99] remove '-Xlint:recurse-with-default' for 2.13 --- .../scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 987e6172..ff06ff4a 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -115,9 +115,10 @@ object TypelevelSettingsPlugin extends AutoPlugin { "-Wunused", // all choices are enabled by default "-Wvalue-discard", // Tune '-Xlint': - // - remove 'unused' because it is configured by '-Wunused' // - remove 'implicit-recursion' due to backward incompatibility with 2.12 - "-Xlint:_,-unused,-implicit-recursion" + // - remove 'recurse-with-default' due to backward incompatibility with 2.12 + // - remove 'unused' because it is configured by '-Wunused' + "-Xlint:_,-implicit-recursion,-recurse-with-default,-unused" ) val warningsDotty = Seq.empty From 719c4574b0ece2411416c33f31a57b1ed44ec4ae Mon Sep 17 00:00:00 2001 From: satorg Date: Mon, 18 Jul 2022 23:40:19 -0700 Subject: [PATCH 41/99] fix console scalacOptions --- .../sbt/TypelevelSettingsPlugin.scala | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index ff06ff4a..911bef0c 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -71,18 +71,12 @@ object TypelevelSettingsPlugin extends AutoPlugin { "UTF-8", // yes, this is 2 args "-feature", "-unchecked"), - scalacOptions ++= { - scalaVersion.value match { - case V(V(2, minor, _, _)) if minor < 13 => - Seq("-Yno-adapted-args", "-Ywarn-unused-import") - case _ => - Seq.empty - } - }, scalacOptions ++= { val warningsNsc = Seq( "-Xlint", - "-Ywarn-dead-code" + "-Yno-adapted-args", // similar to '-Xlint:adapted-args' but fails compilation instead of just emitting a warning + "-Ywarn-dead-code", + "-Ywarn-unused-import" ) val warnings211 = Seq( @@ -90,7 +84,9 @@ object TypelevelSettingsPlugin extends AutoPlugin { ) val removed212 = Set( - "-Xlint" + "-Xlint", + "-Yno-adapted-args", // mostly superseded by '-Xlint:adapted-args' + "-Ywarn-unused-import" // superseded by '-Ywarn-unused:imports' ) val warnings212 = Seq( // Tune '-Xlint': @@ -181,18 +177,15 @@ object TypelevelSettingsPlugin extends AutoPlugin { else Seq("-Yrangepos") }, - Compile / console / scalacOptions --= Seq( - "-Xlint", - "-Ywarn-unused-import", - "-Wextra-implicit", - "-Wunused:implicits", - "-Wunused:explicits", - "-Wunused:imports", - "-Wunused:locals", - "-Wunused:params", - "-Wunused:patvars", - "-Wunused:privates" - ), + Compile / console / scalacOptions := scalacOptions.value.filterNot { opt => + opt.startsWith("-Xlint") || + PartialFunction.cond(scalaVersion.value) { + case V(V(2, minor, _, _)) if minor >= 13 => + opt.startsWith("-Wunused") || opt == "-Wextra-implicit" + case V(V(2, minor, _, _)) if minor >= 12 => + opt.startsWith("-Ywarn-unused") + } + }, Test / console / scalacOptions := (Compile / console / scalacOptions).value, Compile / doc / scalacOptions ++= { Seq("-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath) From 0c729663c2872830366bb709d8054df3f9717383 Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 02:25:42 +0000 Subject: [PATCH 42/99] Update mdoc, sbt-mdoc to 2.3.3 --- site/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/build.sbt b/site/build.sbt index 64e5969e..6b08a8f9 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3") addSbtPlugin("org.planet42" % "laika-sbt" % "0.18.2") From b34b80c521ecd2d2b212dd636988c6ba324ea5e5 Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Tue, 16 Aug 2022 20:35:26 -0400 Subject: [PATCH 43/99] Add initial tests for mustBeBinCompatWith --- build.sbt | 3 +- .../org/typelevel/sbt/kernel/VSuite.scala | 75 +++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala diff --git a/build.sbt b/build.sbt index 4a53b8ee..c4e61643 100644 --- a/build.sbt +++ b/build.sbt @@ -54,7 +54,8 @@ lazy val kernel = project .in(file("kernel")) .enablePlugins(SbtPlugin) .settings( - name := "sbt-typelevel-kernel" + name := "sbt-typelevel-kernel", + libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test ) lazy val noPublish = project diff --git a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala new file mode 100644 index 00000000..39c898ad --- /dev/null +++ b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala @@ -0,0 +1,75 @@ +/* + * Copyright 2022 Typelevel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.typelevel.sbt.kernel + +import munit.FunSuite + +class VSuite extends FunSuite { + + test("current versions don't need bincompat with future versions") { + val currentV = V(1, 1, None, None) + val nextV = V(1, 2, None, None) + assertEquals(currentV.mustBeBinCompatWith(nextV), false) + } + + test("1.1 needs bincompat with 1.0") { + val currentV = V(1, 1, None, None) + val prevV = V(1, 0, None, None) + assertEquals(currentV.mustBeBinCompatWith(prevV), true) + } + + test("2.0 does not need bincompat with 1.9") { + val currentV = V(2, 0, None, None) + val prevV = V(1, 9, None, None) + assertEquals(currentV.mustBeBinCompatWith(prevV), false) + } + + test("1.1 needs bincompat with self") { + val currentV = V(1, 1, None, None) + assertEquals(currentV.mustBeBinCompatWith(currentV), true) + } + + test("1.1 does not need bincompat with old prerelease") { + val currentV = V(1, 1, None, None) + val prevV = V(1, 0, None, Some("M5")) + assertEquals(currentV.mustBeBinCompatWith(prevV), false) + } + + test("0.5 does not need bincompat with 0.4") { + val currentV = V(0, 5, None, None) + val prevV = V(0, 4, None, None) + assertEquals(currentV.mustBeBinCompatWith(prevV), false) + } + + test("0.5 needs bincompat with self") { + val currentV = V(0, 5, None, None) + assertEquals(currentV.mustBeBinCompatWith(currentV), true) + } + + test("0.5.1 does not need bincompat with 0.5 ???") { + val currentV = V(0, 5, Some(1), None) + val prevV = V(0, 5, None, None) + assertEquals(currentV.mustBeBinCompatWith(prevV), false) + } + + test("0.5.1 needs bincompat with 0.5.0") { + val currentV = V(0, 5, Some(1), None) + val prevV = V(0, 5, Some(0), None) + assertEquals(currentV.mustBeBinCompatWith(prevV), true) + } + +} From d5b95ced810ae632a66c67a1c6ca0218447d8fee Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Tue, 16 Aug 2022 21:02:04 -0400 Subject: [PATCH 44/99] Tweak and add more version tests --- .../org/typelevel/sbt/kernel/VSuite.scala | 71 +++++++++++++------ 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala index 39c898ad..a9409d0a 100644 --- a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala +++ b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala @@ -20,56 +20,83 @@ import munit.FunSuite class VSuite extends FunSuite { - test("current versions don't need bincompat with future versions") { + test("1.1 needs bincompat with 1.0") { val currentV = V(1, 1, None, None) - val nextV = V(1, 2, None, None) - assertEquals(currentV.mustBeBinCompatWith(nextV), false) + val prevV = V(1, 0, None, None) + assertEquals(currentV.mustBeBinCompatWith(prevV), true) } - test("1.1 needs bincompat with 1.0") { + test("1.1 does not need bincompat with 1.2") { val currentV = V(1, 1, None, None) - val prevV = V(1, 0, None, None) - assertEquals(currentV.mustBeBinCompatWith(prevV), true) + val nextV = V(1, 2, None, None) + assertEquals(currentV.mustBeBinCompatWith(nextV), false) } test("2.0 does not need bincompat with 1.9") { val currentV = V(2, 0, None, None) - val prevV = V(1, 9, None, None) + val prevV = V(1, 9, None, None) assertEquals(currentV.mustBeBinCompatWith(prevV), false) } - test("1.1 needs bincompat with self") { - val currentV = V(1, 1, None, None) - assertEquals(currentV.mustBeBinCompatWith(currentV), true) + test("1.1.1 needs bincompat with 1.1.0") { + val currentV = V(1, 1, Some(1), None) + val prevV = V(1, 1, Some(0), None) + assertEquals(currentV.mustBeBinCompatWith(prevV), true) } - test("1.1 does not need bincompat with old prerelease") { + test("1.1 does not need bincompat with 1.0-M5") { val currentV = V(1, 1, None, None) - val prevV = V(1, 0, None, Some("M5")) + val prevV = V(1, 0, None, Some("M5")) assertEquals(currentV.mustBeBinCompatWith(prevV), false) } test("0.5 does not need bincompat with 0.4") { val currentV = V(0, 5, None, None) - val prevV = V(0, 4, None, None) + val prevV = V(0, 4, None, None) assertEquals(currentV.mustBeBinCompatWith(prevV), false) } - test("0.5 needs bincompat with self") { - val currentV = V(0, 5, None, None) - assertEquals(currentV.mustBeBinCompatWith(currentV), true) - } - - test("0.5.1 does not need bincompat with 0.5 ???") { + test("0.5.1 needs bincompat with 0.5.0") { val currentV = V(0, 5, Some(1), None) - val prevV = V(0, 5, None, None) - assertEquals(currentV.mustBeBinCompatWith(prevV), false) + val prevV = V(0, 5, Some(0), None) + assertEquals(currentV.mustBeBinCompatWith(prevV), true) } test("0.5.1 needs bincompat with 0.5.0") { val currentV = V(0, 5, Some(1), None) - val prevV = V(0, 5, Some(0), None) + val prevV = V(0, 5, Some(0), None) + assertEquals(currentV.mustBeBinCompatWith(prevV), true) + } + + test("0.0.2 needs bincompat with 0.0.1") { + val currentV = V(0, 0, Some(1), None) + val prevV = V(0, 0, Some(0), None) assertEquals(currentV.mustBeBinCompatWith(prevV), true) } + test("x.y needs bincompat with self") { + val v0 = V(0, 5, None, None) + assertEquals(v0.mustBeBinCompatWith(v0), true) + val v1 = V(1, 5, None, None) + assertEquals(v1.mustBeBinCompatWith(v1), true) + } + + test("x.y.1 does not need bincompat with x.y") { + val currentV = V(1, 5, Some(1), None) + val prevV = V(1, 5, None, None) + assertEquals(currentV.mustBeBinCompatWith(prevV), false) + val currentV0 = V(0, 5, Some(1), None) + val prevV0 = V(0, 5, None, None) + assertEquals(currentV0.mustBeBinCompatWith(prevV0), false) + } + + test("x.y.1 < x.y") { + val patch0 = V(0, 5, Some(1), None) + val nopatch0 = V(0, 5, None, None) + assertEquals(patch0 < nopatch0, true) + val patch1 = V(1, 5, Some(1), None) + val nopatch1 = V(1, 5, None, None) + assertEquals(patch1 < nopatch1, true) + } + } From 7d93c49d032e5371729a10549135dfbf42796041 Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Tue, 16 Aug 2022 21:28:17 -0400 Subject: [PATCH 45/99] More version tests! --- .../org/typelevel/sbt/kernel/VSuite.scala | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala index a9409d0a..bcde087e 100644 --- a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala +++ b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala @@ -74,6 +74,35 @@ class VSuite extends FunSuite { assertEquals(currentV.mustBeBinCompatWith(prevV), true) } + test("all versions that are not prereleases need bincompat with self") { + val vs = List( + V(0, 0, None, None), + V(0, 0, Some(1), None), + V(0, 5, None, None), + V(0, 5, Some(1), None), + V(1, 0, None, None), + V(1, 0, Some(1), None), + V(1, 5, None, None), + V(1, 5, Some(1), None) + ) + vs.foreach(v => assert(v.mustBeBinCompatWith(v), s"$v did not need bincompat with itself")) + } + + // We current don't compare prereleases correctly + test("all versions that are prerelease need bincompat with self".fail) { + val vs = List( + V(0, 0, None, Some("M1")), + V(0, 0, Some(1), Some("M1")), + V(0, 5, None, Some("M1")), + V(0, 5, Some(1), Some("M1")), + V(1, 0, None, Some("M1")), + V(1, 0, Some(1), Some("M1")), + V(1, 5, None, Some("M1")), + V(1, 5, Some(1), Some("M1")) + ) + vs.foreach(v => assert(v.mustBeBinCompatWith(v), s"$v did not need bincompat with itself")) + } + test("x.y needs bincompat with self") { val v0 = V(0, 5, None, None) assertEquals(v0.mustBeBinCompatWith(v0), true) @@ -99,4 +128,22 @@ class VSuite extends FunSuite { assertEquals(patch1 < nopatch1, true) } + test("x.y.1 < x.y.2") { + val patch0 = V(0, 5, Some(1), None) + val p1patch0 = V(0, 5, Some(2), None) + assertEquals(patch0 < p1patch0, true) + val patch1 = V(1, 5, Some(1), None) + val p1patch1 = V(1, 5, Some(2), None) + assertEquals(patch1 < p1patch1, true) + } + + test("x.y.1-M1 < x.y.1") { + val pre0 = V(0, 5, Some(1), Some("M1")) + val nopre0 = V(0, 5, Some(2), None) + assertEquals(pre0 < nopre0, true) + val pre1 = V(1, 5, Some(1), Some("M1")) + val nopre1 = V(1, 5, Some(2), None) + assertEquals(pre1 < nopre1, true) + } + } From d95881868014b70232a1865c1850a2ade3e4eacc Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Tue, 16 Aug 2022 21:44:22 -0400 Subject: [PATCH 46/99] Add tests for apply, isPrerelease, isSameSeries --- .../org/typelevel/sbt/kernel/VSuite.scala | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala index bcde087e..e92921cc 100644 --- a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala +++ b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala @@ -20,6 +20,32 @@ import munit.FunSuite class VSuite extends FunSuite { + test("V.apply constructs V") { + assertEquals(V("0.0"), Some(V(0, 0, None, None))) + assertEquals(V("0.0-M1"), Some(V(0, 0, None, Some("M1")))) + assertEquals(V("0.0.0-M1"), Some(V(0, 0, Some(0), Some("M1")))) + assertEquals(V("10.0"), Some(V(10, 0, None, None))) + assertEquals(V("10.100"), Some(V(10, 100, None, None))) + assertEquals(V("10.100.1000"), Some(V(10, 100, Some(1000), None))) + } + + test("x.y.z-M1 is a prerelease") { + assert(V(0, 0, None, Some("M1")).isPrerelease) + assert(V(0, 0, Some(1), Some("M1")).isPrerelease) + assert(V(0, 1, None, Some("M1")).isPrerelease) + assert(V(0, 1, Some(1), Some("M1")).isPrerelease) + assert(V(1, 0, None, Some("M1")).isPrerelease) + assert(V(1, 0, Some(1), Some("M1")).isPrerelease) + assert(V(1, 1, None, Some("M1")).isPrerelease) + assert(V(1, 1, Some(1), Some("M1")).isPrerelease) + } + + test("x.y.2 is the same series as x.y.1") { + assert(V(0, 0, Some(1), None).isSameSeries(V(0, 0, Some(2), None))) + assert(V(0, 1, Some(1), None).isSameSeries(V(0, 1, Some(2), None))) + assert(V(1, 1, Some(1), None).isSameSeries(V(1, 1, Some(2), None))) + } + test("1.1 needs bincompat with 1.0") { val currentV = V(1, 1, None, None) val prevV = V(1, 0, None, None) From fc23628834984aaf3a0857a5f9a1f32b6ccec620 Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Wed, 17 Aug 2022 05:00:31 -0400 Subject: [PATCH 47/99] Move munit version into val --- build.sbt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c4e61643..1c5fc21f 100644 --- a/build.sbt +++ b/build.sbt @@ -29,6 +29,8 @@ ThisBuild / scalafixDependencies ++= Seq( "com.github.liancheng" %% "organize-imports" % "0.6.0" ) +val MunitVersion = "0.7.29" + lazy val `sbt-typelevel` = tlCrossRootProject.aggregate( kernel, noPublish, @@ -55,7 +57,7 @@ lazy val kernel = project .enablePlugins(SbtPlugin) .settings( name := "sbt-typelevel-kernel", - libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test + libraryDependencies += "org.scalameta" %% "munit" % MunitVersion % Test ) lazy val noPublish = project From 15ee9cf0e071f314180acdc24d45a056778ce771 Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Mon, 22 Aug 2022 08:06:13 -0400 Subject: [PATCH 48/99] Do not require binary compat on 0.0.z versions --- .../main/scala/org/typelevel/sbt/kernel/V.scala | 3 ++- .../scala/org/typelevel/sbt/kernel/VSuite.scala | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala index 0108ae6d..5d7d0217 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala @@ -34,7 +34,8 @@ private[sbt] final case class V( this.major == that.major && this.minor == that.minor def mustBeBinCompatWith(that: V): Boolean = - this >= that && !that.isPrerelease && this.major == that.major && (major > 0 || this.minor == that.minor) + this >= that && !that.isPrerelease && this.major == that.major && + (major > 0 || (this.minor == that.minor && minor > 0)) def compare(that: V): Int = { val x = this.major.compare(that.major) diff --git a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala index e92921cc..073a7379 100644 --- a/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala +++ b/kernel/src/test/scala/org/typelevel/sbt/kernel/VSuite.scala @@ -94,16 +94,14 @@ class VSuite extends FunSuite { assertEquals(currentV.mustBeBinCompatWith(prevV), true) } - test("0.0.2 needs bincompat with 0.0.1") { + test("0.0.2 does not need bincompat with 0.0.1") { val currentV = V(0, 0, Some(1), None) val prevV = V(0, 0, Some(0), None) - assertEquals(currentV.mustBeBinCompatWith(prevV), true) + assertEquals(currentV.mustBeBinCompatWith(prevV), false) } - test("all versions that are not prereleases need bincompat with self") { + test("all versions > 0.0 that are not prereleases need bincompat with self") { val vs = List( - V(0, 0, None, None), - V(0, 0, Some(1), None), V(0, 5, None, None), V(0, 5, Some(1), None), V(1, 0, None, None), @@ -114,6 +112,14 @@ class VSuite extends FunSuite { vs.foreach(v => assert(v.mustBeBinCompatWith(v), s"$v did not need bincompat with itself")) } + test("all versions < 0.0 need bincompat with self".fail) { + val vs = List( + V(0, 0, None, None), + V(0, 0, Some(1), None) + ) + vs.foreach(v => assert(v.mustBeBinCompatWith(v), s"$v did not need bincompat with itself")) + } + // We current don't compare prereleases correctly test("all versions that are prerelease need bincompat with self".fail) { val vs = List( From ba0c44c47864c95fdda95bfd141b91cf0b97ebb9 Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 16:42:28 +0000 Subject: [PATCH 49/99] Update snakeyaml to 1.32 --- github-actions/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/build.sbt b/github-actions/build.sbt index d2f41845..a8eb76b9 100644 --- a/github-actions/build.sbt +++ b/github-actions/build.sbt @@ -1 +1 @@ -libraryDependencies += "org.yaml" % "snakeyaml" % "1.30" +libraryDependencies += "org.yaml" % "snakeyaml" % "1.32" From 1f1cbd413413c4f563894fd0463721aff5256d2a Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 15 Sep 2022 17:06:57 +0100 Subject: [PATCH 50/99] site - update to Laika 0.19 + fix compiler errors + warnings --- site/build.sbt | 2 +- .../scala/org/typelevel/sbt/TypelevelSitePlugin.scala | 8 +++++--- .../scala/org/typelevel/sbt/site/ThemeProviderOps.scala | 4 ++-- .../typelevel/sbt/site/TypelevelHeliumExtensions.scala | 9 ++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/site/build.sbt b/site/build.sbt index 6b08a8f9..3867c344 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3") -addSbtPlugin("org.planet42" % "laika-sbt" % "0.18.2") +addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0-M1") diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index c2220ed0..9a76d909 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -23,6 +23,7 @@ import laika.helium.config.Favicon import laika.helium.config.HeliumIcon import laika.helium.config.IconLink import laika.helium.config.ImageLink +import laika.io.model.FilePath import laika.sbt.LaikaPlugin import laika.theme.ThemeProvider import mdoc.MdocPlugin @@ -276,14 +277,15 @@ object TypelevelSitePlugin extends AutoPlugin { val applyFlags = applyIf(laikaIncludeEPUB.value, _.withEPUBDownloads) .andThen(applyIf(laikaIncludePDF.value, _.withPDFDownloads)) - .andThen( - applyIf(laikaIncludeAPI.value, _.withAPIDirectory(Settings.apiTargetDirectory.value))) + .andThen(applyIf( + laikaIncludeAPI.value, + _.withAPIDirectory(FilePath.fromJavaFile(Settings.apiTargetDirectory.value)))) .andThen(applyIf(previewConfig.isVerbose, _.verbose)) val config = ServerConfig .defaults .withArtifactBasename(name.value) - // .withHost(previewConfig.host) + .withHost(previewConfig.host) .withPort(previewConfig.port) .withPollInterval(previewConfig.pollInterval) diff --git a/site/src/main/scala/org/typelevel/sbt/site/ThemeProviderOps.scala b/site/src/main/scala/org/typelevel/sbt/site/ThemeProviderOps.scala index 6d3750d6..e3501f3c 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/ThemeProviderOps.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/ThemeProviderOps.scala @@ -16,7 +16,7 @@ package org.typelevel.sbt.site -import cats.effect.Sync +import cats.effect.Async import laika.bundle.ExtensionBundle import laika.factory.Format import laika.io.model.InputTree @@ -26,7 +26,7 @@ import laika.theme.ThemeProvider final class LaikaThemeProviderOps private[sbt] (provider: ThemeProvider) { def extend(extensions: ThemeProvider): ThemeProvider = new ThemeProvider { - def build[F[_]: Sync] = for { + def build[F[_]: Async] = for { base <- provider.build ext <- extensions.build } yield { diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 2e5d468f..1ab32e92 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -16,8 +16,7 @@ package org.typelevel.sbt.site -import cats.effect.Resource -import cats.effect.Sync +import cats.effect.{Async, Resource} import laika.ast.Path import laika.config.Config import laika.io.model.InputTree @@ -60,15 +59,15 @@ object TypelevelHeliumExtensions { scala3: Boolean, apiUrl: Option[URL] ): ThemeProvider = new ThemeProvider { - def build[F[_]](implicit F: Sync[F]): Resource[F, Theme[F]] = + def build[F[_]](implicit F: Async[F]): Resource[F, Theme[F]] = ThemeBuilder[F]("Typelevel Helium Extensions") .addInputs( InputTree[F] - .addStream( + .addInputStream( F.blocking(getClass.getResourceAsStream("helium/default.template.html")), DefaultTemplatePath.forHTML ) - .addStream( + .addInputStream( F.blocking(getClass.getResourceAsStream("helium/site/styles.css")), Path.Root / "site" / "styles.css" ) From 029564276ef66c7212d0fda5db615198d1bcf0bc Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 15 Sep 2022 17:35:11 +0100 Subject: [PATCH 51/99] site - use new buildPreviewServer task instead of copied code --- .../typelevel/sbt/TypelevelSitePlugin.scala | 39 ++----------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index 9a76d909..6f95728b 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -23,8 +23,7 @@ import laika.helium.config.Favicon import laika.helium.config.HeliumIcon import laika.helium.config.IconLink import laika.helium.config.ImageLink -import laika.io.model.FilePath -import laika.sbt.LaikaPlugin +import laika.sbt.{LaikaPlugin, Tasks} import laika.theme.ThemeProvider import mdoc.MdocPlugin import org.typelevel.sbt.site._ @@ -257,46 +256,14 @@ object TypelevelSitePlugin extends AutoPlugin { private def previewTask = Def .taskDyn { - // inlined from https://github.com/planet42/Laika/blob/9022f6f37c9017f7612fa59398f246c8e8c42c3e/sbt/src/main/scala/laika/sbt/Tasks.scala#L192 - import cats.effect.IO import cats.effect.unsafe.implicits._ - import laika.sbt.Settings - import laika.sbt.Tasks.generateAPI - import laika.preview.{ServerBuilder, ServerConfig} val logger = streams.value.log logger.info("Initializing server...") - def applyIf( - flag: Boolean, - f: ServerConfig => ServerConfig): ServerConfig => ServerConfig = - if (flag) f else identity + val (_, cancel) = Tasks.buildPreviewServer.value.allocated.unsafeRunSync() - val previewConfig = laikaPreviewConfig.value - val _ = generateAPI.value - - val applyFlags = applyIf(laikaIncludeEPUB.value, _.withEPUBDownloads) - .andThen(applyIf(laikaIncludePDF.value, _.withPDFDownloads)) - .andThen(applyIf( - laikaIncludeAPI.value, - _.withAPIDirectory(FilePath.fromJavaFile(Settings.apiTargetDirectory.value)))) - .andThen(applyIf(previewConfig.isVerbose, _.verbose)) - - val config = ServerConfig - .defaults - .withArtifactBasename(name.value) - .withHost(previewConfig.host) - .withPort(previewConfig.port) - .withPollInterval(previewConfig.pollInterval) - - val (_, cancel) = ServerBuilder[IO](Settings.parser.value, laikaInputs.value.delegate) - .withLogger(s => IO(logger.info(s))) - .withConfig(applyFlags(config)) - .build - .allocated - .unsafeRunSync() - - logger.info(s"Preview server started on port ${previewConfig.port}.") + logger.info(s"Preview server started on port ${laikaPreviewConfig.value.port}.") // watch but no-livereload b/c we don't need an mdoc server mdoc.toTask(" --watch --no-livereload").andFinally { From a9a7794959702a389bb2ed4a60d972ca60b57581 Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 15 Sep 2022 18:55:02 +0100 Subject: [PATCH 52/99] site - use new ThemeProvider.extendWith and remove old implementation --- .../typelevel/sbt/TypelevelSitePlugin.scala | 4 +- .../typelevel/sbt/site/ThemeProviderOps.scala | 53 ------------------- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 site/src/main/scala/org/typelevel/sbt/site/ThemeProviderOps.scala diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index 6f95728b..dbb3c2e0 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -68,8 +68,6 @@ object TypelevelSitePlugin extends AutoPlugin { "Start a live-reload preview server (combines mdoc --watch with laikaPreview)") val TypelevelProject = site.TypelevelProject - implicit def tlLaikaThemeProviderOps(provider: ThemeProvider): LaikaThemeProviderOps = - new site.LaikaThemeProviderOps(provider) } import autoImport._ @@ -106,7 +104,7 @@ object TypelevelSitePlugin extends AutoPlugin { .value: @nowarn("cat=other-pure-statement"), tlSitePreview := previewTask.value, Laika / sourceDirectories := Seq(mdocOut.value), - laikaTheme := tlSiteHeliumConfig.value.build.extend(tlSiteHeliumExtensions.value), + laikaTheme := tlSiteHeliumConfig.value.build.extendWith(tlSiteHeliumExtensions.value), mdocVariables := { mdocVariables.value ++ Map( diff --git a/site/src/main/scala/org/typelevel/sbt/site/ThemeProviderOps.scala b/site/src/main/scala/org/typelevel/sbt/site/ThemeProviderOps.scala deleted file mode 100644 index e3501f3c..00000000 --- a/site/src/main/scala/org/typelevel/sbt/site/ThemeProviderOps.scala +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2022 Typelevel - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.typelevel.sbt.site - -import cats.effect.Async -import laika.bundle.ExtensionBundle -import laika.factory.Format -import laika.io.model.InputTree -import laika.theme.Theme -import laika.theme.ThemeProvider - -final class LaikaThemeProviderOps private[sbt] (provider: ThemeProvider) { - - def extend(extensions: ThemeProvider): ThemeProvider = new ThemeProvider { - def build[F[_]: Async] = for { - base <- provider.build - ext <- extensions.build - } yield { - def overrideInputs(base: InputTree[F], overrides: InputTree[F]): InputTree[F] = { - val overridePaths = overrides.allPaths.toSet - val filteredBaseInputs = InputTree( - textInputs = base.textInputs.filterNot(in => overridePaths.contains(in.path)), - binaryInputs = base.binaryInputs.filterNot(in => overridePaths.contains(in.path)), - parsedResults = base.parsedResults.filterNot(in => overridePaths.contains(in.path)), - sourcePaths = base.sourcePaths - ) - overrides ++ filteredBaseInputs - } - - new Theme[F] { - override def inputs: InputTree[F] = overrideInputs(base.inputs, ext.inputs) - override def extensions: Seq[ExtensionBundle] = base.extensions ++ ext.extensions - override def treeProcessor: Format => Theme.TreeProcessor[F] = fmt => - base.treeProcessor(fmt).andThen(ext.treeProcessor(fmt)) - } - } - } - -} From 29675145415191d9fe4565d9b282b9d251745f56 Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 15 Sep 2022 21:42:25 +0100 Subject: [PATCH 53/99] site - use new Helium footer config to avoid custom templates --- .../org/typelevel/sbt/TypelevelSitePlugin.scala | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index dbb3c2e0..b862566e 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -144,11 +144,20 @@ object TypelevelSitePlugin extends AutoPlugin { tlSiteApiUrl.value.orElse(javadocioUrl).orElse(fallbackUrl) }, tlSiteHeliumConfig := { + val title = gitHubUserRepo.value.map(_._2) + val footerSpans = title.fold(Seq[Span]()) { title => + val licensePhrase = licenses.value.headOption.fold("") { + case (url, name) => s""" distributed under the $name license""" + } + Seq(TemplateString( + s"""$title is a Typelevel project$licensePhrase.""" + )) + } Helium .defaults .site .metadata( - title = gitHubUserRepo.value.map(_._2), + title = title, authors = developers.value.map(_.name), language = Some("en"), version = Some(version.value.toString) @@ -170,6 +179,8 @@ object TypelevelSitePlugin extends AutoPlugin { Favicon.external("https://typelevel.org/img/favicon.png", "32x32", "image/png") ) .site + .footer(footerSpans: _*) + .site .topNavigationBar( homeLink = ImageLink.external( "https://typelevel.org", From 89b989d3e20fc11edb641f1909d94bca1729133c Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 15 Sep 2022 22:01:12 +0100 Subject: [PATCH 54/99] site - use new Helium main nav config f. related projects --- .../typelevel/sbt/TypelevelSitePlugin.scala | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index b862566e..86feb94e 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -16,28 +16,33 @@ package org.typelevel.sbt -import laika.ast.LengthUnit._ -import laika.ast._ +import laika.ast.LengthUnit.* +import laika.ast.* import laika.helium.Helium -import laika.helium.config.Favicon -import laika.helium.config.HeliumIcon -import laika.helium.config.IconLink -import laika.helium.config.ImageLink +import laika.helium.config.{ + Favicon, + HeliumIcon, + IconLink, + ImageLink, + TextLink, + ThemeNavigationSection +} import laika.sbt.{LaikaPlugin, Tasks} import laika.theme.ThemeProvider import mdoc.MdocPlugin -import org.typelevel.sbt.site._ -import sbt._ +import org.typelevel.sbt.site.* +import sbt.* import scala.annotation.nowarn - -import Keys._ -import MdocPlugin.autoImport._ -import LaikaPlugin.autoImport._ +import Keys.* +import MdocPlugin.autoImport.* +import LaikaPlugin.autoImport.* import gha.GenerativePlugin -import GenerativePlugin.autoImport._ -import TypelevelKernelPlugin._ -import TypelevelKernelPlugin.autoImport._ +import GenerativePlugin.autoImport.* +import TypelevelKernelPlugin.* +import TypelevelKernelPlugin.autoImport.* +import cats.data.NonEmptyList +import cats.syntax.all.* object TypelevelSitePlugin extends AutoPlugin { @@ -153,6 +158,12 @@ object TypelevelSitePlugin extends AutoPlugin { s"""$title is a Typelevel project$licensePhrase.""" )) } + val relatedProjects = + NonEmptyList.fromList(tlSiteRelatedProjects.value.toList).toList.map { projects => + ThemeNavigationSection( + "Related Projects", + projects.map { case (name, url) => TextLink.external(url.toString, name) }) + } Helium .defaults .site @@ -181,6 +192,8 @@ object TypelevelSitePlugin extends AutoPlugin { .site .footer(footerSpans: _*) .site + .mainNavigation(appendLinks = relatedProjects) + .site .topNavigationBar( homeLink = ImageLink.external( "https://typelevel.org", From ccb8b858c5563a30cc9c1addfeb19d3c5749cc7c Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 15 Sep 2022 22:11:45 +0100 Subject: [PATCH 55/99] site - remove custom Helium template --- .../sbt/site/helium/default.template.html | 106 ------------------ .../typelevel/sbt/TypelevelSitePlugin.scala | 3 - .../sbt/site/TypelevelHeliumExtensions.scala | 46 ++------ 3 files changed, 10 insertions(+), 145 deletions(-) delete mode 100644 site/src/main/resources/org/typelevel/sbt/site/helium/default.template.html diff --git a/site/src/main/resources/org/typelevel/sbt/site/helium/default.template.html b/site/src/main/resources/org/typelevel/sbt/site/helium/default.template.html deleted file mode 100644 index 2335d4c9..00000000 --- a/site/src/main/resources/org/typelevel/sbt/site/helium/default.template.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - ${cursor.currentDocument.title} - @:for(laika.site.metadata.authors) - - @:@ - @:for(laika.site.metadata.description) - - @:@ - @:for(helium.favIcons) - - @:@ - @:for(helium.webFonts) - - @:@ - @:linkCSS { paths = ${helium.site.includeCSS} } - @:linkJS { paths = ${helium.site.includeJS} } - @:heliumInitVersions - @:heliumInitPreview(container) - - - - - -
- - - - ${?helium.topBar.home} - - ${?helium.topBar.links} - -
- - - -
- - - -
- - ${cursor.currentDocument.content} - -
- - -
- -
- - - diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index 86feb94e..76c29e91 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -42,7 +42,6 @@ import GenerativePlugin.autoImport.* import TypelevelKernelPlugin.* import TypelevelKernelPlugin.autoImport.* import cats.data.NonEmptyList -import cats.syntax.all.* object TypelevelSitePlugin extends AutoPlugin { @@ -120,8 +119,6 @@ object TypelevelSitePlugin extends AutoPlugin { tlSiteApiUrl.value.map("API_URL" -> _.toString).toMap }, tlSiteHeliumExtensions := TypelevelHeliumExtensions( - licenses.value.headOption, - tlSiteRelatedProjects.value, tlIsScala3.value, tlSiteApiUrl.value ), diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 1ab32e92..833e01b0 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -18,12 +18,10 @@ package org.typelevel.sbt.site import cats.effect.{Async, Resource} import laika.ast.Path -import laika.config.Config import laika.io.model.InputTree import laika.markdown.github.GitHubFlavor import laika.parse.code.SyntaxHighlighting import laika.parse.code.languages.DottySyntax -import laika.rewrite.DefaultTemplatePath import laika.theme.Theme import laika.theme.ThemeBuilder import laika.theme.ThemeProvider @@ -32,30 +30,32 @@ import java.net.URL object TypelevelHeliumExtensions { - @deprecated("Use overload with API url and scala3 parameter", "0.4.7") + @deprecated("Use overload with scala3 and apiURL parameter", "0.4.7") def apply(license: Option[(String, URL)], related: Seq[(String, URL)]): ThemeProvider = apply(license, related, false) - @deprecated("Use overload with API url and scala3 parameter", "0.4.13") + @deprecated("Use overload with scala3 and apiURL parameter", "0.4.13") def apply( license: Option[(String, URL)], related: Seq[(String, URL)], scala3: Boolean): ThemeProvider = apply(license, related, false, None) + @deprecated("Use overload with scala3 and apiURL parameter", "0.5.0") + def apply( + license: Option[(String, URL)], + related: Seq[(String, URL)], + scala3: Boolean, + apiUrl: Option[URL] + ): ThemeProvider = apply(scala3, apiUrl) + /** - * @param license - * name and [[java.net.URL]] of project license - * @param related - * name and [[java.net.URL]] of related projects * @param scala3 * whether to use Scala 3 syntax highlighting * @param apiUrl * url to API docs */ def apply( - license: Option[(String, URL)], - related: Seq[(String, URL)], scala3: Boolean, apiUrl: Option[URL] ): ThemeProvider = new ThemeProvider { @@ -63,10 +63,6 @@ object TypelevelHeliumExtensions { ThemeBuilder[F]("Typelevel Helium Extensions") .addInputs( InputTree[F] - .addInputStream( - F.blocking(getClass.getResourceAsStream("helium/default.template.html")), - DefaultTemplatePath.forHTML - ) .addInputStream( F.blocking(getClass.getResourceAsStream("helium/site/styles.css")), Path.Root / "site" / "styles.css" @@ -82,31 +78,9 @@ object TypelevelHeliumExtensions { if (scala3) SyntaxHighlighting.withSyntaxBinding("scala", DottySyntax) else SyntaxHighlighting ) - .addBaseConfig(licenseConfig(license).withFallback(relatedConfig(related))) .build } - private def licenseConfig(license: Option[(String, URL)]) = - license.fold(Config.empty) { - case (name, url) => - Config - .empty - .withValue("typelevel.site.license.name", name) - .withValue("typelevel.site.license.url", url.toString) - .build - } - - private def relatedConfig(related: Seq[(String, URL)]) = - Config - .empty - .withValue( - "typelevel.site.related", - related.map { - case (name, url) => - Map("name" -> name, "url" -> url.toString) - }) - .build - private def htmlForwarder(to: URL) = s"""| | From 83b2904dd08c891165e81e3b78b12a1b3a2a4d6f Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 15 Sep 2022 22:15:19 +0100 Subject: [PATCH 56/99] site - remove obsolete svg-link CSS class --- .../scala/org/typelevel/sbt/TypelevelSitePlugin.scala | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index 76c29e91..c8034228 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -197,16 +197,11 @@ object TypelevelSitePlugin extends AutoPlugin { Image.external(s"https://typelevel.org/img/logo.svg") ), navLinks = tlSiteApiUrl.value.toList.map { url => - IconLink.external( - url.toString, - HeliumIcon.api, - options = Styles("svg-link") - ) + IconLink.external(url.toString, HeliumIcon.api) } ++ List( IconLink.external( scmInfo.value.fold("https://github.com/typelevel")(_.browseUrl.toString), - HeliumIcon.github, - options = Styles("svg-link")), + HeliumIcon.github), IconLink.external("https://discord.gg/XF3CXcMzqD", HeliumIcon.chat), IconLink.external("https://twitter.com/typelevel", HeliumIcon.twitter) ) From cb8ee4acf011ee34607b07c9b024543e64254c3b Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Fri, 16 Sep 2022 22:45:01 +0100 Subject: [PATCH 57/99] site - remove custom CSS --- .../org/typelevel/sbt/site/helium/site/styles.css | 5 ----- .../sbt/site/TypelevelHeliumExtensions.scala | 13 +++---------- 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 site/src/main/resources/org/typelevel/sbt/site/helium/site/styles.css diff --git a/site/src/main/resources/org/typelevel/sbt/site/helium/site/styles.css b/site/src/main/resources/org/typelevel/sbt/site/helium/site/styles.css deleted file mode 100644 index 8d9ff940..00000000 --- a/site/src/main/resources/org/typelevel/sbt/site/helium/site/styles.css +++ /dev/null @@ -1,5 +0,0 @@ -header img { - height: 40px; - width: auto; - margin-top: 6px; -} diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 833e01b0..30e35666 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -62,16 +62,9 @@ object TypelevelHeliumExtensions { def build[F[_]](implicit F: Async[F]): Resource[F, Theme[F]] = ThemeBuilder[F]("Typelevel Helium Extensions") .addInputs( - InputTree[F] - .addInputStream( - F.blocking(getClass.getResourceAsStream("helium/site/styles.css")), - Path.Root / "site" / "styles.css" - ) - .merge( - apiUrl.fold(InputTree[F]) { url => - InputTree[F].addString(htmlForwarder(url), Path.Root / "api" / "index.html") - } - ) + apiUrl.fold(InputTree[F]) { url => + InputTree[F].addString(htmlForwarder(url), Path.Root / "api" / "index.html") + } ) .addExtensions( GitHubFlavor, From 8579a4e37397308dceb7edda8f92c428f5e85626 Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Fri, 16 Sep 2022 22:57:46 +0100 Subject: [PATCH 58/99] site - don't repeat config values using defaults --- site/build.sbt | 2 +- .../main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/site/build.sbt b/site/build.sbt index 3867c344..ef55c0a2 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3") -addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0-M1") +addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0-M2") diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index c8034228..06ba1351 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -172,12 +172,7 @@ object TypelevelSitePlugin extends AutoPlugin { ) .site .layout( - contentWidth = px(860), - navigationWidth = px(275), - topBarHeight = px(50), - defaultBlockSpacing = px(10), - defaultLineHeight = 1.5, - anchorPlacement = laika.helium.config.AnchorPlacement.Right + topBarHeight = px(50) ) .site .darkMode From 42a1a43bea992253732e22eaea677fd48ec7d9fb Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Sat, 17 Sep 2022 02:19:29 +0100 Subject: [PATCH 59/99] site - separate default settings for typelevel projects --- site/build.sbt | 2 +- .../typelevel/sbt/TypelevelSitePlugin.scala | 123 +++++------------- .../sbt/site/GenericSiteSettings.scala | 86 ++++++++++++ .../sbt/site/TypelevelHeliumExtensions.scala | 6 +- .../sbt/site/TypelevelSiteSettings.scala | 80 ++++++++++++ 5 files changed, 206 insertions(+), 91 deletions(-) create mode 100644 site/src/main/scala/org/typelevel/sbt/site/GenericSiteSettings.scala create mode 100644 site/src/main/scala/org/typelevel/sbt/site/TypelevelSiteSettings.scala diff --git a/site/build.sbt b/site/build.sbt index ef55c0a2..30efc1f0 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3") -addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0-M2") +addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0-M10") diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index 06ba1351..6af8f391 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -16,46 +16,45 @@ package org.typelevel.sbt -import laika.ast.LengthUnit.* -import laika.ast.* import laika.helium.Helium -import laika.helium.config.{ - Favicon, - HeliumIcon, - IconLink, - ImageLink, - TextLink, - ThemeNavigationSection -} -import laika.sbt.{LaikaPlugin, Tasks} +import laika.sbt.LaikaPlugin +import laika.sbt.LaikaPlugin.autoImport.* +import laika.sbt.Tasks import laika.theme.ThemeProvider import mdoc.MdocPlugin +import mdoc.MdocPlugin.autoImport.* +import org.typelevel.sbt.TypelevelKernelPlugin.* +import org.typelevel.sbt.gha.GenerativePlugin +import org.typelevel.sbt.gha.GenerativePlugin.autoImport.* import org.typelevel.sbt.site.* +import sbt.Keys.* import sbt.* import scala.annotation.nowarn -import Keys.* -import MdocPlugin.autoImport.* -import LaikaPlugin.autoImport.* -import gha.GenerativePlugin -import GenerativePlugin.autoImport.* -import TypelevelKernelPlugin.* -import TypelevelKernelPlugin.autoImport.* -import cats.data.NonEmptyList object TypelevelSitePlugin extends AutoPlugin { object autoImport { + + @deprecated("Use tlSiteHelium", "0.5.0") lazy val tlSiteHeliumConfig = settingKey[Helium]("The Typelevel Helium configuration") + @deprecated("Use tlSiteHelium", "0.5.0") lazy val tlSiteHeliumExtensions = settingKey[ThemeProvider]("The Typelevel Helium extensions") + @deprecated("Use .site.mainNavigation(appendLinks = ...) in tlSiteHelium", "0.5.0") + lazy val tlSiteRelatedProjects = + settingKey[Seq[(String, URL)]]("A list of related projects (default: empty)") + + lazy val tlSiteHelium = settingKey[Helium]("The Helium theme configuration and extensions") + lazy val tlSiteIsTypelevelProject = + settingKey[Boolean]( + "Indicates whether the generated site should be pre-populated with UI elements specific to Typelevel projects (default: false)") + lazy val tlSiteApiUrl = settingKey[Option[URL]]("URL to the API docs") lazy val tlSiteApiModule = settingKey[Option[ModuleID]]("The module that publishes API docs") lazy val tlSiteApiPackage = settingKey[Option[String]]( "The top-level package for your API docs (e.g. org.typlevel.sbt)") - lazy val tlSiteRelatedProjects = - settingKey[Seq[(String, URL)]]("A list of related projects (default: cats)") lazy val tlSiteKeepFiles = settingKey[Boolean]("Whether to keep existing files when deploying site (default: true)") @@ -74,8 +73,8 @@ object TypelevelSitePlugin extends AutoPlugin { val TypelevelProject = site.TypelevelProject } - import autoImport._ - import TypelevelGitHubPlugin._ + import autoImport.* + import TypelevelGitHubPlugin.* override def requires = MdocPlugin && LaikaPlugin && TypelevelGitHubPlugin && GenerativePlugin && NoPublishPlugin @@ -84,12 +83,13 @@ object TypelevelSitePlugin extends AutoPlugin { tlSiteApiModule := None ) + @nowarn("cat=deprecation") override def buildSettings = Seq( tlSitePublishBranch := Some("main"), tlSitePublishTags := tlSitePublishBranch.value.isEmpty, tlSiteApiUrl := None, tlSiteApiPackage := None, - tlSiteRelatedProjects := Seq(TypelevelProject.Cats), + tlSiteRelatedProjects := Nil, tlSiteKeepFiles := true, homepage := { gitHubUserRepo.value.map { @@ -99,6 +99,7 @@ object TypelevelSitePlugin extends AutoPlugin { } ) + @nowarn("cat=deprecation") override def projectSettings = Seq( tlSite := Def .sequential( @@ -108,7 +109,7 @@ object TypelevelSitePlugin extends AutoPlugin { .value: @nowarn("cat=other-pure-statement"), tlSitePreview := previewTask.value, Laika / sourceDirectories := Seq(mdocOut.value), - laikaTheme := tlSiteHeliumConfig.value.build.extendWith(tlSiteHeliumExtensions.value), + laikaTheme := tlSiteHelium.value.build, mdocVariables := { mdocVariables.value ++ Map( @@ -118,10 +119,13 @@ object TypelevelSitePlugin extends AutoPlugin { ) ++ tlSiteApiUrl.value.map("API_URL" -> _.toString).toMap }, - tlSiteHeliumExtensions := TypelevelHeliumExtensions( - tlIsScala3.value, - tlSiteApiUrl.value - ), + tlSiteIsTypelevelProject := false, + tlSiteHeliumConfig := TypelevelSiteSettings.defaults.value, + tlSiteHeliumExtensions := GenericSiteSettings.themeExtensions.value, + tlSiteHelium := { + if (tlSiteIsTypelevelProject.value) tlSiteHeliumConfig.value + else GenericSiteSettings.defaults.value + }, tlSiteApiUrl := { val javadocioUrl = for { moduleId <- (ThisProject / tlSiteApiModule).value @@ -145,63 +149,6 @@ object TypelevelSitePlugin extends AutoPlugin { tlSiteApiUrl.value.orElse(javadocioUrl).orElse(fallbackUrl) }, - tlSiteHeliumConfig := { - val title = gitHubUserRepo.value.map(_._2) - val footerSpans = title.fold(Seq[Span]()) { title => - val licensePhrase = licenses.value.headOption.fold("") { - case (url, name) => s""" distributed under the $name license""" - } - Seq(TemplateString( - s"""$title is a Typelevel project$licensePhrase.""" - )) - } - val relatedProjects = - NonEmptyList.fromList(tlSiteRelatedProjects.value.toList).toList.map { projects => - ThemeNavigationSection( - "Related Projects", - projects.map { case (name, url) => TextLink.external(url.toString, name) }) - } - Helium - .defaults - .site - .metadata( - title = title, - authors = developers.value.map(_.name), - language = Some("en"), - version = Some(version.value.toString) - ) - .site - .layout( - topBarHeight = px(50) - ) - .site - .darkMode - .disabled - .site - .favIcons( - Favicon.external("https://typelevel.org/img/favicon.png", "32x32", "image/png") - ) - .site - .footer(footerSpans: _*) - .site - .mainNavigation(appendLinks = relatedProjects) - .site - .topNavigationBar( - homeLink = ImageLink.external( - "https://typelevel.org", - Image.external(s"https://typelevel.org/img/logo.svg") - ), - navLinks = tlSiteApiUrl.value.toList.map { url => - IconLink.external(url.toString, HeliumIcon.api) - } ++ List( - IconLink.external( - scmInfo.value.fold("https://github.com/typelevel")(_.browseUrl.toString), - HeliumIcon.github), - IconLink.external("https://discord.gg/XF3CXcMzqD", HeliumIcon.chat), - IconLink.external("https://twitter.com/typelevel", HeliumIcon.twitter) - ) - ) - }, tlSiteGenerate := List( WorkflowStep.Sbt( List(s"${thisProject.value.id}/${tlSite.key.toString}"), @@ -265,7 +212,7 @@ object TypelevelSitePlugin extends AutoPlugin { private def previewTask = Def .taskDyn { - import cats.effect.unsafe.implicits._ + import cats.effect.unsafe.implicits.* val logger = streams.value.log logger.info("Initializing server...") @@ -276,7 +223,7 @@ object TypelevelSitePlugin extends AutoPlugin { // watch but no-livereload b/c we don't need an mdoc server mdoc.toTask(" --watch --no-livereload").andFinally { - logger.info(s"Shutting down preview server.") + logger.info(s"Shutting down preview server...") cancel.unsafeRunSync() } } diff --git a/site/src/main/scala/org/typelevel/sbt/site/GenericSiteSettings.scala b/site/src/main/scala/org/typelevel/sbt/site/GenericSiteSettings.scala new file mode 100644 index 00000000..9fc1f30c --- /dev/null +++ b/site/src/main/scala/org/typelevel/sbt/site/GenericSiteSettings.scala @@ -0,0 +1,86 @@ +/* + * Copyright 2022 Typelevel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.typelevel.sbt.site + +import cats.data.NonEmptyList +import laika.helium.Helium +import laika.helium.config.HeliumIcon +import laika.helium.config.IconLink +import laika.helium.config.TextLink +import laika.helium.config.ThemeNavigationSection +import laika.theme.ThemeProvider +import org.typelevel.sbt.TypelevelGitHubPlugin.gitHubUserRepo +import org.typelevel.sbt.TypelevelKernelPlugin.autoImport.tlIsScala3 +import org.typelevel.sbt.TypelevelSitePlugin.autoImport.tlSiteApiUrl +import org.typelevel.sbt.TypelevelSitePlugin.autoImport.tlSiteHeliumExtensions +import org.typelevel.sbt.TypelevelSitePlugin.autoImport.tlSiteRelatedProjects +import sbt.Def.* +import sbt.Keys.developers +import sbt.Keys.scmInfo +import sbt.Keys.version + +import scala.annotation.nowarn + +object GenericSiteSettings { + + val apiLink: Initialize[Option[IconLink]] = setting { + tlSiteApiUrl.value.map { url => IconLink.external(url.toString, HeliumIcon.api) } + } + + val githubLink: Initialize[Option[IconLink]] = setting { + scmInfo.value.map { info => IconLink.external(info.browseUrl.toString, HeliumIcon.github) } + } + + @nowarn("cat=deprecation") + val themeExtensions: Initialize[ThemeProvider] = setting { + // TODO - inline when deprecated class gets removed + TypelevelHeliumExtensions( + tlIsScala3.value, + tlSiteApiUrl.value + ) + } + + @nowarn("cat=deprecation") + private val legacyRelatedProjects: Initialize[Option[ThemeNavigationSection]] = setting { + NonEmptyList.fromList(tlSiteRelatedProjects.value.toList).map { projects => + ThemeNavigationSection( + "Related Projects", + projects.map { case (name, url) => TextLink.external(url.toString, name) }) + } + } + + @nowarn("cat=deprecation") + val defaults: Initialize[Helium] = setting { + Helium + .defaults + .extendWith(tlSiteHeliumExtensions.value) + .site + .metadata( + title = gitHubUserRepo.value.map(_._2), + authors = developers.value.map(_.name), + language = Some("en"), + version = Some(version.value) + ) + .site + .mainNavigation(appendLinks = legacyRelatedProjects.value.toList) + .site + .topNavigationBar( + navLinks = apiLink.value.toList ++ githubLink.value.toList + ) + } + +} diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 30e35666..2f19ef55 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -16,7 +16,8 @@ package org.typelevel.sbt.site -import cats.effect.{Async, Resource} +import cats.effect.Async +import cats.effect.kernel.Resource import laika.ast.Path import laika.io.model.InputTree import laika.markdown.github.GitHubFlavor @@ -28,6 +29,7 @@ import laika.theme.ThemeProvider import java.net.URL +@deprecated("Use GenericSiteSettings.extensions", "0.5.0") object TypelevelHeliumExtensions { @deprecated("Use overload with scala3 and apiURL parameter", "0.4.7") @@ -60,7 +62,7 @@ object TypelevelHeliumExtensions { apiUrl: Option[URL] ): ThemeProvider = new ThemeProvider { def build[F[_]](implicit F: Async[F]): Resource[F, Theme[F]] = - ThemeBuilder[F]("Typelevel Helium Extensions") + ThemeBuilder[F]("sbt-typelevel Helium Extensions") .addInputs( apiUrl.fold(InputTree[F]) { url => InputTree[F].addString(htmlForwarder(url), Path.Root / "api" / "index.html") diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelSiteSettings.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelSiteSettings.scala new file mode 100644 index 00000000..8fb3f87b --- /dev/null +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelSiteSettings.scala @@ -0,0 +1,80 @@ +/* + * Copyright 2022 Typelevel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.typelevel.sbt.site + +import laika.ast.Image +import laika.ast.LengthUnit.px +import laika.ast.Span +import laika.ast.TemplateString +import laika.helium.Helium +import laika.helium.config.* +import org.typelevel.sbt.TypelevelGitHubPlugin.gitHubUserRepo +import sbt.Def.* +import sbt.Keys.licenses + +object TypelevelSiteSettings { + + val defaultHomeLink: ThemeLink = ImageLink.external( + "https://typelevel.org", + Image.external(s"https://typelevel.org/img/logo.svg") + ) + + val defaultFooter: Initialize[Seq[Span]] = setting { + val title = gitHubUserRepo.value.map(_._2) + title.fold(Seq[Span]()) { title => + val licensePhrase = licenses.value.headOption.fold("") { + case (name, url) => + s""" distributed under the $name license""" + } + Seq(TemplateString( + s"""$title is a Typelevel project$licensePhrase.""" + )) + } + } + + val chatLink: IconLink = IconLink.external("https://discord.gg/XF3CXcMzqD", HeliumIcon.chat) + + val twitterLink: IconLink = + IconLink.external("https://twitter.com/typelevel", HeliumIcon.twitter) + + val favIcons: Seq[Favicon] = Seq( + Favicon.external("https://typelevel.org/img/favicon.png", "32x32", "image/png") + ) + + val defaults: Initialize[Helium] = setting { + GenericSiteSettings + .defaults + .value + .site + .layout( + topBarHeight = px(50) + ) + .site + .darkMode + .disabled + .site + .favIcons(favIcons: _*) + .site + .footer(defaultFooter.value: _*) + .site + .topNavigationBar( + homeLink = defaultHomeLink, + navLinks = List(chatLink, twitterLink) + ) + } + +} From d755037c4b07154ccae61ec2385db39299c5eec3 Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Wed, 21 Sep 2022 15:45:30 +0100 Subject: [PATCH 60/99] site - expand documentation --- docs/site.md | 112 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 103 insertions(+), 9 deletions(-) diff --git a/docs/site.md b/docs/site.md index fe8eacf9..db46aade 100644 --- a/docs/site.md +++ b/docs/site.md @@ -1,6 +1,8 @@ # sbt-typelevel-site -**sbt-typelevel-site** is an optional plugin for generating websites with [mdoc](https://scalameta.org/mdoc/) and [Laika](https://planet42.github.io/Laika/) and deploying to GitHub Pages from CI. You can add it to your build alongside either the **sbt-typelevel** or **sbt-typelevel-ci-release** plugin. +**sbt-typelevel-site** is an optional plugin for generating websites with [mdoc](https://scalameta.org/mdoc/) +and [Laika](https://planet42.github.io/Laika/) and deploying to GitHub Pages from CI. +You can add it to your build alongside either the **sbt-typelevel** or **sbt-typelevel-ci-release** plugin. ## Quick start @@ -19,9 +21,11 @@ ThisBuild / tlSitePublishBranch := Some("main") lazy val docs = project.in(file("site")).enablePlugins(TypelevelSitePlugin) ``` -Place your `.md` files in the `docs/` directory of your project. To preview locally, run `docs/tlSitePreview`. This will start a preview server at http://localhost:4242. +Place your `.md` files in the `docs/` directory of your project. To preview locally, run `docs/tlSitePreview`. +This will start a preview server at http://localhost:4242. -The site is generated using [mdoc](https://scalameta.org/mdoc/) and [Laika](https://planet42.github.io/Laika/) and published to the `gh-pages` branch on every push to the specified branch. +The site is generated using [mdoc](https://scalameta.org/mdoc/) and [Laika](https://planet42.github.io/Laika/) +and published to the `gh-pages` branch on every push to the specified branch. You will also need to configure your repository settings: @@ -30,15 +34,109 @@ You will also need to configure your repository settings: 2. Set the GitHub pages source to the `/` (root) directory on the `gh-pages` branch. `https://github.com/{user}/{repo}/settings/pages` + +## Configuration + +If you run the plugin with its defaults it will generate a site that will look like this documentation. + +Below we'll describe how the default settings differ from Laika standalone +as well as a few pointers for the most relevant customization options. + + +### Site Default Settings + +Whereas Laika standalone is a general purpose tool, this plugin's domain is project documentation +which allows us to make a few additional assumptions and add useful defaults based on those. + +On top of the defaults of Laika standalone, sbt-typelevel adds: + +* GitHubFlavor for Markdown is enabled by default (e.g. for fenced code blocks). +* Laika's builtin syntax highlighting is enabled by default (which does not require JavaScript highlighters). +* Metadata is pre-populated based on sbt settings (e.g. title, author, version). +* A link to the GitHub repository is inserted into the top navigation bar based on the output of `git ls-remote --get-url`. +* If you define the `tlSiteApiUrl` setting, a link to the API documentation is inserted into the top navigation bar + and a redirect for `/api/` to that URL will be added to your site. + + +#### Additional Defaults for Typelevel Projects + +If the generated documentation is for a Typelevel project, you can optionally enable a set of additional defaults +on top of the generic defaults listed in the previous section: + +```scala +tlSiteIsTypelevelProject := true +``` + +With the flag above (which defaults to `false`) these additional settings apply: + +* The home link in the top navigation bar carries the Typelevel logo and points to the Typelevel site. +* Links to the Typelevel Discord and Typelevel Twitter are inserted into the top navigation bar. +* The Typelevel favicons are used for the generared site. +* A default footer for Typelevel projects is added to the bottom of each page. +* Theme support for the browser's dark mode is disabled. + + +### Customization + +All customization options are based on Laika's configuration APIs for which we refer you to the comprehensive [Laika manual][Laika] +and specifically the [`laikaTheme` setting](https://planet42.github.io/Laika/0.18/02-running-laika/01-sbt-plugin.html#laikatheme-setting). + +@:callout(warning) +For all code examples in the Laika manual you need to replace `Helium.defaults` with `tlSiteHelium.value` +**unless** you explicitly want to remove all additional defaults listed above. +Everything else should be identical with using Laika standalone. +@:@ + +Some of the customization options which are most likely of interest in the context of project documentation: + +* **Versioned Documentation** - Laika can generate versioned documentation that works well for a standard workflow + where maintenance branches update only the pages specific to that version. + It inserts a dynamic version switcher into the top navigation bar that is driven by configuration + (meaning older versions can see newer versions without re-publishing them). + Examples for existing versioned sites are [Laika] or [http4s]. + See [Versioned Documentation] for details. + +* **Landing Page** - Laika comes with a default look & feel for a landing page, but it is disabled by default, + as it needs to be populated with your content (text, links, logo, etc.). + Example sites with a standard landing page are again [Laika] or [http4s]. + See [Website Landing Page] for details. + +* **Theme Colors and Fonts** - The color theme (including syntax highlighting) and font choices can be adjusted + without the need for handwritten CSS. + An example of a site with a different color scheme is [http4s]. + See [Colors] or [Fonts] for details. + +* **Additional Links** - Both the main/left navigation panel and the top navigation bar can be populated + with additional icon links, text links or menus. + See [Navigation, Links & Favicons][laika-nav] for details. + +For a complete list of customization options please see the full [Laika] documentation. + + +[Laika]: https://planet42.github.io/Laika/index.html +[http4s]: https://http4s.org/ +[Versioned Documentation]: https://planet42.github.io/Laika/0.18/03-preparing-content/01-directory-structure.html#versioned-documentation +[Website Landing Page]: https://planet42.github.io/Laika/0.18/03-preparing-content/03-theme-settings.html#website-landing-page +[Colors]: https://planet42.github.io/Laika/0.18/03-preparing-content/03-theme-settings.html#colors +[Fonts]: https://planet42.github.io/Laika/0.18/03-preparing-content/03-theme-settings.html#fonts +[laika-nav]: https://planet42.github.io/Laika/0.18/03-preparing-content/03-theme-settings.html#navigation-links-favicons + + +## FAQ + ### How can I include my project version on the website? -**sbt-typelevel-site** automatically adds `VERSION` and `SNAPSHOT_VERSION` to the `mdocVariables` setting which can be used with [variable injection](https://scalameta.org/mdoc/docs/why.html#variable-injection). +**sbt-typelevel-site** automatically adds `VERSION` and `SNAPSHOT_VERSION` to the `mdocVariables` setting +which can be used with [variable injection](https://scalameta.org/mdoc/docs/why.html#variable-injection). For example, the sbt-typelevel `VERSION` is `@VERSION@` and `SNAPSHOT_VERSION` is `@SNAPSHOT_VERSION@`. ### How can I publish "unidoc" API docs? -If you generate your API documentation with [sbt-unidoc](https://github.com/sbt/sbt-unidoc), you can use the `TypelevelUnidocPlugin` to publish a Scaladoc-only artifact to Sonatype/Maven alongside your library artifacts. This makes it possible to browse your unidocs at [javadoc.io](https://www.javadoc.io/); for example, the sbt-typelevel [API docs](@API_URL@) are published like this. +If you generate your API documentation with [sbt-unidoc](https://github.com/sbt/sbt-unidoc), +you can use the `TypelevelUnidocPlugin` to publish a Scaladoc-only artifact to Sonatype/Maven alongside your library artifacts. +This makes it possible to browse your unidocs at [javadoc.io](https://www.javadoc.io/); +for example, the sbt-typelevel [API docs](@API_URL@) are published like this. ```scala // Make sure to add to your root aggregate so it gets published! @@ -50,7 +148,3 @@ lazy val unidocs = project ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(core.jvm, heffalump) ) ``` - -### How can I customize my website's appearance? - -We refer you to the comprehensive [Laika manual](https://planet42.github.io/Laika/index.html) and specifically the [`laikaTheme` setting](https://planet42.github.io/Laika/0.18/02-running-laika/01-sbt-plugin.html#laikatheme-setting). From 8fb3f9ac3243a97d797b65de705206738bee6a45 Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:38:40 +0100 Subject: [PATCH 61/99] site - set dependency to Laika 0.19.0-RC1 --- site/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/build.sbt b/site/build.sbt index 30efc1f0..3d38c20e 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3") -addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0-M10") +addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0-RC1") From 5217b74693701e14c3f6a6e26b4168075c08241d Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:58:11 +0100 Subject: [PATCH 62/99] site - set new tlSiteIsTypelevelProject flag for plugin's own build --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 1c5fc21f..4e3a876d 100644 --- a/build.sbt +++ b/build.sbt @@ -212,6 +212,7 @@ lazy val docs = project "Laika" -> url("https://planet42.github.io/Laika/"), "sbt-unidoc" -> url("https://github.com/sbt/sbt-unidoc") ), + tlSiteIsTypelevelProject := true, mdocVariables ++= { import coursier.complete.Complete import java.time._ From df7116accfb17ae695f519a09eaa5c04921910d5 Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Thu, 22 Sep 2022 18:05:32 +0100 Subject: [PATCH 63/99] site - revert to Scala 2 import syntax --- .../typelevel/sbt/TypelevelSitePlugin.scala | 20 +++++++++---------- .../sbt/site/GenericSiteSettings.scala | 2 +- .../sbt/site/TypelevelSiteSettings.scala | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index 6af8f391..0829d043 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -18,17 +18,17 @@ package org.typelevel.sbt import laika.helium.Helium import laika.sbt.LaikaPlugin -import laika.sbt.LaikaPlugin.autoImport.* +import laika.sbt.LaikaPlugin.autoImport._ import laika.sbt.Tasks import laika.theme.ThemeProvider import mdoc.MdocPlugin -import mdoc.MdocPlugin.autoImport.* -import org.typelevel.sbt.TypelevelKernelPlugin.* +import mdoc.MdocPlugin.autoImport._ +import org.typelevel.sbt.TypelevelKernelPlugin._ import org.typelevel.sbt.gha.GenerativePlugin -import org.typelevel.sbt.gha.GenerativePlugin.autoImport.* -import org.typelevel.sbt.site.* -import sbt.Keys.* -import sbt.* +import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ +import org.typelevel.sbt.site._ +import sbt.Keys._ +import sbt._ import scala.annotation.nowarn @@ -73,8 +73,8 @@ object TypelevelSitePlugin extends AutoPlugin { val TypelevelProject = site.TypelevelProject } - import autoImport.* - import TypelevelGitHubPlugin.* + import autoImport._ + import TypelevelGitHubPlugin._ override def requires = MdocPlugin && LaikaPlugin && TypelevelGitHubPlugin && GenerativePlugin && NoPublishPlugin @@ -212,7 +212,7 @@ object TypelevelSitePlugin extends AutoPlugin { private def previewTask = Def .taskDyn { - import cats.effect.unsafe.implicits.* + import cats.effect.unsafe.implicits._ val logger = streams.value.log logger.info("Initializing server...") diff --git a/site/src/main/scala/org/typelevel/sbt/site/GenericSiteSettings.scala b/site/src/main/scala/org/typelevel/sbt/site/GenericSiteSettings.scala index 9fc1f30c..3b6e589f 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/GenericSiteSettings.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/GenericSiteSettings.scala @@ -28,7 +28,7 @@ import org.typelevel.sbt.TypelevelKernelPlugin.autoImport.tlIsScala3 import org.typelevel.sbt.TypelevelSitePlugin.autoImport.tlSiteApiUrl import org.typelevel.sbt.TypelevelSitePlugin.autoImport.tlSiteHeliumExtensions import org.typelevel.sbt.TypelevelSitePlugin.autoImport.tlSiteRelatedProjects -import sbt.Def.* +import sbt.Def._ import sbt.Keys.developers import sbt.Keys.scmInfo import sbt.Keys.version diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelSiteSettings.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelSiteSettings.scala index 8fb3f87b..e2a3e66f 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelSiteSettings.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelSiteSettings.scala @@ -21,9 +21,9 @@ import laika.ast.LengthUnit.px import laika.ast.Span import laika.ast.TemplateString import laika.helium.Helium -import laika.helium.config.* +import laika.helium.config._ import org.typelevel.sbt.TypelevelGitHubPlugin.gitHubUserRepo -import sbt.Def.* +import sbt.Def._ import sbt.Keys.licenses object TypelevelSiteSettings { From d61d3ad831f4448cb232c992f397dc7bcb3d298e Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Sat, 24 Sep 2022 12:14:44 +0100 Subject: [PATCH 64/99] Update docs/site.md Co-authored-by: Arman Bilge --- docs/site.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/site.md b/docs/site.md index 9b30fe92..1d64c901 100644 --- a/docs/site.md +++ b/docs/site.md @@ -49,7 +49,7 @@ as well as a few pointers for the most relevant customization options. Whereas Laika standalone is a general purpose tool, this plugin's domain is project documentation which allows us to make a few additional assumptions and add useful defaults based on those. -On top of the defaults of Laika standalone, sbt-typelevel adds: +On top of the defaults of Laika standalone, sbt-typelevel-site adds: * GitHubFlavor for Markdown is enabled by default (e.g. for fenced code blocks). * Laika's builtin syntax highlighting is enabled by default (which does not require JavaScript highlighters). From da37d473aa3d8c825a07de55582c04c2a2447afd Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Sat, 24 Sep 2022 12:15:25 +0100 Subject: [PATCH 65/99] Update site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala Co-authored-by: Arman Bilge --- site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index 0829d043..ec5bd1d7 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -119,7 +119,7 @@ object TypelevelSitePlugin extends AutoPlugin { ) ++ tlSiteApiUrl.value.map("API_URL" -> _.toString).toMap }, - tlSiteIsTypelevelProject := false, + tlSiteIsTypelevelProject := organization.value == "org.typelevel", tlSiteHeliumConfig := TypelevelSiteSettings.defaults.value, tlSiteHeliumExtensions := GenericSiteSettings.themeExtensions.value, tlSiteHelium := { From c4549a11dc162cf3fd5eecc8451c3c0692544f11 Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Sat, 24 Sep 2022 12:15:33 +0100 Subject: [PATCH 66/99] Update site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala Co-authored-by: Arman Bilge --- .../org/typelevel/sbt/site/TypelevelHeliumExtensions.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 2f19ef55..87be973a 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -62,7 +62,7 @@ object TypelevelHeliumExtensions { apiUrl: Option[URL] ): ThemeProvider = new ThemeProvider { def build[F[_]](implicit F: Async[F]): Resource[F, Theme[F]] = - ThemeBuilder[F]("sbt-typelevel Helium Extensions") + ThemeBuilder[F]("sbt-typelevel-site Helium Extensions") .addInputs( apiUrl.fold(InputTree[F]) { url => InputTree[F].addString(htmlForwarder(url), Path.Root / "api" / "index.html") From 095648fdf090a8e1c778523031396f926e6530c1 Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 08:38:13 +0000 Subject: [PATCH 67/99] Update snakeyaml to 1.33 --- github-actions/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/build.sbt b/github-actions/build.sbt index d2f41845..c9ea8be6 100644 --- a/github-actions/build.sbt +++ b/github-actions/build.sbt @@ -1 +1 @@ -libraryDependencies += "org.yaml" % "snakeyaml" % "1.30" +libraryDependencies += "org.yaml" % "snakeyaml" % "1.33" From e38267c35e035c6e029eb66c74012a56e420fc33 Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Sun, 9 Oct 2022 16:42:56 +0000 Subject: [PATCH 68/99] Update laika-sbt to 0.19.0 --- site/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/build.sbt b/site/build.sbt index 64e5969e..4ba74bc6 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24") -addSbtPlugin("org.planet42" % "laika-sbt" % "0.18.2") +addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0") From 1cd24a071e7d1e31c3a9b2a41f098852d36e2748 Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Tue, 4 Oct 2022 13:03:33 +0000 Subject: [PATCH 69/99] Update mdoc, sbt-mdoc to 2.3.6 --- site/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/build.sbt b/site/build.sbt index 3d38c20e..8203f336 100644 --- a/site/build.sbt +++ b/site/build.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6") addSbtPlugin("org.planet42" % "laika-sbt" % "0.19.0-RC1") From c7185be1f1a94b50bedc8091bb6d7a464f2c96fd Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Mon, 3 Oct 2022 05:19:25 +0000 Subject: [PATCH 70/99] Update sbt to 1.7.2 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 22af2628..563a014d 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.7.1 +sbt.version=1.7.2 From a4096cd07ea2c91cafb08a6c26ca9a214c228a66 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 21 Oct 2022 02:10:44 +0000 Subject: [PATCH 71/99] Use new setup-graalvm action --- .github/workflows/ci.yml | 34 ++++++++++++++++++- .mergify.yml | 1 + build.sbt | 3 +- .../org/typelevel/sbt/gha/WorkflowStep.scala | 7 ++-- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebf0e9ba..b2f57d91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: matrix: os: [ubuntu-latest] scala: [2.12.17] - java: [temurin@8, temurin@17] + java: [temurin@8, temurin@17, graal_latest@17] project: [sbt-typelevelJVM] runs-on: ${{ matrix.os }} steps: @@ -67,6 +67,14 @@ jobs: jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} cache: sbt + - name: Setup GraalVM (graal_latest@17) + if: matrix.java == 'graal_latest@17' + uses: graalvm/setup-graalvm@v1 + with: + version: latest + java-version: 17 + cache: sbt + - name: Check that workflows are up to date run: sbt githubWorkflowCheck @@ -154,6 +162,14 @@ jobs: jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} cache: sbt + - name: Setup GraalVM (graal_latest@17) + if: matrix.java == 'graal_latest@17' + uses: graalvm/setup-graalvm@v1 + with: + version: latest + java-version: 17 + cache: sbt + - name: Download target directories (2.12.17, sbt-typelevelJVM) uses: actions/download-artifact@v3 with: @@ -237,6 +253,14 @@ jobs: jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} cache: sbt + - name: Setup GraalVM (graal_latest@17) + if: matrix.java == 'graal_latest@17' + uses: graalvm/setup-graalvm@v1 + with: + version: latest + java-version: 17 + cache: sbt + - name: Submit Dependencies uses: scalacenter/sbt-dependency-submission@v2 @@ -288,6 +312,14 @@ jobs: jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} cache: sbt + - name: Setup GraalVM (graal_latest@17) + if: matrix.java == 'graal_latest@17' + uses: graalvm/setup-graalvm@v1 + with: + version: latest + java-version: 17 + cache: sbt + - name: Generate site run: sbt '++${{ matrix.scala }}' docs/tlSite diff --git a/.mergify.yml b/.mergify.yml index d5ed22eb..79c17fa7 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -14,6 +14,7 @@ pull_request_rules: - body~=labels:.*early-semver-minor - status-success=Build and Test (ubuntu-latest, 2.12.17, temurin@8, sbt-typelevelJVM) - status-success=Build and Test (ubuntu-latest, 2.12.17, temurin@17, sbt-typelevelJVM) + - status-success=Build and Test (ubuntu-latest, 2.12.17, graal_latest@17, sbt-typelevelJVM) - '#approved-reviews-by>=1' actions: merge: {} diff --git a/build.sbt b/build.sbt index 86edf9fb..a0048e7d 100644 --- a/build.sbt +++ b/build.sbt @@ -10,7 +10,8 @@ ThisBuild / developers ++= List( tlGitHubDev("djspiewak", "Daniel Spiewak") ) -ThisBuild / githubWorkflowJavaVersions += JavaSpec.temurin("17") +ThisBuild / githubWorkflowJavaVersions ++= + Seq(JavaSpec.temurin("17"), JavaSpec(JavaSpec.Distribution.GraalVM("latest"), "17")) ThisBuild / mergifyStewardConfig ~= { _.map(_.copy(mergeMinors = true, author = "typelevel-steward[bot]")) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 72f1e52b..ca0371cb 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -41,12 +41,13 @@ object WorkflowStep { def SetupJava(versions: List[JavaSpec]): List[WorkflowStep] = versions flatMap { - case jv @ JavaSpec(JavaSpec.Distribution.GraalVM(graalVersion), version) => + case jv @ JavaSpec(JavaSpec.Distribution.GraalVM(graalVersion), javaVersion) => WorkflowStep.Use( - UseRef.Public("DeLaGuardo", "setup-graalvm", "5.0"), + UseRef.Public("graalvm", "setup-graalvm", "v1"), name = Some(s"Setup GraalVM (${jv.render})"), cond = Some(s"matrix.java == '${jv.render}'"), - params = Map("graalvm" -> graalVersion, "java" -> s"java$version") + params = + Map("version" -> graalVersion, "java-version" -> javaVersion, "cache" -> "sbt") ) :: Nil case jv @ JavaSpec(dist, version) if dist.isTlIndexed => From 0a069f3e11563da53621b0ae1fccefa35a8e62bf Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 21 Oct 2022 02:35:07 +0000 Subject: [PATCH 72/99] Disable publishing-related steps in CI plugin --- .../scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala | 7 +++++++ ci/build.sbt | 1 - .../main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala | 4 ++-- project/ci.sbt | 1 - 4 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 ci/build.sbt delete mode 120000 project/ci.sbt diff --git a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala index ba6a3bbc..05e01ed2 100644 --- a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala +++ b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala @@ -18,6 +18,8 @@ package org.typelevel.sbt import sbt._ +import TypelevelCiPlugin.autoImport._ + object TypelevelCiReleasePlugin extends AutoPlugin { override def requires = @@ -29,4 +31,9 @@ object TypelevelCiReleasePlugin extends AutoPlugin { override def trigger = allRequirements + override def buildSettings = Seq( + tlCiMimaBinaryIssueCheck := true, + tlCiDocCheck := true + ) + } diff --git a/ci/build.sbt b/ci/build.sbt deleted file mode 100644 index 9cd6541c..00000000 --- a/ci/build.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1") diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index cd129d9a..3d164f5f 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -56,8 +56,8 @@ object TypelevelCiPlugin extends AutoPlugin { tlCiHeaderCheck := false, tlCiScalafmtCheck := false, tlCiScalafixCheck := false, - tlCiMimaBinaryIssueCheck := true, - tlCiDocCheck := true, + tlCiMimaBinaryIssueCheck := false, + tlCiDocCheck := false, tlCiDependencyGraphJob := true, githubWorkflowTargetBranches ++= Seq( "!update/**", // ignore steward branches diff --git a/project/ci.sbt b/project/ci.sbt deleted file mode 120000 index c9171244..00000000 --- a/project/ci.sbt +++ /dev/null @@ -1 +0,0 @@ -../ci/build.sbt \ No newline at end of file From 98a01f95452d1c8ad30b369bf387a87cc33db526 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 21 Oct 2022 02:42:45 +0000 Subject: [PATCH 73/99] Cleanup unused imports --- ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index 3d164f5f..6ffdb08e 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -16,7 +16,6 @@ package org.typelevel.sbt -import com.typesafe.tools.mima.plugin.MimaPlugin import org.typelevel.sbt.gha.GenerativePlugin import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ import org.typelevel.sbt.gha.GitHubActionsPlugin @@ -29,7 +28,7 @@ import Keys._ object TypelevelCiPlugin extends AutoPlugin { - override def requires = GitHubActionsPlugin && GenerativePlugin && MimaPlugin + override def requires = GitHubActionsPlugin && GenerativePlugin override def trigger = allRequirements object autoImport { From 59ad6912199a01bcd39f0e7550dd7bbf54e7bec8 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 21 Oct 2022 02:58:33 +0000 Subject: [PATCH 74/99] Move GitHub-related settings to GitHub plugin --- .../org/typelevel/sbt/TypelevelGitHubPlugin.scala | 9 ++++++++- .../typelevel/sbt/TypelevelSettingsPlugin.scala | 14 +------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/github/src/main/scala/org/typelevel/sbt/TypelevelGitHubPlugin.scala b/github/src/main/scala/org/typelevel/sbt/TypelevelGitHubPlugin.scala index 47365114..ea05483f 100644 --- a/github/src/main/scala/org/typelevel/sbt/TypelevelGitHubPlugin.scala +++ b/github/src/main/scala/org/typelevel/sbt/TypelevelGitHubPlugin.scala @@ -73,6 +73,7 @@ object TypelevelGitHubPlugin extends AutoPlugin { val tagOrHash = GitHelper.getTagOrHash(git.gitCurrentTags.value, git.gitHeadCommit.value) val userRepo = gitHubUserRepo.value + val infoOpt = scmInfo.value if (tlIsScala3.value) tagOrHash.toSeq flatMap { vh => @@ -80,7 +81,13 @@ object TypelevelGitHubPlugin extends AutoPlugin { case (user, repo) => Seq(s"-source-links:github://${user}/${repo}", "-revision", vh) } } - else Nil // TODO move from settings plugin + else + tagOrHash.toSeq flatMap { vh => + infoOpt.toSeq flatMap { info => + val path = s"${info.browseUrl}/blob/${vh}€{FILE_PATH}.scala" + Seq("-doc-source-url", path) + } + } } ) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 08098f53..e592fda8 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -17,8 +17,6 @@ package org.typelevel.sbt import com.github.sbt.git.GitPlugin -import com.github.sbt.git.SbtGit.git -import org.typelevel.sbt.kernel.GitHelper import org.typelevel.sbt.kernel.V import sbt._ import sbtcrossproject.CrossPlugin.autoImport._ @@ -191,19 +189,9 @@ object TypelevelSettingsPlugin extends AutoPlugin { Seq("-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath) }, Compile / doc / scalacOptions ++= { - val tagOrHash = - GitHelper.getTagOrHash(git.gitCurrentTags.value, git.gitHeadCommit.value) - val infoOpt = scmInfo.value - if (tlIsScala3.value) Seq("-project-version", version.value) - else // TODO move to GitHub plugin - tagOrHash.toSeq flatMap { vh => - infoOpt.toSeq flatMap { info => - val path = s"${info.browseUrl}/blob/${vh}€{FILE_PATH}.scala" - Seq("-doc-source-url", path) - } - } + else Nil }, javacOptions ++= Seq( "-encoding", From a40867eef5c179e0e79cb17fe7b13874950c47f9 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 21 Oct 2022 14:32:20 +0000 Subject: [PATCH 75/99] Use semantic version selector for `++` --- .github/workflows/ci.yml | 13 +++++++++---- .mergify.yml | 4 +--- .../org/typelevel/sbt/gha/GenerativePlugin.scala | 9 ++++++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2f57d91..dd13f43b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,9 +23,14 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.12.17] + scala: [2.12] java: [temurin@8, temurin@17, graal_latest@17] project: [sbt-typelevelJVM] + exclude: + - scala: 2.12 + java: temurin@17 + - scala: 2.12 + java: graal_latest@17 runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -170,12 +175,12 @@ jobs: java-version: 17 cache: sbt - - name: Download target directories (2.12.17, sbt-typelevelJVM) + - name: Download target directories (2.12, sbt-typelevelJVM) uses: actions/download-artifact@v3 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-sbt-typelevelJVM + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-sbt-typelevelJVM - - name: Inflate target directories (2.12.17, sbt-typelevelJVM) + - name: Inflate target directories (2.12, sbt-typelevelJVM) run: | tar xf targets.tar rm targets.tar diff --git a/.mergify.yml b/.mergify.yml index 79c17fa7..7e717c02 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -12,9 +12,7 @@ pull_request_rules: - or: - body~=labels:.*early-semver-patch - body~=labels:.*early-semver-minor - - status-success=Build and Test (ubuntu-latest, 2.12.17, temurin@8, sbt-typelevelJVM) - - status-success=Build and Test (ubuntu-latest, 2.12.17, temurin@17, sbt-typelevelJVM) - - status-success=Build and Test (ubuntu-latest, 2.12.17, graal_latest@17, sbt-typelevelJVM) + - status-success=Build and Test (ubuntu-latest, 2.12, temurin@8, sbt-typelevelJVM) - '#approved-reviews-by>=1' actions: merge: {} diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index 0d259410..b12d6f43 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -525,7 +525,14 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowPublishTargetBranches := Seq(RefPredicate.Equals(Ref.Branch("main"))), githubWorkflowPublishCond := None, githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11")), - githubWorkflowScalaVersions := crossScalaVersions.value, + githubWorkflowScalaVersions := { + val scalas = crossScalaVersions.value + val binaryScalas = scalas.map(CrossVersion.binaryScalaVersion(_)) + if (binaryScalas.toSet.size == scalas.size) + binaryScalas + else + scalas + }, githubWorkflowOSes := Seq("ubuntu-latest"), githubWorkflowDependencyPatterns := Seq("**/*.sbt", "project/build.properties"), githubWorkflowTargetBranches := Seq("**"), From 2c7de35bb792486946e860cfdb7dcbdcd9ea183e Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 21 Oct 2022 14:40:58 +0000 Subject: [PATCH 76/99] Fix excludes --- .github/workflows/ci.yml | 5 ----- .mergify.yml | 2 ++ core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd13f43b..c3c72f50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,11 +26,6 @@ jobs: scala: [2.12] java: [temurin@8, temurin@17, graal_latest@17] project: [sbt-typelevelJVM] - exclude: - - scala: 2.12 - java: temurin@17 - - scala: 2.12 - java: graal_latest@17 runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) diff --git a/.mergify.yml b/.mergify.yml index 7e717c02..d0226440 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -13,6 +13,8 @@ pull_request_rules: - body~=labels:.*early-semver-patch - body~=labels:.*early-semver-minor - status-success=Build and Test (ubuntu-latest, 2.12, temurin@8, sbt-typelevelJVM) + - status-success=Build and Test (ubuntu-latest, 2.12, temurin@17, sbt-typelevelJVM) + - status-success=Build and Test (ubuntu-latest, 2.12, graal_latest@17, sbt-typelevelJVM) - '#approved-reviews-by>=1' actions: merge: {} diff --git a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala index e339be97..a49ef635 100644 --- a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala +++ b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala @@ -79,7 +79,7 @@ object TypelevelPlugin extends AutoPlugin { githubWorkflowBuildMatrixExclusions ++= { val defaultScala = (ThisBuild / scalaVersion).value for { - scala <- githubWorkflowScalaVersions.value.filterNot(_ == defaultScala) + scala <- githubWorkflowScalaVersions.value.filterNot(defaultScala.startsWith(_)) java <- githubWorkflowJavaVersions.value.tail // default java is head } yield MatrixExclude(Map("scala" -> scala, "java" -> java.render)) } From 3182610c98ad3c289ff8ac7f01c716136c1170d5 Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 03:02:10 +0000 Subject: [PATCH 77/99] Update sbt to 1.7.3 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c8fcab54..6a9f0388 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.2 +sbt.version=1.7.3 From 044af9496124d466924f0c57f5b6553cfaa4c6d7 Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Fri, 4 Nov 2022 08:38:30 +0000 Subject: [PATCH 78/99] Update sbt-sonatype to 3.9.14 --- sonatype/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonatype/build.sbt b/sonatype/build.sbt index 490e6184..d2061b88 100644 --- a/sonatype/build.sbt +++ b/sonatype/build.sbt @@ -1,3 +1,3 @@ addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.14") addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") From eb6c4a7299537c6af8f26025817c19fdf953abf6 Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Fri, 11 Nov 2022 02:31:22 +0000 Subject: [PATCH 79/99] Update sbt to 1.8.0 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c8fcab54..8b9a0b0a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.2 +sbt.version=1.8.0 From f5fada64bf5671d4e41ab4d2c47cce52c9192c62 Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Sun, 13 Nov 2022 20:28:04 +0200 Subject: [PATCH 80/99] Allow configuring `concurrency` for a job --- .github/workflows/ci.yml | 3 +++ build.sbt | 4 ++++ docs/gha.md | 1 + .../typelevel/sbt/gha/GenerativeKeys.scala | 2 ++ .../typelevel/sbt/gha/GenerativePlugin.scala | 23 +++++++++++++++++-- .../typelevel/sbt/gha/JobConcurrency.scala | 19 +++++++++++++++ .../org/typelevel/sbt/gha/WorkflowJob.scala | 3 ++- 7 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 github-actions/src/main/scala/org/typelevel/sbt/gha/JobConcurrency.scala diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3c72f50..8808a8ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,9 @@ jobs: java: [temurin@8, temurin@17, graal_latest@17] project: [sbt-typelevelJVM] runs-on: ${{ matrix.os }} + concurrency: + group: ci-${{ matrix.java }}-${{ github.ref }} + cancel-in-progress: true steps: - name: Checkout current branch (full) uses: actions/checkout@v3 diff --git a/build.sbt b/build.sbt index a0048e7d..6e2eb5ec 100644 --- a/build.sbt +++ b/build.sbt @@ -13,6 +13,10 @@ ThisBuild / developers ++= List( ThisBuild / githubWorkflowJavaVersions ++= Seq(JavaSpec.temurin("17"), JavaSpec(JavaSpec.Distribution.GraalVM("latest"), "17")) +ThisBuild / githubWorkflowBuildConcurrency := Some( + JobConcurrency("ci-${{ matrix.java }}-${{ github.ref }}", cancelInProgress = Some(true)) +) + ThisBuild / mergifyStewardConfig ~= { _.map(_.copy(mergeMinors = true, author = "typelevel-steward[bot]")) } diff --git a/docs/gha.md b/docs/gha.md index d236f632..532cad19 100644 --- a/docs/gha.md +++ b/docs/gha.md @@ -93,6 +93,7 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowScalaVersions` : `Seq[String]` – A list of Scala versions which will be used to `build` your project. Defaults to `crossScalaVersions` in `build`, and simply `scalaVersion` in `publish`. - `githubWorkflowOSes` : `Seq[String]` – A list of operating systems, which will be ultimately passed to [the `runs-on:` directive](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on), on which to `build` your project. Defaults to `ubuntu-latest`. Note that, regardless of the value of this setting, only `ubuntu-latest` will be used for the `publish` job. This setting only affects `build`. - `githubWorkflowBuildRunsOnExtraLabels` : `Seq[String]` - A list of additional runs-on labels, which will be combined with the matrix.os from `githubWorkflowOSes` above allowing for singling out more specific runners. +- `githubWorkflowBuildConcurrency` : `Option[JobConcurrency]` - Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. Defaults to empty. #### `publish` Job diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index eea4568e..12990499 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -51,6 +51,8 @@ trait GenerativeKeys { settingKey[Seq[MatrixExclude]]("A list of matrix exclusions (default: [])") lazy val githubWorkflowBuildRunsOnExtraLabels = settingKey[Seq[String]]( "A list of additional labels to append to each run of the matrix executions") + lazy val githubWorkflowBuildConcurrency = settingKey[Option[JobConcurrency]]( + "Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: None)") lazy val githubWorkflowBuildPreamble = settingKey[Seq[WorkflowStep]]( "A list of steps to insert after base setup but before compiling and testing (default: [])") diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index b12d6f43..47036389 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -31,6 +31,9 @@ object GenerativePlugin extends AutoPlugin { type WorkflowJob = org.typelevel.sbt.gha.WorkflowJob val WorkflowJob = org.typelevel.sbt.gha.WorkflowJob + type JobConcurrency = org.typelevel.sbt.gha.JobConcurrency + val JobConcurrency = org.typelevel.sbt.gha.JobConcurrency + type JobContainer = org.typelevel.sbt.gha.JobContainer val JobContainer = org.typelevel.sbt.gha.JobContainer @@ -158,6 +161,18 @@ object GenerativePlugin extends AutoPlugin { s"(startsWith($target, 'refs/heads/') && endsWith($target, '$name'))" } + def compileConcurrency(concurrency: JobConcurrency): String = + concurrency.cancelInProgress match { + case Some(value) => + val fields = s"""group: ${wrap(concurrency.group)} + |cancel-in-progress: ${wrap(value.toString)}""".stripMargin + s"""concurrency: + |${indent(fields, 1)}""".stripMargin + + case None => + s"concurrency: ${wrap(concurrency.group)}" + } + def compileEnvironment(environment: JobEnvironment): String = environment.url match { case Some(url) => @@ -296,6 +311,9 @@ ${indent(rendered.mkString("\n"), 1)}""" val renderedCond = job.cond.map(wrap).map("\nif: " + _).getOrElse("") + val renderedConcurrency = + job.concurrency.map(compileConcurrency).map("\n" + _).getOrElse("") + val renderedContainer = job.container match { case Some(JobContainer(image, credentials, env, volumes, ports, options)) => if (credentials.isEmpty && env.isEmpty && volumes.isEmpty && ports.isEmpty && options.isEmpty) { @@ -435,7 +453,7 @@ strategy:${renderedFailFast} os:${compileList(job.oses, 3)} scala:${compileList(job.scalas, 3)} java:${compileList(job.javas.map(_.render), 3)}${renderedMatrices} -runs-on: ${runsOn}${renderedEnvironment}${renderedContainer}${renderedEnv} +runs-on: ${runsOn}${renderedEnvironment}${renderedContainer}${renderedEnv}${renderedConcurrency} steps: ${indent(job.steps.map(compileStep(_, sbt, job.sbtStepPreamble, declareShell = declareShell)).mkString("\n\n"), 1)}""" // format: on @@ -723,7 +741,8 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} matrixAdds = githubWorkflowBuildMatrixAdditions.value, matrixIncs = githubWorkflowBuildMatrixInclusions.value.toList, matrixExcs = githubWorkflowBuildMatrixExclusions.value.toList, - runsOnExtraLabels = githubWorkflowBuildRunsOnExtraLabels.value.toList + runsOnExtraLabels = githubWorkflowBuildRunsOnExtraLabels.value.toList, + concurrency = githubWorkflowBuildConcurrency.value )) ++ publishJobOpt ++ githubWorkflowAddedJobs.value } ) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/JobConcurrency.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/JobConcurrency.scala new file mode 100644 index 00000000..56b72511 --- /dev/null +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/JobConcurrency.scala @@ -0,0 +1,19 @@ +/* + * Copyright 2022 Typelevel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.typelevel.sbt.gha + +final case class JobConcurrency(group: String, cancelInProgress: Option[Boolean] = None) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala index 517796e6..0ed5af8a 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala @@ -33,4 +33,5 @@ final case class WorkflowJob( matrixExcs: List[MatrixExclude] = List(), runsOnExtraLabels: List[String] = List(), container: Option[JobContainer] = None, - environment: Option[JobEnvironment] = None) + environment: Option[JobEnvironment] = None, + concurrency: Option[JobConcurrency] = None) From bb4919eded72b9e360bc500f1d7968b48f63922c Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Sun, 13 Nov 2022 20:51:49 +0200 Subject: [PATCH 81/99] A few minor improvements: better wording, replace `!.isEmpty` -> `nonEmpty`, use `License.Apache2` constant --- .../main/scala/org/typelevel/sbt/TypelevelPlugin.scala | 2 +- docs/gha.md | 2 +- .../scala/org/typelevel/sbt/gha/GenerativePlugin.scala | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala index a49ef635..a51b0e17 100644 --- a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala +++ b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala @@ -68,7 +68,7 @@ object TypelevelPlugin extends AutoPlugin { } }, startYear := Some(java.time.YearMonth.now().getYear()), - licenses += "Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt"), + licenses += License.Apache2, tlCiHeaderCheck := true, tlCiScalafmtCheck := true, tlCiReleaseBranches := Seq("main"), diff --git a/docs/gha.md b/docs/gha.md index d236f632..7d0ef47c 100644 --- a/docs/gha.md +++ b/docs/gha.md @@ -99,5 +99,5 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowPublishPreamble` : `Seq[WorkflowStep]` – Similar to `githubWorkflowBuildPreamble`, this contains a series of steps which will be inserted into the `publish` job *after* setup but *before* the publication step. Defaults to empty. - `githubWorkflowPublishPostamble` : `Seq[WorkflowStep]` – Similar to the `Preamble` variant, this contains a series of steps which will be inserted into the `publish` job after publication has completed, but before cleanup. Defaults to empty. - `githubWorkflowPublish` : `Seq[WorkflowStep]` – The steps which will be invoked to publish your project. This defaults to `[sbt +publish]`. -- `githubWorkflowPublishTargetBranches` : `Seq[RefPredicate]` – A list of branch predicates which will be applied to determine whether the `publish` job will run. Defaults to just `== main`. The supports all of the predicate types currently [allowed by GitHub Actions](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#functions). This exists because, while you usually want to run the `build` job on *every* branch, `publish` is obviously much more limited in applicability. If this list is empty, then the `publish` job will be omitted entirely from the workflow. +- `githubWorkflowPublishTargetBranches` : `Seq[RefPredicate]` – A list of branch predicates which will be applied to determine whether the `publish` job will run. Defaults to just `== main`. The setting supports all of the predicate types currently [allowed by GitHub Actions](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#functions). This exists because, while you usually want to run the `build` job on *every* branch, `publish` is obviously much more limited in applicability. If this list is empty, then the `publish` job will be omitted entirely from the workflow. - `githubWorkflowPublishCond` : `Option[String]` – This is an optional added conditional check on the publish branch, which must be defined using [GitHub Actions expression syntax](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#about-contexts-and-expressions), which will be conjoined to determine the `if:` predicate on the `publish` job. Defaults to `None`. diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index b12d6f43..e1215822 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -312,25 +312,25 @@ ${indent(rendered.mkString("\n"), 1)}""" } val renderedEnv = - if (!env.isEmpty) + if (env.nonEmpty) "\n" + compileEnv(env) else "" val renderedVolumes = - if (!volumes.isEmpty) + if (volumes.nonEmpty) s"\nvolumes:${compileList(volumes.toList map { case (l, r) => s"$l:$r" }, 1)}" else "" val renderedPorts = - if (!ports.isEmpty) + if (ports.nonEmpty) s"\nports:${compileList(ports.map(_.toString), 1)}" else "" val renderedOptions = - if (!options.isEmpty) + if (options.nonEmpty) s"\noptions: ${wrap(options.mkString(" "))}" else "" @@ -701,7 +701,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} scalas = List(scalaVersion.value), javas = List(githubWorkflowJavaVersions.value.head), needs = List("build") - )).filter(_ => !githubWorkflowPublishTargetBranches.value.isEmpty) + )).filter(_ => githubWorkflowPublishTargetBranches.value.nonEmpty) Seq( WorkflowJob( From 6689df3c141847622733ea24851358fb69943f7d Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Sun, 13 Nov 2022 23:47:34 +0200 Subject: [PATCH 82/99] Allow configuring `timeout-minutes` for a job and a step --- .github/workflows/ci.yml | 2 ++ build.sbt | 2 ++ .../org/typelevel/sbt/CrossRootProject.scala | 4 ++-- docs/gha.md | 2 ++ .../typelevel/sbt/gha/GenerativeKeys.scala | 4 ++++ .../typelevel/sbt/gha/GenerativePlugin.scala | 19 +++++++++++++++---- .../org/typelevel/sbt/gha/WorkflowJob.scala | 3 ++- .../org/typelevel/sbt/gha/WorkflowStep.scala | 14 +++++++++++--- 8 files changed, 40 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3c72f50..c7bf6fbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: java: [temurin@8, temurin@17, graal_latest@17] project: [sbt-typelevelJVM] runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout current branch (full) uses: actions/checkout@v3 @@ -122,6 +123,7 @@ jobs: scala: [2.12.17] java: [temurin@8] runs-on: ${{ matrix.os }} + timeout-minutes: 45 steps: - name: Checkout current branch (full) uses: actions/checkout@v3 diff --git a/build.sbt b/build.sbt index a0048e7d..5fee6b62 100644 --- a/build.sbt +++ b/build.sbt @@ -13,6 +13,8 @@ ThisBuild / developers ++= List( ThisBuild / githubWorkflowJavaVersions ++= Seq(JavaSpec.temurin("17"), JavaSpec(JavaSpec.Distribution.GraalVM("latest"), "17")) +ThisBuild / githubWorkflowPublishTimeoutMinutes := Some(45) + ThisBuild / mergifyStewardConfig ~= { _.map(_.copy(mergeMinors = true, author = "typelevel-steward[bot]")) } diff --git a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala index 98223bf0..5af202b6 100644 --- a/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala +++ b/ci/src/main/scala/org/typelevel/sbt/CrossRootProject.scala @@ -159,7 +159,7 @@ object TypelevelCiJSPlugin extends AutoPlugin with RootProjectId { }, githubWorkflowBuild := { githubWorkflowBuild.value.flatMap { - case testStep @ WorkflowStep.Sbt(List("test"), _, _, _, _, _) => + case testStep @ WorkflowStep.Sbt(List("test"), _, _, _, _, _, _) => val fastOptStep = WorkflowStep.Sbt( List("Test/scalaJSLinkerResult"), name = Some("scalaJSLink"), @@ -191,7 +191,7 @@ object TypelevelCiNativePlugin extends AutoPlugin with RootProjectId { }, githubWorkflowBuild := { githubWorkflowBuild.value.flatMap { - case testStep @ WorkflowStep.Sbt(List("test"), _, _, _, _, _) => + case testStep @ WorkflowStep.Sbt(List("test"), _, _, _, _, _, _) => val nativeLinkStep = WorkflowStep.Sbt( List("Test/nativeLink"), name = Some("nativeLink"), diff --git a/docs/gha.md b/docs/gha.md index 7d0ef47c..33b6e011 100644 --- a/docs/gha.md +++ b/docs/gha.md @@ -93,6 +93,7 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowScalaVersions` : `Seq[String]` – A list of Scala versions which will be used to `build` your project. Defaults to `crossScalaVersions` in `build`, and simply `scalaVersion` in `publish`. - `githubWorkflowOSes` : `Seq[String]` – A list of operating systems, which will be ultimately passed to [the `runs-on:` directive](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on), on which to `build` your project. Defaults to `ubuntu-latest`. Note that, regardless of the value of this setting, only `ubuntu-latest` will be used for the `publish` job. This setting only affects `build`. - `githubWorkflowBuildRunsOnExtraLabels` : `Seq[String]` - A list of additional runs-on labels, which will be combined with the matrix.os from `githubWorkflowOSes` above allowing for singling out more specific runners. +- `githubWorkflowBuildTimeoutMinutes` : `Option[Int]` - The maximum number of minutes to let the build job run before GitHub automatically cancels it. Defaults to 60 minutes. #### `publish` Job @@ -101,3 +102,4 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowPublish` : `Seq[WorkflowStep]` – The steps which will be invoked to publish your project. This defaults to `[sbt +publish]`. - `githubWorkflowPublishTargetBranches` : `Seq[RefPredicate]` – A list of branch predicates which will be applied to determine whether the `publish` job will run. Defaults to just `== main`. The setting supports all of the predicate types currently [allowed by GitHub Actions](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#functions). This exists because, while you usually want to run the `build` job on *every* branch, `publish` is obviously much more limited in applicability. If this list is empty, then the `publish` job will be omitted entirely from the workflow. - `githubWorkflowPublishCond` : `Option[String]` – This is an optional added conditional check on the publish branch, which must be defined using [GitHub Actions expression syntax](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#about-contexts-and-expressions), which will be conjoined to determine the `if:` predicate on the `publish` job. Defaults to `None`. +- `githubWorkflowPublishTimeoutMinutes` : `Option[Int]` - The maximum number of minutes to let the publish job run before GitHub automatically cancels it. Defaults to empty. diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index eea4568e..49443743 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -51,6 +51,8 @@ trait GenerativeKeys { settingKey[Seq[MatrixExclude]]("A list of matrix exclusions (default: [])") lazy val githubWorkflowBuildRunsOnExtraLabels = settingKey[Seq[String]]( "A list of additional labels to append to each run of the matrix executions") + lazy val githubWorkflowBuildTimeoutMinutes = settingKey[Option[Int]]( + "The maximum number of minutes to let the build job run before GitHub automatically cancels it (default: 60)") lazy val githubWorkflowBuildPreamble = settingKey[Seq[WorkflowStep]]( "A list of steps to insert after base setup but before compiling and testing (default: [])") @@ -72,6 +74,8 @@ trait GenerativeKeys { "A set of branch predicates which will be applied to determine whether the current branch gets a publication stage; if empty, publish will be skipped entirely (default: [== main])") lazy val githubWorkflowPublishCond = settingKey[Option[String]]( "A set of conditionals to apply to the publish job to further restrict its run (default: [])") + lazy val githubWorkflowPublishTimeoutMinutes = settingKey[Option[Int]]( + "The maximum number of minutes to let the publish job run before GitHub automatically cancels it (default: None)") lazy val githubWorkflowJavaVersions = settingKey[Seq[JavaSpec]]( "A list of Java versions to be used for the build job. The publish job will use the *first* of these versions. (default: [temurin@11])") diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index e1215822..1354bc37 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -203,7 +203,11 @@ ${indent(rendered.mkString("\n"), 1)}""" else renderedEnvPre + "\n" - val preamblePre = renderedName + renderedId + renderedCond + renderedEnv + val renderedTimeoutMinutes = + step.timeoutMinutes.map("timeout-minutes: " + _ + "\n").getOrElse("") + + val preamblePre = + renderedName + renderedId + renderedCond + renderedEnv + renderedTimeoutMinutes val preamble = if (preamblePre.isEmpty) @@ -349,6 +353,9 @@ ${indent(rendered.mkString("\n"), 1)}""" else "\n" + renderedEnvPre + val renderedTimeoutMinutes = + job.timeoutMinutes.map(timeout => s"\ntimeout-minutes: $timeout").getOrElse("") + List("include", "exclude") foreach { key => if (job.matrixAdds.contains(key)) { sys.error(s"key `$key` is reserved and cannot be used in an Actions matrix definition") @@ -435,7 +442,7 @@ strategy:${renderedFailFast} os:${compileList(job.oses, 3)} scala:${compileList(job.scalas, 3)} java:${compileList(job.javas.map(_.render), 3)}${renderedMatrices} -runs-on: ${runsOn}${renderedEnvironment}${renderedContainer}${renderedEnv} +runs-on: ${runsOn}${renderedEnvironment}${renderedContainer}${renderedEnv}${renderedTimeoutMinutes} steps: ${indent(job.steps.map(compileStep(_, sbt, job.sbtStepPreamble, declareShell = declareShell)).mkString("\n\n"), 1)}""" // format: on @@ -514,6 +521,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowBuildMatrixInclusions := Seq(), githubWorkflowBuildMatrixExclusions := Seq(), githubWorkflowBuildRunsOnExtraLabels := Seq(), + githubWorkflowBuildTimeoutMinutes := Some(60), githubWorkflowBuildPreamble := Seq(), githubWorkflowBuildPostamble := Seq(), githubWorkflowBuildSbtStepPreamble := Seq(s"++$${{ matrix.scala }}"), @@ -524,6 +532,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} WorkflowStep.Sbt(List("+publish"), name = Some("Publish project"))), githubWorkflowPublishTargetBranches := Seq(RefPredicate.Equals(Ref.Branch("main"))), githubWorkflowPublishCond := None, + githubWorkflowPublishTimeoutMinutes := None, githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11")), githubWorkflowScalaVersions := { val scalas = crossScalaVersions.value @@ -700,7 +709,8 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} oses = githubWorkflowOSes.value.toList.take(1), scalas = List(scalaVersion.value), javas = List(githubWorkflowJavaVersions.value.head), - needs = List("build") + needs = List("build"), + timeoutMinutes = githubWorkflowPublishTimeoutMinutes.value )).filter(_ => githubWorkflowPublishTargetBranches.value.nonEmpty) Seq( @@ -723,7 +733,8 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} matrixAdds = githubWorkflowBuildMatrixAdditions.value, matrixIncs = githubWorkflowBuildMatrixInclusions.value.toList, matrixExcs = githubWorkflowBuildMatrixExclusions.value.toList, - runsOnExtraLabels = githubWorkflowBuildRunsOnExtraLabels.value.toList + runsOnExtraLabels = githubWorkflowBuildRunsOnExtraLabels.value.toList, + timeoutMinutes = githubWorkflowBuildTimeoutMinutes.value )) ++ publishJobOpt ++ githubWorkflowAddedJobs.value } ) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala index 517796e6..585a8930 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala @@ -33,4 +33,5 @@ final case class WorkflowJob( matrixExcs: List[MatrixExclude] = List(), runsOnExtraLabels: List[String] = List(), container: Option[JobContainer] = None, - environment: Option[JobEnvironment] = None) + environment: Option[JobEnvironment] = None, + timeoutMinutes: Option[Int] = None) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index ca0371cb..987a8ccb 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -21,11 +21,13 @@ sealed trait WorkflowStep extends Product with Serializable { def name: Option[String] def cond: Option[String] def env: Map[String, String] + def timeoutMinutes: Option[Int] def withId(id: Option[String]): WorkflowStep def withName(name: Option[String]): WorkflowStep def withCond(cond: Option[String]): WorkflowStep def withEnv(env: Map[String, String]): WorkflowStep + def withTimeoutMinutes(minutes: Option[Int]): WorkflowStep } object WorkflowStep { @@ -109,12 +111,14 @@ object WorkflowStep { name: Option[String] = None, cond: Option[String] = None, env: Map[String, String] = Map(), - params: Map[String, String] = Map()) + params: Map[String, String] = Map(), + timeoutMinutes: Option[Int] = None) extends WorkflowStep { def withId(id: Option[String]) = copy(id = id) def withName(name: Option[String]) = copy(name = name) def withCond(cond: Option[String]) = copy(cond = cond) def withEnv(env: Map[String, String]) = copy(env = env) + def withTimeoutMinutes(minutes: Option[Int]) = copy(timeoutMinutes = minutes) } final case class Sbt( @@ -123,12 +127,14 @@ object WorkflowStep { name: Option[String] = None, cond: Option[String] = None, env: Map[String, String] = Map(), - params: Map[String, String] = Map()) + params: Map[String, String] = Map(), + timeoutMinutes: Option[Int] = None) extends WorkflowStep { def withId(id: Option[String]) = copy(id = id) def withName(name: Option[String]) = copy(name = name) def withCond(cond: Option[String]) = copy(cond = cond) def withEnv(env: Map[String, String]) = copy(env = env) + def withTimeoutMinutes(minutes: Option[Int]) = copy(timeoutMinutes = minutes) } final case class Use( @@ -137,11 +143,13 @@ object WorkflowStep { id: Option[String] = None, name: Option[String] = None, cond: Option[String] = None, - env: Map[String, String] = Map()) + env: Map[String, String] = Map(), + timeoutMinutes: Option[Int] = None) extends WorkflowStep { def withId(id: Option[String]) = copy(id = id) def withName(name: Option[String]) = copy(name = name) def withCond(cond: Option[String]) = copy(cond = cond) def withEnv(env: Map[String, String]) = copy(env = env) + def withTimeoutMinutes(minutes: Option[Int]) = copy(timeoutMinutes = minutes) } } From 029cb32bae0254426ab2fc5c78123f572c5ab3a9 Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Mon, 14 Nov 2022 09:55:59 +0200 Subject: [PATCH 83/99] Enable build `concurrency` by default --- .github/workflows/ci.yml | 3 ++ build.sbt | 4 --- docs/gha.md | 2 +- .../typelevel/sbt/gha/GenerativeKeys.scala | 2 +- .../typelevel/sbt/gha/GenerativePlugin.scala | 35 ++++++++++++++----- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7bf6fbc..8da46371 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,9 @@ jobs: java: [temurin@8, temurin@17, graal_latest@17] project: [sbt-typelevelJVM] runs-on: ${{ matrix.os }} + concurrency: + group: ci-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}-${{ github.ref }} + cancel-in-progress: true timeout-minutes: 60 steps: - name: Checkout current branch (full) diff --git a/build.sbt b/build.sbt index 5d5a6ac4..5fee6b62 100644 --- a/build.sbt +++ b/build.sbt @@ -13,10 +13,6 @@ ThisBuild / developers ++= List( ThisBuild / githubWorkflowJavaVersions ++= Seq(JavaSpec.temurin("17"), JavaSpec(JavaSpec.Distribution.GraalVM("latest"), "17")) -ThisBuild / githubWorkflowBuildConcurrency := Some( - JobConcurrency("ci-${{ matrix.java }}-${{ github.ref }}", cancelInProgress = Some(true)) -) - ThisBuild / githubWorkflowPublishTimeoutMinutes := Some(45) ThisBuild / mergifyStewardConfig ~= { diff --git a/docs/gha.md b/docs/gha.md index 99cd5b9e..398c6614 100644 --- a/docs/gha.md +++ b/docs/gha.md @@ -93,7 +93,7 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowScalaVersions` : `Seq[String]` – A list of Scala versions which will be used to `build` your project. Defaults to `crossScalaVersions` in `build`, and simply `scalaVersion` in `publish`. - `githubWorkflowOSes` : `Seq[String]` – A list of operating systems, which will be ultimately passed to [the `runs-on:` directive](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on), on which to `build` your project. Defaults to `ubuntu-latest`. Note that, regardless of the value of this setting, only `ubuntu-latest` will be used for the `publish` job. This setting only affects `build`. - `githubWorkflowBuildRunsOnExtraLabels` : `Seq[String]` - A list of additional runs-on labels, which will be combined with the matrix.os from `githubWorkflowOSes` above allowing for singling out more specific runners. -- `githubWorkflowBuildConcurrency` : `Option[JobConcurrency]` - Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. Defaults to empty. +- `githubWorkflowBuildConcurrency` : `Option[JobConcurrency]` - Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. Defaults to `ci-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }}`. - `githubWorkflowBuildTimeoutMinutes` : `Option[Int]` - The maximum number of minutes to let the build job run before GitHub automatically cancels it. Defaults to 60 minutes. #### `publish` Job diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index 7bf2b3ab..1897b2de 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -52,7 +52,7 @@ trait GenerativeKeys { lazy val githubWorkflowBuildRunsOnExtraLabels = settingKey[Seq[String]]( "A list of additional labels to append to each run of the matrix executions") lazy val githubWorkflowBuildConcurrency = settingKey[Option[JobConcurrency]]( - "Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: None)") + "Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: ci-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }})") lazy val githubWorkflowBuildTimeoutMinutes = settingKey[Option[Int]]( "The maximum number of minutes to let the build job run before GitHub automatically cancels it (default: 60)") diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index 64691fd3..b36a8d59 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -67,6 +67,17 @@ object GenerativePlugin extends AutoPlugin { import autoImport._ + private object MatrixKeys { + val OS = "os" + val Scala = "scala" + val Java = "java" + + def groupId(keys: List[String]): String = + (MatrixKeys.OS :: MatrixKeys.Java :: MatrixKeys.Scala :: keys) + .map(k => s"$${{ matrix.$k }}") + .mkString("-") + } + private def indent(output: String, level: Int): String = { val space = (0 until level * 2).map(_ => ' ').mkString (space + output.replace("\n", s"\n$space")).replaceAll("""\n[ ]+\n""", "\n\n") @@ -386,9 +397,9 @@ ${indent(rendered.mkString("\n"), 1)}""" // TODO refactor all of this stuff to use whitelist instead val whitelist = Map( - "os" -> job.oses, - "scala" -> job.scalas, - "java" -> job.javas.map(_.render)) ++ job.matrixAdds + MatrixKeys.OS -> job.oses, + MatrixKeys.Scala -> job.scalas, + MatrixKeys.Java -> job.javas.map(_.render)) ++ job.matrixAdds def checkMatching(matching: Map[String, String]): Unit = { matching foreach { @@ -539,6 +550,11 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowBuildMatrixInclusions := Seq(), githubWorkflowBuildMatrixExclusions := Seq(), githubWorkflowBuildRunsOnExtraLabels := Seq(), + githubWorkflowBuildConcurrency := { + val keys = githubWorkflowBuildMatrixAdditions.value.keys.toList.sorted + val group = MatrixKeys.groupId(keys) + Some(JobConcurrency(s"ci-$group-$${{ github.ref }}", cancelInProgress = Some(true))) + }, githubWorkflowBuildTimeoutMinutes := Some(60), githubWorkflowBuildPreamble := Seq(), githubWorkflowBuildPostamble := Seq(), @@ -621,9 +637,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} cond = Some(publicationCond.value)) val keys = githubWorkflowBuildMatrixAdditions.value.keys.toList.sorted - - val artifactId = - (List("os", "java", "scala") ::: keys).map(k => s"$${{ matrix.$k }}").mkString("-") + val artifactId = MatrixKeys.groupId(keys) val upload = WorkflowStep.Use( UseRef.Public("actions", "upload-artifact", "v3"), @@ -886,9 +900,14 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} includes: List[MatrixInclude], excludes: List[MatrixExclude] ): List[List[String]] = { - val keys = "os" :: "scala" :: "java" :: matrixAdds.keys.toList.sorted + val keys = + MatrixKeys.OS :: MatrixKeys.Scala :: MatrixKeys.Java :: matrixAdds.keys.toList.sorted + val matrix = - matrixAdds + ("os" -> oses) + ("scala" -> scalas) + ("java" -> javas.map(_.render)) + matrixAdds + + (MatrixKeys.OS -> oses) + + (MatrixKeys.Scala -> scalas) + + (MatrixKeys.Java -> javas.map(_.render)) // expand the matrix keys From 4485b9c256c0889e7b9e053146a09bc18220d441 Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Mon, 14 Nov 2022 10:01:25 +0200 Subject: [PATCH 84/99] Suppress false-positive warning --- .../src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index 1897b2de..743b1321 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -51,6 +51,7 @@ trait GenerativeKeys { settingKey[Seq[MatrixExclude]]("A list of matrix exclusions (default: [])") lazy val githubWorkflowBuildRunsOnExtraLabels = settingKey[Seq[String]]( "A list of additional labels to append to each run of the matrix executions") + @annotation.nowarn("msg=possible missing interpolator") lazy val githubWorkflowBuildConcurrency = settingKey[Option[JobConcurrency]]( "Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: ci-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }})") lazy val githubWorkflowBuildTimeoutMinutes = settingKey[Option[Int]]( From 4e217d301622df147917c0674f612727a123dd5b Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Mon, 14 Nov 2022 20:23:26 +0200 Subject: [PATCH 85/99] Address review suggestions. --- .github/workflows/ci.yml | 2 +- docs/gha.md | 2 +- .../main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala | 3 +-- .../scala/org/typelevel/sbt/gha/GenerativePlugin.scala | 8 ++++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8da46371..b4bb611c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: project: [sbt-typelevelJVM] runs-on: ${{ matrix.os }} concurrency: - group: ci-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}-${{ github.ref }} + group: ${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}-${{ github.ref }} cancel-in-progress: true timeout-minutes: 60 steps: diff --git a/docs/gha.md b/docs/gha.md index 398c6614..480ac687 100644 --- a/docs/gha.md +++ b/docs/gha.md @@ -93,7 +93,7 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowScalaVersions` : `Seq[String]` – A list of Scala versions which will be used to `build` your project. Defaults to `crossScalaVersions` in `build`, and simply `scalaVersion` in `publish`. - `githubWorkflowOSes` : `Seq[String]` – A list of operating systems, which will be ultimately passed to [the `runs-on:` directive](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on), on which to `build` your project. Defaults to `ubuntu-latest`. Note that, regardless of the value of this setting, only `ubuntu-latest` will be used for the `publish` job. This setting only affects `build`. - `githubWorkflowBuildRunsOnExtraLabels` : `Seq[String]` - A list of additional runs-on labels, which will be combined with the matrix.os from `githubWorkflowOSes` above allowing for singling out more specific runners. -- `githubWorkflowBuildConcurrency` : `Option[JobConcurrency]` - Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. Defaults to `ci-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }}`. +- `githubWorkflowBuildConcurrency` : `Option[JobConcurrency]` - Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. Defaults to `${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }}`. - `githubWorkflowBuildTimeoutMinutes` : `Option[Int]` - The maximum number of minutes to let the build job run before GitHub automatically cancels it. Defaults to 60 minutes. #### `publish` Job diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index 743b1321..69615146 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -51,9 +51,8 @@ trait GenerativeKeys { settingKey[Seq[MatrixExclude]]("A list of matrix exclusions (default: [])") lazy val githubWorkflowBuildRunsOnExtraLabels = settingKey[Seq[String]]( "A list of additional labels to append to each run of the matrix executions") - @annotation.nowarn("msg=possible missing interpolator") lazy val githubWorkflowBuildConcurrency = settingKey[Option[JobConcurrency]]( - "Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: ci-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }})") + s"Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: $${{ matrix.os }}-$${{ matrix.java }}-$${{ matrix.scala }}-$${{ github.ref }})") lazy val githubWorkflowBuildTimeoutMinutes = settingKey[Option[Int]]( "The maximum number of minutes to let the build job run before GitHub automatically cancels it (default: 60)") diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index b36a8d59..e5063c77 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -68,9 +68,9 @@ object GenerativePlugin extends AutoPlugin { import autoImport._ private object MatrixKeys { - val OS = "os" - val Scala = "scala" - val Java = "java" + final val OS = "os" + final val Scala = "scala" + final val Java = "java" def groupId(keys: List[String]): String = (MatrixKeys.OS :: MatrixKeys.Java :: MatrixKeys.Scala :: keys) @@ -553,7 +553,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowBuildConcurrency := { val keys = githubWorkflowBuildMatrixAdditions.value.keys.toList.sorted val group = MatrixKeys.groupId(keys) - Some(JobConcurrency(s"ci-$group-$${{ github.ref }}", cancelInProgress = Some(true))) + Some(JobConcurrency(s"$group-$${{ github.ref }}", cancelInProgress = Some(true))) }, githubWorkflowBuildTimeoutMinutes := Some(60), githubWorkflowBuildPreamble := Seq(), From f3f9f4468d5fca503df0d865019e871b1ef94a11 Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Mon, 14 Nov 2022 20:25:02 +0200 Subject: [PATCH 86/99] Use `ci-build-` as a prefix of the concurrency group --- .github/workflows/ci.yml | 2 +- docs/gha.md | 2 +- .../src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala | 2 +- .../src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4bb611c..bfbca76e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: project: [sbt-typelevelJVM] runs-on: ${{ matrix.os }} concurrency: - group: ${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}-${{ github.ref }} + group: ci-build-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}-${{ github.ref }} cancel-in-progress: true timeout-minutes: 60 steps: diff --git a/docs/gha.md b/docs/gha.md index 480ac687..8a08d6a9 100644 --- a/docs/gha.md +++ b/docs/gha.md @@ -93,7 +93,7 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowScalaVersions` : `Seq[String]` – A list of Scala versions which will be used to `build` your project. Defaults to `crossScalaVersions` in `build`, and simply `scalaVersion` in `publish`. - `githubWorkflowOSes` : `Seq[String]` – A list of operating systems, which will be ultimately passed to [the `runs-on:` directive](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on), on which to `build` your project. Defaults to `ubuntu-latest`. Note that, regardless of the value of this setting, only `ubuntu-latest` will be used for the `publish` job. This setting only affects `build`. - `githubWorkflowBuildRunsOnExtraLabels` : `Seq[String]` - A list of additional runs-on labels, which will be combined with the matrix.os from `githubWorkflowOSes` above allowing for singling out more specific runners. -- `githubWorkflowBuildConcurrency` : `Option[JobConcurrency]` - Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. Defaults to `${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }}`. +- `githubWorkflowBuildConcurrency` : `Option[JobConcurrency]` - Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. Defaults to `ci-build-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }}`. - `githubWorkflowBuildTimeoutMinutes` : `Option[Int]` - The maximum number of minutes to let the build job run before GitHub automatically cancels it. Defaults to 60 minutes. #### `publish` Job diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index 69615146..5cd07fc6 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -52,7 +52,7 @@ trait GenerativeKeys { lazy val githubWorkflowBuildRunsOnExtraLabels = settingKey[Seq[String]]( "A list of additional labels to append to each run of the matrix executions") lazy val githubWorkflowBuildConcurrency = settingKey[Option[JobConcurrency]]( - s"Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: $${{ matrix.os }}-$${{ matrix.java }}-$${{ matrix.scala }}-$${{ github.ref }})") + s"Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: ci-build-$${{ matrix.os }}-$${{ matrix.java }}-$${{ matrix.scala }}-$${{ github.ref }})") lazy val githubWorkflowBuildTimeoutMinutes = settingKey[Option[Int]]( "The maximum number of minutes to let the build job run before GitHub automatically cancels it (default: 60)") diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index e5063c77..b6975881 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -553,7 +553,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowBuildConcurrency := { val keys = githubWorkflowBuildMatrixAdditions.value.keys.toList.sorted val group = MatrixKeys.groupId(keys) - Some(JobConcurrency(s"$group-$${{ github.ref }}", cancelInProgress = Some(true))) + Some(JobConcurrency(s"ci-build-$group-$${{ github.ref }}", cancelInProgress = Some(true))) }, githubWorkflowBuildTimeoutMinutes := Some(60), githubWorkflowBuildPreamble := Seq(), From ee834597d47e1f9fdfa9ae4f5c803f5893183bf9 Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Tue, 15 Nov 2022 08:47:13 +0200 Subject: [PATCH 87/99] Enable workflow concurrency by default --- .github/workflows/ci.yml | 8 ++++--- docs/gha.md | 2 +- ...JobConcurrency.scala => Concurrency.scala} | 2 +- .../typelevel/sbt/gha/GenerativeKeys.scala | 4 ++-- .../typelevel/sbt/gha/GenerativePlugin.scala | 24 +++++++++++-------- .../org/typelevel/sbt/gha/WorkflowJob.scala | 2 +- 6 files changed, 24 insertions(+), 18 deletions(-) rename github-actions/src/main/scala/org/typelevel/sbt/gha/{JobConcurrency.scala => Concurrency.scala} (87%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfbca76e..9cf7d061 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,11 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }} @ ${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: build: name: Build and Test @@ -27,9 +32,6 @@ jobs: java: [temurin@8, temurin@17, graal_latest@17] project: [sbt-typelevelJVM] runs-on: ${{ matrix.os }} - concurrency: - group: ci-build-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}-${{ github.ref }} - cancel-in-progress: true timeout-minutes: 60 steps: - name: Checkout current branch (full) diff --git a/docs/gha.md b/docs/gha.md index 8a08d6a9..14bdd504 100644 --- a/docs/gha.md +++ b/docs/gha.md @@ -79,6 +79,7 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowJobSetup` : `Seq[WorkflowStep]` – The automatically-generated checkout, setup, and cache steps which are common to all jobs which touch the build (default: autogenerated) - `githubWorkflowEnv` : `Map[String, String]` – An environment which is global to the entire **ci.yml** workflow. Defaults to `Map("GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}")` since it's so commonly needed. - `githubWorkflowAddedJobs` : `Seq[WorkflowJob]` – A convenience mechanism for adding extra custom jobs to the **ci.yml** workflow (though you can also do this by modifying `githubWorkflowGeneratedCI`). Defaults to empty. +- `githubWorkflowConcurrency` : `Option[Concurrency]` - Use concurrency to ensure that only a single workflow within the same concurrency group will run at a time. Defaults to `${{ github.workflow }} @ ${{ github.head_ref || github.ref }}`. #### `build` Job @@ -93,7 +94,6 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowScalaVersions` : `Seq[String]` – A list of Scala versions which will be used to `build` your project. Defaults to `crossScalaVersions` in `build`, and simply `scalaVersion` in `publish`. - `githubWorkflowOSes` : `Seq[String]` – A list of operating systems, which will be ultimately passed to [the `runs-on:` directive](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on), on which to `build` your project. Defaults to `ubuntu-latest`. Note that, regardless of the value of this setting, only `ubuntu-latest` will be used for the `publish` job. This setting only affects `build`. - `githubWorkflowBuildRunsOnExtraLabels` : `Seq[String]` - A list of additional runs-on labels, which will be combined with the matrix.os from `githubWorkflowOSes` above allowing for singling out more specific runners. -- `githubWorkflowBuildConcurrency` : `Option[JobConcurrency]` - Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. Defaults to `ci-build-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ github.ref }}`. - `githubWorkflowBuildTimeoutMinutes` : `Option[Int]` - The maximum number of minutes to let the build job run before GitHub automatically cancels it. Defaults to 60 minutes. #### `publish` Job diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/JobConcurrency.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/Concurrency.scala similarity index 87% rename from github-actions/src/main/scala/org/typelevel/sbt/gha/JobConcurrency.scala rename to github-actions/src/main/scala/org/typelevel/sbt/gha/Concurrency.scala index 56b72511..234c36a3 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/JobConcurrency.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/Concurrency.scala @@ -16,4 +16,4 @@ package org.typelevel.sbt.gha -final case class JobConcurrency(group: String, cancelInProgress: Option[Boolean] = None) +final case class Concurrency(group: String, cancelInProgress: Option[Boolean] = None) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index 5cd07fc6..45254cb3 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -40,6 +40,8 @@ trait GenerativeKeys { "Whether to use sbt's native thin client, default is false since this can cause issues (see https://github.com/sbt/sbt/issues/6468)") lazy val githubWorkflowIncludeClean = settingKey[Boolean]("Whether to include the clean.yml file (default: true)") + lazy val githubWorkflowConcurrency = settingKey[Option[Concurrency]]( + s"Use concurrency to ensure that only a single workflow within the same concurrency group will run at a time. (default: '$${{ github.workflow }} @ $${{ github.head_ref || github.ref }}')") lazy val githubWorkflowBuildMatrixFailFast = settingKey[Option[Boolean]]( "Whether or not to enable the fail-fast strategy (default: None/Enabled)") @@ -51,8 +53,6 @@ trait GenerativeKeys { settingKey[Seq[MatrixExclude]]("A list of matrix exclusions (default: [])") lazy val githubWorkflowBuildRunsOnExtraLabels = settingKey[Seq[String]]( "A list of additional labels to append to each run of the matrix executions") - lazy val githubWorkflowBuildConcurrency = settingKey[Option[JobConcurrency]]( - s"Use concurrency to ensure that only a single build job within the same concurrency group will run at a time. (default: ci-build-$${{ matrix.os }}-$${{ matrix.java }}-$${{ matrix.scala }}-$${{ github.ref }})") lazy val githubWorkflowBuildTimeoutMinutes = settingKey[Option[Int]]( "The maximum number of minutes to let the build job run before GitHub automatically cancels it (default: 60)") diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index b6975881..c87735f8 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -31,8 +31,8 @@ object GenerativePlugin extends AutoPlugin { type WorkflowJob = org.typelevel.sbt.gha.WorkflowJob val WorkflowJob = org.typelevel.sbt.gha.WorkflowJob - type JobConcurrency = org.typelevel.sbt.gha.JobConcurrency - val JobConcurrency = org.typelevel.sbt.gha.JobConcurrency + type Concurrency = org.typelevel.sbt.gha.Concurrency + val Concurrency = org.typelevel.sbt.gha.Concurrency type JobContainer = org.typelevel.sbt.gha.JobContainer val JobContainer = org.typelevel.sbt.gha.JobContainer @@ -172,7 +172,7 @@ object GenerativePlugin extends AutoPlugin { s"(startsWith($target, 'refs/heads/') && endsWith($target, '$name'))" } - def compileConcurrency(concurrency: JobConcurrency): String = + def compileConcurrency(concurrency: Concurrency): String = concurrency.cancelInProgress match { case Some(value) => val fields = s"""group: ${wrap(concurrency.group)} @@ -486,6 +486,7 @@ ${indent(job.steps.map(compileStep(_, sbt, job.sbtStepPreamble, declareShell = d paths: Paths, prEventTypes: List[PREventType], env: Map[String, String], + concurrency: Option[Concurrency], jobs: List[WorkflowJob], sbt: String): String = { @@ -496,6 +497,9 @@ ${indent(job.steps.map(compileStep(_, sbt, job.sbtStepPreamble, declareShell = d else renderedEnvPre + "\n\n" + val renderedConcurrency = + concurrency.map(compileConcurrency).map("\n" + _ + "\n\n").getOrElse("") + val renderedTypesPre = prEventTypes.map(compilePREventType).mkString("[", ", ", "]") val renderedTypes = if (prEventTypes.sortBy(_.toString) == PREventType.Defaults) @@ -534,7 +538,7 @@ on: push: branches: [${branches.map(wrap).mkString(", ")}]$renderedTags$renderedPaths -${renderedEnv}jobs: +${renderedEnv}${renderedConcurrency}jobs: ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} """ } @@ -545,16 +549,16 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} // This is currently set to false because of https://github.com/sbt/sbt/issues/6468. When a new SBT version is // released that fixes this issue then check for that SBT version (or higher) and set to true. githubWorkflowUseSbtThinClient := false, + githubWorkflowConcurrency := Some( + Concurrency( + group = s"$${{ github.workflow }} @ $${{ github.head_ref || github.ref }}", + cancelInProgress = Some(true)) + ), githubWorkflowBuildMatrixFailFast := None, githubWorkflowBuildMatrixAdditions := Map(), githubWorkflowBuildMatrixInclusions := Seq(), githubWorkflowBuildMatrixExclusions := Seq(), githubWorkflowBuildRunsOnExtraLabels := Seq(), - githubWorkflowBuildConcurrency := { - val keys = githubWorkflowBuildMatrixAdditions.value.keys.toList.sorted - val group = MatrixKeys.groupId(keys) - Some(JobConcurrency(s"ci-build-$group-$${{ github.ref }}", cancelInProgress = Some(true))) - }, githubWorkflowBuildTimeoutMinutes := Some(60), githubWorkflowBuildPreamble := Seq(), githubWorkflowBuildPostamble := Seq(), @@ -766,7 +770,6 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} matrixIncs = githubWorkflowBuildMatrixInclusions.value.toList, matrixExcs = githubWorkflowBuildMatrixExclusions.value.toList, runsOnExtraLabels = githubWorkflowBuildRunsOnExtraLabels.value.toList, - concurrency = githubWorkflowBuildConcurrency.value, timeoutMinutes = githubWorkflowBuildTimeoutMinutes.value )) ++ publishJobOpt ++ githubWorkflowAddedJobs.value } @@ -802,6 +805,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowTargetPaths.value, githubWorkflowPREventTypes.value.toList, githubWorkflowEnv.value, + githubWorkflowConcurrency.value, githubWorkflowGeneratedCI.value.toList, sbt.value ) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala index d94805e0..dff116ce 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala @@ -34,5 +34,5 @@ final case class WorkflowJob( runsOnExtraLabels: List[String] = List(), container: Option[JobContainer] = None, environment: Option[JobEnvironment] = None, - concurrency: Option[JobConcurrency] = None, + concurrency: Option[Concurrency] = None, timeoutMinutes: Option[Int] = None) From 61747076d261d3f67952ab356cbc98e7c7039fd5 Mon Sep 17 00:00:00 2001 From: Maksim Ochenashko Date: Wed, 16 Nov 2022 19:07:09 +0200 Subject: [PATCH 88/99] Use ` ${{ github.workflow }} @ ${{ github.ref }}` as a default concurrent group --- .github/workflows/ci.yml | 2 +- docs/gha.md | 2 +- .../src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala | 2 +- .../src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cf7d061..1292b1d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ env: concurrency: - group: ${{ github.workflow }} @ ${{ github.head_ref || github.ref }} + group: ${{ github.workflow }} @ ${{ github.ref }} cancel-in-progress: true jobs: diff --git a/docs/gha.md b/docs/gha.md index 14bdd504..92bcad19 100644 --- a/docs/gha.md +++ b/docs/gha.md @@ -79,7 +79,7 @@ Any and all settings which affect the behavior of the generative plugin should b - `githubWorkflowJobSetup` : `Seq[WorkflowStep]` – The automatically-generated checkout, setup, and cache steps which are common to all jobs which touch the build (default: autogenerated) - `githubWorkflowEnv` : `Map[String, String]` – An environment which is global to the entire **ci.yml** workflow. Defaults to `Map("GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}")` since it's so commonly needed. - `githubWorkflowAddedJobs` : `Seq[WorkflowJob]` – A convenience mechanism for adding extra custom jobs to the **ci.yml** workflow (though you can also do this by modifying `githubWorkflowGeneratedCI`). Defaults to empty. -- `githubWorkflowConcurrency` : `Option[Concurrency]` - Use concurrency to ensure that only a single workflow within the same concurrency group will run at a time. Defaults to `${{ github.workflow }} @ ${{ github.head_ref || github.ref }}`. +- `githubWorkflowConcurrency` : `Option[Concurrency]` - Use concurrency to ensure that only a single workflow within the same concurrency group will run at a time. Defaults to `${{ github.workflow }} @ ${{ github.ref }}`. #### `build` Job diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala index 45254cb3..1e01d310 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativeKeys.scala @@ -41,7 +41,7 @@ trait GenerativeKeys { lazy val githubWorkflowIncludeClean = settingKey[Boolean]("Whether to include the clean.yml file (default: true)") lazy val githubWorkflowConcurrency = settingKey[Option[Concurrency]]( - s"Use concurrency to ensure that only a single workflow within the same concurrency group will run at a time. (default: '$${{ github.workflow }} @ $${{ github.head_ref || github.ref }}')") + s"Use concurrency to ensure that only a single workflow within the same concurrency group will run at a time. (default: '$${{ github.workflow }} @ $${{ github.ref }}')") lazy val githubWorkflowBuildMatrixFailFast = settingKey[Option[Boolean]]( "Whether or not to enable the fail-fast strategy (default: None/Enabled)") diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index c87735f8..885ae799 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -551,7 +551,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} githubWorkflowUseSbtThinClient := false, githubWorkflowConcurrency := Some( Concurrency( - group = s"$${{ github.workflow }} @ $${{ github.head_ref || github.ref }}", + group = s"$${{ github.workflow }} @ $${{ github.ref }}", cancelInProgress = Some(true)) ), githubWorkflowBuildMatrixFailFast := None, From 38eb36e17b4e9defadb1724ab032a1e6eb812142 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 16 Nov 2022 21:00:39 +0000 Subject: [PATCH 89/99] Run `sbt update` on cache miss --- .github/workflows/ci.yml | 28 +++++++++++++++++++ .../org/typelevel/sbt/gha/WorkflowStep.scala | 22 +++++++++++---- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1292b1d2..a0013295 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,7 @@ jobs: java-version: 8 - name: Setup Java (temurin@8) + id: setup-java if: matrix.java == 'temurin@8' uses: actions/setup-java@v3 with: @@ -65,6 +66,7 @@ jobs: java-version: 17 - name: Setup Java (temurin@17) + id: setup-java if: matrix.java == 'temurin@17' uses: actions/setup-java@v3 with: @@ -74,6 +76,7 @@ jobs: cache: sbt - name: Setup GraalVM (graal_latest@17) + id: setup-java if: matrix.java == 'graal_latest@17' uses: graalvm/setup-graalvm@v1 with: @@ -81,6 +84,10 @@ jobs: java-version: 17 cache: sbt + - name: sbt update + if: '!setup-java.cache-hit' + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update + - name: Check that workflows are up to date run: sbt githubWorkflowCheck @@ -144,6 +151,7 @@ jobs: java-version: 8 - name: Setup Java (temurin@8) + id: setup-java if: matrix.java == 'temurin@8' uses: actions/setup-java@v3 with: @@ -161,6 +169,7 @@ jobs: java-version: 17 - name: Setup Java (temurin@17) + id: setup-java if: matrix.java == 'temurin@17' uses: actions/setup-java@v3 with: @@ -170,6 +179,7 @@ jobs: cache: sbt - name: Setup GraalVM (graal_latest@17) + id: setup-java if: matrix.java == 'graal_latest@17' uses: graalvm/setup-graalvm@v1 with: @@ -177,6 +187,10 @@ jobs: java-version: 17 cache: sbt + - name: sbt update + if: '!setup-java.cache-hit' + run: sbt '++${{ matrix.scala }}' reload +update + - name: Download target directories (2.12, sbt-typelevelJVM) uses: actions/download-artifact@v3 with: @@ -235,6 +249,7 @@ jobs: java-version: 8 - name: Setup Java (temurin@8) + id: setup-java if: matrix.java == 'temurin@8' uses: actions/setup-java@v3 with: @@ -252,6 +267,7 @@ jobs: java-version: 17 - name: Setup Java (temurin@17) + id: setup-java if: matrix.java == 'temurin@17' uses: actions/setup-java@v3 with: @@ -261,6 +277,7 @@ jobs: cache: sbt - name: Setup GraalVM (graal_latest@17) + id: setup-java if: matrix.java == 'graal_latest@17' uses: graalvm/setup-graalvm@v1 with: @@ -268,6 +285,10 @@ jobs: java-version: 17 cache: sbt + - name: sbt update + if: '!setup-java.cache-hit' + run: sbt '++${{ matrix.scala }}' reload +update + - name: Submit Dependencies uses: scalacenter/sbt-dependency-submission@v2 @@ -294,6 +315,7 @@ jobs: java-version: 8 - name: Setup Java (temurin@8) + id: setup-java if: matrix.java == 'temurin@8' uses: actions/setup-java@v3 with: @@ -311,6 +333,7 @@ jobs: java-version: 17 - name: Setup Java (temurin@17) + id: setup-java if: matrix.java == 'temurin@17' uses: actions/setup-java@v3 with: @@ -320,6 +343,7 @@ jobs: cache: sbt - name: Setup GraalVM (graal_latest@17) + id: setup-java if: matrix.java == 'graal_latest@17' uses: graalvm/setup-graalvm@v1 with: @@ -327,6 +351,10 @@ jobs: java-version: 17 cache: sbt + - name: sbt update + if: '!setup-java.cache-hit' + run: sbt '++${{ matrix.scala }}' reload +update + - name: Generate site run: sbt '++${{ matrix.scala }}' docs/tlSite diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 987a8ccb..bd20351d 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -41,12 +41,14 @@ object WorkflowStep { UseRef.Public("actions", "checkout", "v3"), name = Some("Checkout current branch (fast)")) - def SetupJava(versions: List[JavaSpec]): List[WorkflowStep] = - versions flatMap { + def SetupJava(versions: List[JavaSpec]): List[WorkflowStep] = { + val setupId = "setup-java" + val downloadSetup = versions flatMap { case jv @ JavaSpec(JavaSpec.Distribution.GraalVM(graalVersion), javaVersion) => WorkflowStep.Use( UseRef.Public("graalvm", "setup-graalvm", "v1"), name = Some(s"Setup GraalVM (${jv.render})"), + id = Some(setupId), cond = Some(s"matrix.java == '${jv.render}'"), params = Map("version" -> graalVersion, "java-version" -> javaVersion, "cache" -> "sbt") @@ -54,23 +56,24 @@ object WorkflowStep { case jv @ JavaSpec(dist, version) if dist.isTlIndexed => val cond = Some(s"matrix.java == '${jv.render}'") - val id = s"download-java-${dist.rendering}-$version" + val downloadId = s"download-java-${dist.rendering}-$version" List( WorkflowStep.Use( UseRef.Public("typelevel", "download-java", "v2"), name = Some(s"Download Java (${jv.render})"), - id = Some(id), + id = Some(downloadId), cond = cond, params = Map("distribution" -> dist.rendering, "java-version" -> version) ), WorkflowStep.Use( UseRef.Public("actions", "setup-java", "v3"), name = Some(s"Setup Java (${jv.render})"), + id = Some(setupId), cond = cond, params = Map( "distribution" -> "jdkfile", "java-version" -> version, - "jdkFile" -> s"$${{ steps.$id.outputs.jdkFile }}", + "jdkFile" -> s"$${{ steps.$downloadId.outputs.jdkFile }}", "cache" -> "sbt" ) ) @@ -80,12 +83,21 @@ object WorkflowStep { WorkflowStep.Use( UseRef.Public("actions", "setup-java", "v3"), name = Some(s"Setup Java (${jv.render})"), + id = Some(setupId), cond = Some(s"matrix.java == '${jv.render}'"), params = Map("distribution" -> dist.rendering, "java-version" -> version, "cache" -> "sbt") ) :: Nil } + downloadSetup ::: WorkflowStep.Sbt( + List("reload", "+update"), + name = Some(s"sbt update"), + cond = Some(s"!${setupId}.cache-hit") + ) :: Nil + + } + val Tmate: WorkflowStep = Use(UseRef.Public("mxschmitt", "action-tmate", "v3"), name = Some("Setup tmate session")) From c07083ce2c6cd33736323e7afd0e7459525da601 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 16 Nov 2022 21:33:46 +0000 Subject: [PATCH 90/99] setup steps need unique ids --- .github/workflows/ci.yml | 64 ++++++++++++++----- .../org/typelevel/sbt/gha/WorkflowStep.scala | 38 ++++++----- 2 files changed, 70 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0013295..cccdaef7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: java-version: 8 - name: Setup Java (temurin@8) - id: setup-java + id: setup-java-temurin-8 if: matrix.java == 'temurin@8' uses: actions/setup-java@v3 with: @@ -57,6 +57,10 @@ jobs: jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} cache: sbt + - name: sbt update + if: matrix.java == 'temurin@8' && !setup-java-temurin-8.cache-hit + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update + - name: Download Java (temurin@17) id: download-java-temurin-17 if: matrix.java == 'temurin@17' @@ -66,7 +70,7 @@ jobs: java-version: 17 - name: Setup Java (temurin@17) - id: setup-java + id: setup-java-temurin-17 if: matrix.java == 'temurin@17' uses: actions/setup-java@v3 with: @@ -75,8 +79,12 @@ jobs: jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} cache: sbt + - name: sbt update + if: matrix.java == 'temurin@17' && !setup-java-temurin-17.cache-hit + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update + - name: Setup GraalVM (graal_latest@17) - id: setup-java + id: setup-graalvm-latest-17 if: matrix.java == 'graal_latest@17' uses: graalvm/setup-graalvm@v1 with: @@ -85,7 +93,7 @@ jobs: cache: sbt - name: sbt update - if: '!setup-java.cache-hit' + if: matrix.java == 'graal_latest@17' && !setup-graalvm-latest-17.cache-hit run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Check that workflows are up to date @@ -151,7 +159,7 @@ jobs: java-version: 8 - name: Setup Java (temurin@8) - id: setup-java + id: setup-java-temurin-8 if: matrix.java == 'temurin@8' uses: actions/setup-java@v3 with: @@ -160,6 +168,10 @@ jobs: jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} cache: sbt + - name: sbt update + if: matrix.java == 'temurin@8' && !setup-java-temurin-8.cache-hit + run: sbt '++${{ matrix.scala }}' reload +update + - name: Download Java (temurin@17) id: download-java-temurin-17 if: matrix.java == 'temurin@17' @@ -169,7 +181,7 @@ jobs: java-version: 17 - name: Setup Java (temurin@17) - id: setup-java + id: setup-java-temurin-17 if: matrix.java == 'temurin@17' uses: actions/setup-java@v3 with: @@ -178,8 +190,12 @@ jobs: jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} cache: sbt + - name: sbt update + if: matrix.java == 'temurin@17' && !setup-java-temurin-17.cache-hit + run: sbt '++${{ matrix.scala }}' reload +update + - name: Setup GraalVM (graal_latest@17) - id: setup-java + id: setup-graalvm-latest-17 if: matrix.java == 'graal_latest@17' uses: graalvm/setup-graalvm@v1 with: @@ -188,7 +204,7 @@ jobs: cache: sbt - name: sbt update - if: '!setup-java.cache-hit' + if: matrix.java == 'graal_latest@17' && !setup-graalvm-latest-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download target directories (2.12, sbt-typelevelJVM) @@ -249,7 +265,7 @@ jobs: java-version: 8 - name: Setup Java (temurin@8) - id: setup-java + id: setup-java-temurin-8 if: matrix.java == 'temurin@8' uses: actions/setup-java@v3 with: @@ -258,6 +274,10 @@ jobs: jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} cache: sbt + - name: sbt update + if: matrix.java == 'temurin@8' && !setup-java-temurin-8.cache-hit + run: sbt '++${{ matrix.scala }}' reload +update + - name: Download Java (temurin@17) id: download-java-temurin-17 if: matrix.java == 'temurin@17' @@ -267,7 +287,7 @@ jobs: java-version: 17 - name: Setup Java (temurin@17) - id: setup-java + id: setup-java-temurin-17 if: matrix.java == 'temurin@17' uses: actions/setup-java@v3 with: @@ -276,8 +296,12 @@ jobs: jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} cache: sbt + - name: sbt update + if: matrix.java == 'temurin@17' && !setup-java-temurin-17.cache-hit + run: sbt '++${{ matrix.scala }}' reload +update + - name: Setup GraalVM (graal_latest@17) - id: setup-java + id: setup-graalvm-latest-17 if: matrix.java == 'graal_latest@17' uses: graalvm/setup-graalvm@v1 with: @@ -286,7 +310,7 @@ jobs: cache: sbt - name: sbt update - if: '!setup-java.cache-hit' + if: matrix.java == 'graal_latest@17' && !setup-graalvm-latest-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Submit Dependencies @@ -315,7 +339,7 @@ jobs: java-version: 8 - name: Setup Java (temurin@8) - id: setup-java + id: setup-java-temurin-8 if: matrix.java == 'temurin@8' uses: actions/setup-java@v3 with: @@ -324,6 +348,10 @@ jobs: jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} cache: sbt + - name: sbt update + if: matrix.java == 'temurin@8' && !setup-java-temurin-8.cache-hit + run: sbt '++${{ matrix.scala }}' reload +update + - name: Download Java (temurin@17) id: download-java-temurin-17 if: matrix.java == 'temurin@17' @@ -333,7 +361,7 @@ jobs: java-version: 17 - name: Setup Java (temurin@17) - id: setup-java + id: setup-java-temurin-17 if: matrix.java == 'temurin@17' uses: actions/setup-java@v3 with: @@ -342,8 +370,12 @@ jobs: jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} cache: sbt + - name: sbt update + if: matrix.java == 'temurin@17' && !setup-java-temurin-17.cache-hit + run: sbt '++${{ matrix.scala }}' reload +update + - name: Setup GraalVM (graal_latest@17) - id: setup-java + id: setup-graalvm-latest-17 if: matrix.java == 'graal_latest@17' uses: graalvm/setup-graalvm@v1 with: @@ -352,7 +384,7 @@ jobs: cache: sbt - name: sbt update - if: '!setup-java.cache-hit' + if: matrix.java == 'graal_latest@17' && !setup-graalvm-latest-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Generate site diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index bd20351d..28b0f778 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -42,60 +42,66 @@ object WorkflowStep { name = Some("Checkout current branch (fast)")) def SetupJava(versions: List[JavaSpec]): List[WorkflowStep] = { - val setupId = "setup-java" - val downloadSetup = versions flatMap { + def sbtUpdateStep(cond: String, setupId: String) = + WorkflowStep.Sbt( + List("reload", "+update"), + name = Some(s"sbt update"), + cond = Some(s"$cond && !${setupId}.cache-hit") + ) + + versions flatMap { case jv @ JavaSpec(JavaSpec.Distribution.GraalVM(graalVersion), javaVersion) => + val setupId = s"setup-graalvm-${graalVersion}-$javaVersion" + val cond = s"matrix.java == '${jv.render}'" WorkflowStep.Use( UseRef.Public("graalvm", "setup-graalvm", "v1"), name = Some(s"Setup GraalVM (${jv.render})"), id = Some(setupId), - cond = Some(s"matrix.java == '${jv.render}'"), + cond = Some(cond), params = Map("version" -> graalVersion, "java-version" -> javaVersion, "cache" -> "sbt") - ) :: Nil + ) :: sbtUpdateStep(cond, setupId) :: Nil case jv @ JavaSpec(dist, version) if dist.isTlIndexed => - val cond = Some(s"matrix.java == '${jv.render}'") + val cond = s"matrix.java == '${jv.render}'" val downloadId = s"download-java-${dist.rendering}-$version" + val setupId = s"setup-java-${dist.rendering}-$version" List( WorkflowStep.Use( UseRef.Public("typelevel", "download-java", "v2"), name = Some(s"Download Java (${jv.render})"), id = Some(downloadId), - cond = cond, + cond = Some(cond), params = Map("distribution" -> dist.rendering, "java-version" -> version) ), WorkflowStep.Use( UseRef.Public("actions", "setup-java", "v3"), name = Some(s"Setup Java (${jv.render})"), id = Some(setupId), - cond = cond, + cond = Some(cond), params = Map( "distribution" -> "jdkfile", "java-version" -> version, "jdkFile" -> s"$${{ steps.$downloadId.outputs.jdkFile }}", "cache" -> "sbt" ) - ) + ), + sbtUpdateStep(cond, setupId) ) case jv @ JavaSpec(dist, version) => + val setupId = s"setup-java-${dist.rendering}-$version" + val cond = s"matrix.java == '${jv.render}'" WorkflowStep.Use( UseRef.Public("actions", "setup-java", "v3"), name = Some(s"Setup Java (${jv.render})"), id = Some(setupId), - cond = Some(s"matrix.java == '${jv.render}'"), + cond = Some(cond), params = Map("distribution" -> dist.rendering, "java-version" -> version, "cache" -> "sbt") - ) :: Nil + ) :: sbtUpdateStep(cond, setupId) :: Nil } - downloadSetup ::: WorkflowStep.Sbt( - List("reload", "+update"), - name = Some(s"sbt update"), - cond = Some(s"!${setupId}.cache-hit") - ) :: Nil - } val Tmate: WorkflowStep = From 49eda274e60259f09b2313ca06fc00cc384ceee5 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 16 Nov 2022 21:37:01 +0000 Subject: [PATCH 91/99] stupid gha yaml --- .github/workflows/ci.yml | 24 +++++++++---------- .../org/typelevel/sbt/gha/WorkflowStep.scala | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cccdaef7..44a5f56f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !setup-java-temurin-8.cache-hit + if: matrix.java == 'temurin@8' && ! ${{ setup-java-temurin-8.cache-hit }} run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -80,7 +80,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !setup-java-temurin-17.cache-hit + if: matrix.java == 'temurin@17' && ! ${{ setup-java-temurin-17.cache-hit }} run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -93,7 +93,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !setup-graalvm-latest-17.cache-hit + if: matrix.java == 'graal_latest@17' && ! ${{ setup-graalvm-latest-17.cache-hit }} run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Check that workflows are up to date @@ -169,7 +169,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !setup-java-temurin-8.cache-hit + if: matrix.java == 'temurin@8' && ! ${{ setup-java-temurin-8.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -191,7 +191,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !setup-java-temurin-17.cache-hit + if: matrix.java == 'temurin@17' && ! ${{ setup-java-temurin-17.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -204,7 +204,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !setup-graalvm-latest-17.cache-hit + if: matrix.java == 'graal_latest@17' && ! ${{ setup-graalvm-latest-17.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Download target directories (2.12, sbt-typelevelJVM) @@ -275,7 +275,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !setup-java-temurin-8.cache-hit + if: matrix.java == 'temurin@8' && ! ${{ setup-java-temurin-8.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -297,7 +297,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !setup-java-temurin-17.cache-hit + if: matrix.java == 'temurin@17' && ! ${{ setup-java-temurin-17.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -310,7 +310,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !setup-graalvm-latest-17.cache-hit + if: matrix.java == 'graal_latest@17' && ! ${{ setup-graalvm-latest-17.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Submit Dependencies @@ -349,7 +349,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !setup-java-temurin-8.cache-hit + if: matrix.java == 'temurin@8' && ! ${{ setup-java-temurin-8.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -371,7 +371,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !setup-java-temurin-17.cache-hit + if: matrix.java == 'temurin@17' && ! ${{ setup-java-temurin-17.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -384,7 +384,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !setup-graalvm-latest-17.cache-hit + if: matrix.java == 'graal_latest@17' && ! ${{ setup-graalvm-latest-17.cache-hit }} run: sbt '++${{ matrix.scala }}' reload +update - name: Generate site diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 28b0f778..11b57136 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -46,7 +46,7 @@ object WorkflowStep { WorkflowStep.Sbt( List("reload", "+update"), name = Some(s"sbt update"), - cond = Some(s"$cond && !${setupId}.cache-hit") + cond = Some(s"$cond && ! $${{ ${setupId}.cache-hit }}") ) versions flatMap { From 4db7922aeeb7302b2dfe8d33fd81d2838459c3de Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 16 Nov 2022 21:38:25 +0000 Subject: [PATCH 92/99] Heh, my bad --- .github/workflows/ci.yml | 24 +++++++++---------- .../org/typelevel/sbt/gha/WorkflowStep.scala | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44a5f56f..c98af825 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && ! ${{ setup-java-temurin-8.cache-hit }} + if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.cache-hit run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -80,7 +80,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && ! ${{ setup-java-temurin-17.cache-hit }} + if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.cache-hit run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -93,7 +93,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && ! ${{ setup-graalvm-latest-17.cache-hit }} + if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.cache-hit run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Check that workflows are up to date @@ -169,7 +169,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && ! ${{ setup-java-temurin-8.cache-hit }} + if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -191,7 +191,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && ! ${{ setup-java-temurin-17.cache-hit }} + if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -204,7 +204,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && ! ${{ setup-graalvm-latest-17.cache-hit }} + if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download target directories (2.12, sbt-typelevelJVM) @@ -275,7 +275,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && ! ${{ setup-java-temurin-8.cache-hit }} + if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -297,7 +297,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && ! ${{ setup-java-temurin-17.cache-hit }} + if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -310,7 +310,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && ! ${{ setup-graalvm-latest-17.cache-hit }} + if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Submit Dependencies @@ -349,7 +349,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && ! ${{ setup-java-temurin-8.cache-hit }} + if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -371,7 +371,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && ! ${{ setup-java-temurin-17.cache-hit }} + if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -384,7 +384,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && ! ${{ setup-graalvm-latest-17.cache-hit }} + if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Generate site diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 11b57136..6bc8155e 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -46,7 +46,7 @@ object WorkflowStep { WorkflowStep.Sbt( List("reload", "+update"), name = Some(s"sbt update"), - cond = Some(s"$cond && ! $${{ ${setupId}.cache-hit }}") + cond = Some(s"$cond && !steps.${setupId}.cache-hit") ) versions flatMap { From 635dddf4ca9af8dc1d5a1deeeb7557bb91dd7590 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 16 Nov 2022 21:43:44 +0000 Subject: [PATCH 93/99] Ok, try `== false` instead --- .github/workflows/ci.yml | 24 +++++++++---------- .../org/typelevel/sbt/gha/WorkflowStep.scala | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c98af825..49a962fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.cache-hit + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == false run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -80,7 +80,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.cache-hit + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == false run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -93,7 +93,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.cache-hit + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == false run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Check that workflows are up to date @@ -169,7 +169,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.cache-hit + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -191,7 +191,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.cache-hit + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -204,7 +204,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.cache-hit + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Download target directories (2.12, sbt-typelevelJVM) @@ -275,7 +275,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.cache-hit + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -297,7 +297,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.cache-hit + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -310,7 +310,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.cache-hit + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Submit Dependencies @@ -349,7 +349,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.cache-hit + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -371,7 +371,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.cache-hit + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -384,7 +384,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.cache-hit + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == false run: sbt '++${{ matrix.scala }}' reload +update - name: Generate site diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 6bc8155e..680b7440 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -46,7 +46,7 @@ object WorkflowStep { WorkflowStep.Sbt( List("reload", "+update"), name = Some(s"sbt update"), - cond = Some(s"$cond && !steps.${setupId}.cache-hit") + cond = Some(s"$cond && steps.${setupId}.cache-hit == false") ) versions flatMap { From 1986d081680ef99c13022cbf1373741bbc328917 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 16 Nov 2022 22:06:46 +0000 Subject: [PATCH 94/99] idk, try the opposite --- .github/workflows/ci.yml | 24 +++++++++---------- .../org/typelevel/sbt/gha/WorkflowStep.scala | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49a962fa..987e4731 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == false + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == true run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -80,7 +80,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == false + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == true run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -93,7 +93,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == false + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == true run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Check that workflows are up to date @@ -169,7 +169,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == false + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -191,7 +191,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == false + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -204,7 +204,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == false + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Download target directories (2.12, sbt-typelevelJVM) @@ -275,7 +275,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == false + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -297,7 +297,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == false + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -310,7 +310,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == false + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Submit Dependencies @@ -349,7 +349,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == false + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -371,7 +371,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == false + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -384,7 +384,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == false + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == true run: sbt '++${{ matrix.scala }}' reload +update - name: Generate site diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 680b7440..9c57b58c 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -46,7 +46,7 @@ object WorkflowStep { WorkflowStep.Sbt( List("reload", "+update"), name = Some(s"sbt update"), - cond = Some(s"$cond && steps.${setupId}.cache-hit == false") + cond = Some(s"$cond && steps.${setupId}.cache-hit == true") ) versions flatMap { From ef7d44f69aaf7cdcf74a387cb9f7cfea190356a8 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 16 Nov 2022 22:16:20 +0000 Subject: [PATCH 95/99] Fixing --- .github/workflows/ci.yml | 24 +++++++++---------- .../org/typelevel/sbt/gha/WorkflowStep.scala | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 987e4731..64d87665 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == true + if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.outputs.cache-hit run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -80,7 +80,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == true + if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.outputs.cache-hit run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -93,7 +93,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == true + if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.outputs.cache-hit run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' reload +update - name: Check that workflows are up to date @@ -169,7 +169,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == true + if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -191,7 +191,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == true + if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -204,7 +204,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == true + if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download target directories (2.12, sbt-typelevelJVM) @@ -275,7 +275,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == true + if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -297,7 +297,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == true + if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -310,7 +310,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == true + if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Submit Dependencies @@ -349,7 +349,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.cache-hit == true + if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -371,7 +371,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.cache-hit == true + if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -384,7 +384,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.cache-hit == true + if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.outputs.cache-hit run: sbt '++${{ matrix.scala }}' reload +update - name: Generate site diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 9c57b58c..b58af7c8 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -46,7 +46,7 @@ object WorkflowStep { WorkflowStep.Sbt( List("reload", "+update"), name = Some(s"sbt update"), - cond = Some(s"$cond && steps.${setupId}.cache-hit == true") + cond = Some(s"$cond && !steps.${setupId}.outputs.cache-hit") ) versions flatMap { From 4176796147b5b1a6507c4a151084fbe5c566b0a8 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 16 Nov 2022 23:26:58 +0000 Subject: [PATCH 96/99] Cache hit outputs as a string --- .github/workflows/ci.yml | 24 +++++++++---------- .../org/typelevel/sbt/gha/WorkflowStep.scala | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d142521..5aec2eb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.outputs.cache-hit + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -80,7 +80,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.outputs.cache-hit + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -93,7 +93,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.outputs.cache-hit + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.outputs.cache-hit == 'false' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' reload +update - name: Check that workflows are up to date @@ -169,7 +169,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.outputs.cache-hit + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -191,7 +191,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.outputs.cache-hit + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -204,7 +204,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.outputs.cache-hit + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Download target directories (2.12, sbt-typelevelJVM) @@ -275,7 +275,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.outputs.cache-hit + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -297,7 +297,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.outputs.cache-hit + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -310,7 +310,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.outputs.cache-hit + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Submit Dependencies @@ -349,7 +349,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@8' && !steps.setup-java-temurin-8.outputs.cache-hit + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Download Java (temurin@17) @@ -371,7 +371,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'temurin@17' && !steps.setup-java-temurin-17.outputs.cache-hit + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Setup GraalVM (graal_latest@17) @@ -384,7 +384,7 @@ jobs: cache: sbt - name: sbt update - if: matrix.java == 'graal_latest@17' && !steps.setup-graalvm-latest-17.outputs.cache-hit + if: matrix.java == 'graal_latest@17' && steps.setup-graalvm-latest-17.outputs.cache-hit == 'false' run: sbt '++ ${{ matrix.scala }}' reload +update - name: Generate site diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index b58af7c8..46b3952a 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -46,7 +46,7 @@ object WorkflowStep { WorkflowStep.Sbt( List("reload", "+update"), name = Some(s"sbt update"), - cond = Some(s"$cond && !steps.${setupId}.outputs.cache-hit") + cond = Some(s"$cond && steps.${setupId}.outputs.cache-hit == 'false'") ) versions flatMap { From b83430d4fb9a676a32b7ea4588685b557298613d Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 17 Nov 2022 09:13:00 -0800 Subject: [PATCH 97/99] Update to sbt-header 5.9.0 --- core/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/build.sbt b/core/build.sbt index 9864c50f..0feebabb 100644 --- a/core/build.sbt +++ b/core/build.sbt @@ -1,3 +1,3 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.5") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") From 96a5c130c33c4ad1b93b4ea5b76cf93ddab6b1bb Mon Sep 17 00:00:00 2001 From: "typelevel-steward[bot]" <106827141+typelevel-steward[bot]@users.noreply.github.com> Date: Thu, 24 Nov 2022 04:29:50 +0000 Subject: [PATCH 98/99] Update sbt-sonatype to 3.9.15 --- sonatype/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonatype/build.sbt b/sonatype/build.sbt index 490e6184..0167ccd2 100644 --- a/sonatype/build.sbt +++ b/sonatype/build.sbt @@ -1,3 +1,3 @@ addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.15") addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") From b65f2e6d7b42b79f72c6ee53f9500862fb6ee30f Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 7 Jan 2023 00:57:46 +0000 Subject: [PATCH 99/99] Remove unused import --- core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala index 2a0f60ce..20e1c892 100644 --- a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala +++ b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala @@ -21,8 +21,6 @@ import org.typelevel.sbt.gha.GenerativePlugin import org.typelevel.sbt.gha.GitHubActionsPlugin import sbt._ -import scala.collection.immutable - import Keys._ /**