From a81571b0e1a943151e561a50d2e456fd43797dbe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 07:17:20 +0000 Subject: [PATCH 1/2] Add disk cache --- action.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/action.yml b/action.yml index d096610..95d508c 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,10 @@ inputs: description: "The runner version (The actual version is controlled via project/build.properties)" required: true default: 1.12.11 + disk-cache: + description: "Enable sbt 2.x disk cache" + required: false + default: true runs: using: "composite" steps: @@ -62,11 +66,18 @@ runs: if [[ "$RUNNER_OS" == "Windows" ]]; then echo "sbt_toolpath=$RUNNER_TOOL_CACHE\\sbt\\$SBT_RUNNER_VERSION" >> "$GITHUB_OUTPUT" echo "sbt_downloadpath=$RUNNER_TEMP\\_sbt" >> "$GITHUB_OUTPUT" + echo "sbt_diskcache=$HOME\\AppData\\Local\\sbt" >> "$GITHUB_OUTPUT" + elif [[ "$RUNNER_OS" == "macOS" ]]; then + echo "sbt_toolpath=$RUNNER_TOOL_CACHE/sbt/$SBT_RUNNER_VERSION" >> "$GITHUB_OUTPUT" + echo "sbt_downloadpath=$RUNNER_TEMP/_sbt" >> "$GITHUB_OUTPUT" + echo "sbt_diskcache=$HOME/Library/Caches/sbt" >> "$GITHUB_OUTPUT" else echo "sbt_toolpath=$RUNNER_TOOL_CACHE/sbt/$SBT_RUNNER_VERSION" >> "$GITHUB_OUTPUT" echo "sbt_downloadpath=$RUNNER_TEMP/_sbt" >> "$GITHUB_OUTPUT" + echo "sbt_diskcache=$HOME/.cache/sbt" >> "$GITHUB_OUTPUT" fi echo "sbt_cachekey=$RUNNER_OS-sbt-$SBT_RUNNER_VERSION-$SBT_CACHE_KEY_VERSION" >> "$GITHUB_OUTPUT" + echo "sbt_diskcachekey=$RUNNER_OS-sbt-diskcache-$SBT_CACHE_KEY_VERSION" >> "$GITHUB_OUTPUT" - name: Check Tool Cache id: cache-tool-dir shell: bash @@ -86,6 +97,13 @@ runs: with: path: ${{ steps.cache-paths.outputs.sbt_toolpath }} key: ${{ steps.cache-paths.outputs.sbt_cachekey }} + - name: sbt 2.x disk cache + id: disk-cache + if: inputs.disk-cache == 'true' + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ${{ steps.cache-paths.outputs.sbt_diskcache }} + key: ${{ steps.cache-paths.outputs.sbt_diskcachekey }} - name: "Download and Install sbt" shell: bash env: From 0f9304c77221905d64cea74916dca90743e8d46e Mon Sep 17 00:00:00 2001 From: Raj-StepSecurity Date: Mon, 29 Jun 2026 14:06:47 +0530 Subject: [PATCH 2/2] conflicted commits cherry-picked --- .github/workflows/ci.yml | 15 ++++++++++++- README.md | 25 +++++++++++++++++----- action.yml | 4 ++-- example/build.sbt | 3 +++ example/project/build.properties | 1 + example/src/test/scala/example/ATest.scala | 9 ++++++++ 6 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 example/build.sbt create mode 100644 example/project/build.properties create mode 100644 example/src/test/scala/example/ATest.scala diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99a4b21..59fcdfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,12 @@ jobs: - os: ubuntu-22.04 java: 17 distribution: temurin + - os: macos-14 + java: 17 + distribution: zulu + - os: windows-2022 + java: 17 + distribution: temurin runs-on: ${{ matrix.os }} env: JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 @@ -32,6 +38,13 @@ jobs: java-version: ${{ matrix.java }} cache: sbt - uses: ./ - - name: Build and test + - name: Build and test root shell: bash run: sbt -v +test + - name: Build and test sbt 2 + shell: bash + run: | + pushd example + sbt -v test + sbt -v test + popd diff --git a/README.md b/README.md index 6cf3f55..2eb2baf 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,10 @@ steps: ### Setting the runner version -The `sbt` runner (Bash script that launches sbt) is typically compatible with all modern sbt releases, -you might want to pin the runner to a specific version. +The `sbt` runner is typically compatible with all modern sbt releases. +However, the launcher distributed by sbt 2.x will require JDK 17. + +You can pin the `sbt` runner back to sbt 1.x to run JDK 8: ```yaml env: @@ -42,12 +44,25 @@ steps: - name: Setup JDK uses: actions/setup-java@v5 with: - distribution: temurin - java-version: 17 + distribution: zulu + java-version: 8 cache: sbt - uses: step-security/setup-sbt@v1 with: - sbt-runner-version: 1.9.9 + sbt-runner-version: 1.12.11 +- name: Build and test + shell: bash + run: sbt -v +test +``` + +### Opting out of disk cache + +By default setup-sbt enables the disk cache on sbt 2.x. This can be opted out as follows: + +```yaml +- uses: step-security/setup-sbt@v1 + with: + disk-cache: false - name: Build and test shell: bash run: sbt -v +test diff --git a/action.yml b/action.yml index 95d508c..0b110bd 100644 --- a/action.yml +++ b/action.yml @@ -120,7 +120,7 @@ runs: cd "$SBT_DOWNLOADPATH" unzip -o "sbt-$SBT_RUNNER_VERSION.zip" -d "$SBT_TOOLPATH" - + - name: "Verify the sbt distribution signature" id: "ampel-verify" # Skip on Windows/macOS until go-billy path fix lands: https://github.com/go-git/go-billy/issues/194 @@ -128,7 +128,7 @@ runs: env: SBT_RUNNER_VERSION: ${{ inputs.sbt-runner-version }} SBT_DOWNLOADPATH: "${{ steps.cache-paths.outputs.sbt_downloadpath }}" - uses: step-security/carabiner-dev-actions/ampel/verify@a4c7cda4c13b389e6747e7dfcaac9f599c7541db # v1.1.7 + uses: step-security/carabiner-dev-actions/ampel/verify@0fd42d7efbb2b2c90458cc03add003600e3cd999 # v1.2.1 with: policy: "git+https://github.com/carabiner-dev/policies#signature/signature.json" subject: "${{ steps.cache-paths.outputs.sbt_downloadpath }}/sbt-${{ inputs.sbt-runner-version }}.zip" diff --git a/example/build.sbt b/example/build.sbt new file mode 100644 index 0000000..f5ad360 --- /dev/null +++ b/example/build.sbt @@ -0,0 +1,3 @@ +scalaVersion := "3.8.3" +val munit = "org.scalameta" %% "munit" % "1.0.4" +libraryDependencies += munit % Test diff --git a/example/project/build.properties b/example/project/build.properties new file mode 100644 index 0000000..8e5bca2 --- /dev/null +++ b/example/project/build.properties @@ -0,0 +1 @@ +sbt.version=2.0.0-RC13 diff --git a/example/src/test/scala/example/ATest.scala b/example/src/test/scala/example/ATest.scala new file mode 100644 index 0000000..6719db8 --- /dev/null +++ b/example/src/test/scala/example/ATest.scala @@ -0,0 +1,9 @@ +package example + +import munit.* + +// a +class ATest extends FunSuite: + test("sum"): + assert(1 + 1 == 2) +end ATest