ocaml/Set up OCaml

Set up an OCaml and opam environment and add to PATH

View on GitHub

Trust Signals

Scorecard Score
Scorecard 6–8scored Dec 22, 2024
Maintenance Recency
Activelast commit Jun 22, 2026
License
MIT

Pinned Snippet

workflow.ymlSHA-pinned
uses: ocaml/setup-ocaml@e32b06a3e831ff2fbc6f08cf35be2085e3918014 # v3.6.1

tags can be moved; commit SHAs can't. why a SHA?

namedescriptionrequireddefault
ocaml-compilerThe OCaml compiler packages to initialise. Accepts a semver version range (e.g. "5.3", "4.14.x") which is resolved to the latest matching version from opam-repository, or a full opam package name (e.g. "ocaml-variants.5.3.0+options,ocaml-option-flambda").yes
opam-repositoriesA YAML mapping of opam repository name/URL pairs to use. Repositories listed first take priority over later ones. The default is the official opam-repository. Set this to add custom or overlay repositories (e.g. "custom: https://my-repo.example.com").nodefault: git+https://github.com/ocaml/opam-repository.git
opam-pinAutomatically pin local opam packages (matched by "opam-local-packages") in the opam switch. Set to "false" to skip pinning.notrue
opam-local-packagesA glob pattern matching the local .opam files to be pinned when "opam-pin" is enabled. The default "*.opam" matches all .opam files in the repository root.no*.opam
opam-disable-sandboxingDisable the opam sandboxing feature. opam uses Bubblewrap on Linux and sandbox-exec on macOS. This is useful for self-hosted runners where the sandbox tool is not available. On Windows, sandboxing is always disabled regardless of this setting.nofalse
dune-cacheEnable Dune build caching via GitHub Actions cache. When enabled, the Dune cache directory is saved and restored between workflow runs to speed up incremental builds.nofalse
cache-prefixThe prefix used for all cache keys. Change this value to force a cache invalidation when the cache becomes corrupted or stale.nov3
windows-compilerThe C compiler toolchain used for building on Windows. Use "mingw" (default) for mingw-w64 (GCC), or "msvc" for the Microsoft Visual C compiler. MSVC requires Visual Studio on the runner (pre-installed on GitHub-hosted runners).nomingw
windows-environmentThe Unix environment used for building on Windows. Use "cygwin" (default) for opam's internal Cygwin, or "msys2" to use the pre-installed MSYS2 on GitHub-hosted runners.nocygwin
allow-prerelease-opamAllow the use of a pre-release version of opam. Set to "true" to opt in to pre-release builds when available. Has no effect when no pre-release version is available.nofalse
github-tokenGitHub token used internally to query opam-repository for available compiler versions. The default token is sufficient for most use cases. DO NOT SET THIS unless you need to use a custom token.no${{ github.token }}

no outputs