Skip to content

Derive Windows cache paths and make the package switches exhaustive - #1140

Merged
smorimoto merged 2 commits into
model-opam-setup-planfrom
tidy-platform-branches
Oct 18, 2026
Merged

smorimoto merged 2 commits into
model-opam-setup-planfrom
tidy-platform-branches

Conversation

@smorimoto

@smorimoto smorimoto commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Why

The MSYS2 and Cygwin forms of the _opam cache path were hard-coded as /d/a/<repo>/<repo>/_opam, which matches GitHub-hosted runners only. The Unix package switches also had no case for a new platform, so one would have compiled and silently skipped package installation.

What changed

  • toMsysPath() and toCygwinPath() derive both paths from GITHUB_WORKSPACE, with the conversion that the GnuPG call already used.
  • installUnixSystemPackages() and updateUnixPackageIndexFiles() take a Linux or macOS platform and end each switch with a never check.

Scope

  • Does not handle UNC workspaces. The old code did not handle them either.

Blast radius

On GitHub-hosted runners the cache paths are the same strings as before, so existing Windows cache entries still match.

Verification

  • Expect tests pin both path forms for D:\a\setup-ocaml\setup-ocaml\_opam, and the action tests pass unchanged.
  • Not run on Windows locally. A cache hit in the Windows jobs of this pull request confirms that the cache version is unchanged.

The MSYS2 and Cygwin forms of the _opam path were hard-coded as
/d/a/<repo>/<repo>/_opam, the layout of GitHub-hosted runners only.
Convert the actual workspace path instead, with the conversion the
GnuPG call already used. On GitHub-hosted runners the strings are
unchanged, so existing cache entries still match.
installUnixSystemPackages and updateUnixPackageIndexFiles switched
on PLATFORM with no Windows case and no default, so a platform added
to the union would compile and silently skip package installation.
Take the platform as a parameter narrowed to Linux and macOS, and end
each switch with a never check. The optional apt package lookup is
only reachable on Linux, so drop its platform switch and the guard
for an empty list, which the hard-coded call never passes.
@smorimoto
smorimoto added this pull request to stack #1142 October 18, 2026 15:39
@smorimoto smorimoto changed the title tidy platform branches Derive Windows cache paths and make the package switches exhaustive Oct 18, 2026
@smorimoto smorimoto added the enhancement New feature or request label Oct 18, 2026
@smorimoto
smorimoto merged commit 72a1307 into master Oct 18, 2026
19 checks passed
@smorimoto
smorimoto deleted the tidy-platform-branches branch October 18, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant