Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions .github/workflows/scala-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ jobs:
permissions:
contents: read
pull-requests: write
env:
SBT_LAUNCHER_VERSION: 2.0.12
SBT_LAUNCHER_SHA256: 73f9c4a10584cde3d37d773e2b38d2fc4348c6cef8d88da8b7dd41e7d5f614d7
defaults:
run:
shell: bash
Expand Down Expand Up @@ -250,8 +253,53 @@ jobs:
restore-keys: |
${{ runner.os }}-sbt-

- name: Setup sbt
uses: sbt/setup-sbt@b113b960ba361e87e08ce02a390d51871b7ee459 # v1.5.13
- name: Restore sbt launcher
id: sbt-launcher-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/sbt-launcher
key: sbt-launcher-${{ runner.os }}-${{ runner.arch }}-${{ env.SBT_LAUNCHER_VERSION }}

- name: Download sbt launcher
if: steps.sbt-launcher-cache.outputs.cache-hit != 'true'
run: |
set -euo pipefail
archive="$RUNNER_TEMP/sbt-${SBT_LAUNCHER_VERSION}.zip"
curl --fail --location --silent --show-error \
--connect-timeout 15 --max-time 180 \
--output "$archive" \
"https://github.com/sbt/sbt/releases/download/v${SBT_LAUNCHER_VERSION}/sbt-${SBT_LAUNCHER_VERSION}.zip"
if command -v sha256sum >/dev/null 2>&1; then
actual=$(sha256sum "$archive" | cut -d ' ' -f 1)
else
actual=$(shasum -a 256 "$archive" | cut -d ' ' -f 1)
fi
if [ "$actual" != "$SBT_LAUNCHER_SHA256" ]; then
echo "::error::sbt-${SBT_LAUNCHER_VERSION}.zip SHA-256 is ${actual}, expected ${SBT_LAUNCHER_SHA256}"
exit 1
fi
rm -rf "$HOME/.cache/sbt-launcher"
mkdir -p "$HOME/.cache/sbt-launcher"
unzip -q "$archive" -d "$HOME/.cache/sbt-launcher"
test -f "$HOME/.cache/sbt-launcher/sbt/bin/sbt"

- name: Save sbt launcher
if: steps.sbt-launcher-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/sbt-launcher
key: sbt-launcher-${{ runner.os }}-${{ runner.arch }}-${{ env.SBT_LAUNCHER_VERSION }}

- name: Add sbt launcher to PATH
run: |
set -euo pipefail
launcher_bin="$HOME/.cache/sbt-launcher/sbt/bin"
test -f "$launcher_bin/sbt"
if [ "$RUNNER_OS" = "Windows" ]; then
cygpath -w "$launcher_bin" >> "$GITHUB_PATH"
else
echo "$launcher_bin" >> "$GITHUB_PATH"
fi

- name: Build, test, coverage report
env:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- `scala-ci.yaml` no longer fetches sbt on every run on ephemeral runners. It replaces `sbt/setup-sbt`, whose caches are keyed on `$RUNNER_TOOL_CACHE` (a path that differs per job on ephemeral runners, so they never hit) and whose cache miss bootstraps `ampel` from GitHub releases, where the provenance fetch could time out and fail the job. It now restores the sbt launcher from `actions/cache` at the fixed path `~/.cache/sbt-launcher`, keyed on runner OS, architecture and launcher version, and on a miss downloads `sbt-2.0.12.zip` from the sbt GitHub release with `curl --fail --location` and connect and total timeouts, checks it against a pinned SHA-256 (the job fails on a mismatch, on every runner OS, where `setup-sbt` verified the signature on Linux only), unpacks it and saves the cache. The launcher is still 2.0.12 and the sbt version a build runs is still controlled by `project/build.properties`. No input, output or secret changes. `setup-sbt`'s sbt 2.x disk cache (`~/.cache/sbt`) is no longer restored; builds on sbt 1.x never used it, and the existing `Cache sbt` step is unchanged.

## [2.8.0] - 2026-11-02

### Changed
Expand Down
Loading