Conversation
tc.find only matches semver versions, so it never finds Erlang/OTP, which we cache as e.g. ubuntu-24.04/OTP-27.2. Look up the path that tc.cacheDir writes instead, and keep downloading branch builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
setup-beam caches Erlang/OTP in the runner tool cache, but never finds it there again. Every run downloads OTP, also on self-hosted runners with a persistent tool cache.
Before
Two setup-beam steps in one job (
erlef/setup-beam@v1.24.1,ubuntu-24.04, step debug logging on):The second step, although
$RUNNER_TOOL_CACHE/otp/ubuntu-24.04/OTP-29.1.1/x64.completeexists:The second step took 9.7 s.
Problem
installToollooks up the cache withtc.find, which only accepts semver versions.<os>/<version>, e.g.ubuntu-24.04/OTP-29.1.1, which is not semver. So the lookup never matches, on any OS.After
installToolnow looks up the same path thattc.cacheDirandtc.cacheFilewrite:The same job with this branch, second step:
The second step took 0.59 s.
Details
Cause.
src/setup-beam.js:installbuildsversionSpecas`${osVersion}/${toolVersion}`for OTP.tc.cacheDirstores it as-is, becausesemver.cleanfails.tc.findcallsisExplicitVersion, which fails, then searchesfindAllVersions('otp'), which only lists semver folder names. The folder there isubuntu-24.04, so it returns''.Design.
tc.cacheDir(semver.clean(version) || version, thenos.arch()), and checks the directory and its.completemarker, astc.finddoes. Existing cache entries stay valid, and Elixir, Gleam, and rebar3 resolve to the same path as before.main,master,maint,maint-27,nightly) change over time.tc.findnever matched them before, so they were always downloaded again. The new lookup keeps that behavior withisKnownVerBranch, so a persistent cache does not serve an old build.RUNNER_TEMPand runspostExtract(Install -minimal, or the Windows installer), as before.Tests.
.findInToolCache(_)caches entries with the realtc.cacheDirand checks that the lookup finds an OTP entry (ubuntu-24.04/OTP-27.2) and an Elixir entry (v1.18.4-otp-27), skips a cached branch build (ubuntu-24.04/maint-27), and returns''for a version that is not cached. It fails onmainand passes with this change.Checks.
npm run build-dist(build, format, lint): clean,dist/index.jsrebuilt.ubuntu,macos,windows, andhexpm-mirrorspass, andnpm testpasses on macOS and Windows. On Ubuntu, one test fails:.getOTPVersion(_) - Elixirexpectsv1.18.4-otp-27for1.18.x, but the live builds.hex.pm list hasv1.18.5-otp-27since 2026-08-28. The failure is not caused by this change.This change is independent of #494, which changes the
RUNNER_TEMPinstall path in the same function.