816 search results for ""
-
OCaml-CI
OCaml-CI
What is OCaml-CI?
OCaml-CI is a continuous integration service specifically designed for OCaml projects hosted on GitHub (and GitLab). It's built on the OCurrent pipeline framework and is hosted at ocaml.ci.dev .
Additional ToolingOCaml-CI
How It Works
This approach makes rebuilds fast because Docker reuses cached steps when opam files haven't changed. Discovers installations of the GitHub app Lists repositories to check for each installation Id
Additional ToolingOCaml-CI
Setting Up OCaml-CI on a Project
Additional ToolingOCaml-CI
Step 1: Install the GitHub App
Add the app to your account by selecting Configure at https://github.com/apps/ocaml-ci , then select the GitHub account or organisation and click Configure .
Additional ToolingOCaml-CI
Step 2: Select Repositories
Select only the repositories you want tested (starting with no more than three please). If you select All Repositories , we won't be able to build anything!
Additional ToolingOCaml-CI
Step 3: Get Approved
You will need to be approved before it will start building anything. This is done by adding yourself to a list by submitting a PR to the ocaml-ci repository, specifically adding yourself to deploy
Additional ToolingOCaml-CI
Step 4: Add a Status Badge (Optional)
Add this to your README:
Additional ToolingOCaml-CI
Project Requirements
OCaml-CI will automatically determine which OCaml versions and platforms to test based on your opam file constraints. Valid .opam files describing your package dependencies A dune-project or du
Additional ToolingOCaml-CI
Testing Locally
This runs a local web interface at http://localhost:8080 showing how your project would be built. You can test how OCaml-CI would build your project locally:
Additional ToolingOCaml-CI
Key Features
Automatic multi-version testing : Tests against multiple OCaml compiler versions Multi-platform support : Tests on different operating systems Smart caching : Docker layer caching makes rebuilds fast
Additional ToolingOCaml-CI
The OCaml-CI CLI
The CLI allows you to interact with OCaml-CI programmatically — checking build status, viewing logs, cancelling or rebuilding jobs.
Additional ToolingOCaml-CI
Requirements
You need a capability file ( ocaml-ci.cap ) which grants access to the API. This file must be provided to you by the OCaml-CI administrators.
Additional ToolingOCaml-CI
Installation & Usage
Or install it as ocaml-ci . You can run it via dune:
Additional ToolingOCaml-CI
Example Commands
cancel - Cancel a running build rebuild - Trigger a rebuild status - Check build status Other actions: View the build log (follows if still running): List build variants for a specific ref:
Additional ToolingOCaml-CI
Shorthand Syntax
Example: You can omit refs/ from references (e.g., heads/master instead of refs/heads/master ) For PRs, you can omit /head (e.g., pull/867 instead of refs/pull/867/head ) For commits, pro
Additional ToolingOCaml-CI
Further Reading
OCaml-CI Getting Started — a brief walkthrough of the basic setup steps. OCaml-CI README — the most comprehensive reference, covering how the pipeline works, installation, setup, CLI usage, and
Additional ToolingFormatting Your Code With OCamlFormat
Creating Libraries to Structure a Project with Dune
Bootstrapping a Project with Dune
Bootstrapping a Project with Dune
More Comprehensive Scaffolding
spin drom carcass If you're looking for project templates that include more than the basics, there are other community projects that offer more comprehensive project scaffolding:
ProjectsPublishing a Package with Dune
Managing Dependencies With opam
Managing Dependencies With opam
Installing Existing Dependencies
Or if you set your environment with eval $(opam env) : Once the dependencies have been installed successfully, and assuming the project uses Dune as the build system, you can compile it with:
ProjectsManaging Dependencies With opam
Adding Dependencies From the opam Repository
However, opam remains a central piece of the ecosystem, and it's very likely that you will have to work with *.opam files at some point, so we don't take a stance on whether you should specify yo
ProjectsManaging Dependencies With opam
Adding a Dependency to Your dune-project File
Once you have added your dependency, you can build your project with dune build which will regenerate the *.opam files. If the project generates the opam file from the dune-project (you can
ProjectsManaging Dependencies With opam
Adding a Dependency to Your .opam File
Either way, once you have added your dependency in the appropriate file, you can run opam install . --deps-only to update your current switch dependencies. If the *.opam files are not generate
ProjectsManaging Dependencies With opam
Installing a Package Directly
This is handy for trying out a library, but for project work you should declare the dependency in your dune-project or *.opam file (as described above) so that collaborators and CI can reproduce
ProjectsManaging Dependencies With opam
Adding Dependencies From a Git Repository
Sometimes, you may want to install a package directly from a Git repository, e.g., when it is not available on the opam repository or when you want to use an unreleased version.
ProjectsManaging Dependencies With opam
Adding a Git Dependency to a dune-project File
to install the new dependency you added. Then, run Next, regenerate the .opam file of your project by running For example, if your project's opam file is my_project.opam , create my_projec
ProjectsManaging Dependencies With opam
Adding a Git Dependency to Your .opam File
Finally, use opam install to install the dependencies, including the one specified in the pin-depends field. Add the pin-depends field in the opam file if it doesn't exist. Inside this fie
ProjectsManaging Dependencies With opam
Installing a Git Dependency in Your Switch
You can install a package in your active switch directly from a Git URL:
ProjectsManaging Dependencies With opam
Dependency Categories
See opam documentation for more details on the opam syntax. In *.opam files: In dune-project , flags look like this: Normal (no flag): used at runtime Build ( build ): used only to buil
ProjectsUsing OCaml with GitHub Actions
Using OCaml with GitHub Actions
setup-ocaml
setup-ocaml is an action that provides an OS-neutral interface to opam , and so will not add features that only work on one operating system. It is the de-facto standard for OCaml CI workflows. I
Additional ToolingUsing OCaml with GitHub Actions
Basic Usage
Create .github/workflows/ci.yml :
Additional ToolingUsing OCaml with GitHub Actions
Built-in Linting Extensions
Check documentation builds Lint opam package files Check source code formatting The action includes several linting sub-actions:
Additional ToolingUsing OCaml with GitHub Actions
Key Features
| Feature | Input | Description | |---------|-------|-------------| | Compiler version | ocaml-compiler: 5.2 | Supports semver syntax | | Compiler variants | ocaml-compiler: ocaml-variants.5
Additional ToolingUsing OCaml with GitHub Actions
Cross-Platform Support
Works on Linux, macOS, and Windows with the same workflow file. The action handles platform-specific opam setup automatically.
Additional ToolingUsing OCaml with GitHub Actions
OCaml-CI vs GitHub Actions
Many projects use both: OCaml-CI for comprehensive automated testing, and GitHub Actions for quick feedback and Windows support. | Aspect | OCaml-CI | GitHub Actions + setup-ocaml | |--------|--
Additional ToolingRunning Commands in an opam Switch
Running Commands in an opam Switch
Using opam env
This command evaluates the output of opam env and sets the necessary environment variables for the currently active switch. After running this command, you'll have access to the packages installed in
ProjectsRunning Commands in an opam Switch
Using opam exec
This will launch the version of the OCaml REPL within the context of the current opam switch. Example: Replace <command> with the actual command you want to run. This ensures that the command is
ProjectsRunning Commands in an opam Switch
Using direnv
Install direnv Ensure direnv is installed on your system. You can install it using a package manager or follow the instructions on the official website. Setup direnv integration Add the follo
ProjectsInstalling a Specific OCaml Compiler Version
OCaml Docker Images
OCaml Docker Images
Docker Hub Repository: ocaml/opam
Note: The older repositories ocaml/opam2 , ocaml/opam2-staging , ocurrent/opam , and ocaml/ocaml are no longer updated . Use ocaml/opam for the latest images. The official OCaml Docker imag
Additional ToolingOCaml Docker Images
What's Inside Each Image
/Dockerfile.opam - the first stage installing the opam binary /Dockerfile.ocaml - builds on the first stage by installing a particular opam switch Each image also includes two Dockerfiles showing h
Additional ToolingOCaml Docker Images
Tag Format
The latest tag is the latest release of OCaml running on the latest version of Debian (Debian is used as it has the widest architecture support for OCaml). Images are tagged with distribution an
Additional ToolingOCaml Docker Images
Supported Distributions
Debian (various versions) Ubuntu (including ubuntu-lts for latest LTS) Alpine Fedora openSUSE Arch Linux (rolling release, just archlinux tag) Windows : windows-mingw-* (MinGW-w64) and wind
Additional Tooling