From f932e4d7f729396c24330ed4af3dab50dd07e831 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 12 Jun 2022 18:21:40 +0100 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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 }