diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 867690f1..ebf0e9ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,7 @@ jobs: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + cache: sbt - name: Download Java (temurin@17) id: download-java-temurin-17 @@ -64,18 +65,7 @@ jobs: 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') }} + cache: sbt - name: Check that workflows are up to date run: sbt githubWorkflowCheck @@ -145,6 +135,7 @@ jobs: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + cache: sbt - name: Download Java (temurin@17) id: download-java-temurin-17 @@ -161,18 +152,7 @@ jobs: 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') }} + cache: sbt - name: Download target directories (2.12.17, sbt-typelevelJVM) uses: actions/download-artifact@v3 @@ -238,6 +218,7 @@ jobs: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + cache: sbt - name: Download Java (temurin@17) id: download-java-temurin-17 @@ -254,18 +235,7 @@ jobs: 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') }} + cache: sbt - name: Submit Dependencies uses: scalacenter/sbt-dependency-submission@v2 @@ -299,6 +269,7 @@ jobs: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + cache: sbt - name: Download Java (temurin@17) id: download-java-temurin-17 @@ -315,18 +286,7 @@ jobs: 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') }} + cache: sbt - name: Generate site run: sbt '++${{ matrix.scala }}' docs/tlSite 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 a95182e0..0d259410 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 @@ -654,29 +654,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 243f6d62..72f1e52b 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 @@ -67,7 +67,8 @@ object WorkflowStep { params = Map( "distribution" -> "jdkfile", "java-version" -> version, - "jdkFile" -> s"$${{ steps.$id.outputs.jdkFile }}" + "jdkFile" -> s"$${{ steps.$id.outputs.jdkFile }}", + "cache" -> "sbt" ) ) ) @@ -77,7 +78,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) + params = + Map("distribution" -> dist.rendering, "java-version" -> version, "cache" -> "sbt") ) :: Nil }