ocaml/Set up OCaml
Set up an OCaml and opam environment and add to PATH
View on GitHubTrust Signals
- Scorecard Score
- Scorecard 6–8scored Dec 22, 2024
- Maintenance Recency
- Activelast commit Jun 22, 2026
- License
- MIT
Pinned Snippet
uses: ocaml/setup-ocaml@e32b06a3e831ff2fbc6f08cf35be2085e3918014 # v3.6.1tags can be moved; commit SHAs can't. why a SHA?
Inputs
| name | description | required | default |
|---|---|---|---|
| ocaml-compiler | The 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-repositories | A 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"). | no | default: git+https://github.com/ocaml/opam-repository.git |
| opam-pin | Automatically pin local opam packages (matched by "opam-local-packages") in the opam switch. Set to "false" to skip pinning. | no | true |
| opam-local-packages | A 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-sandboxing | Disable 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. | no | false |
| dune-cache | Enable 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. | no | false |
| cache-prefix | The prefix used for all cache keys. Change this value to force a cache invalidation when the cache becomes corrupted or stale. | no | v3 |
| windows-compiler | The 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). | no | mingw |
| windows-environment | The 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. | no | cygwin |
| allow-prerelease-opam | Allow 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. | no | false |
| github-token | GitHub 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 }} |
Outputs
no outputs