• Stars
    star
    196
  • Rank 198,553 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitHub Action for the OCaml programming language

Set up OCaml

Main workflow CodeQL

STATUS: STABLE

Set up an OCaml and opam environment in GitHub Actions and add to PATH.

Usage

Example workflow

Consult the Hello World OCaml Action that uses Dune and opam to build a simple library.

It's possible to feed different values to the input depending on the platform of the runner. The syntax of GitHub's workflows is flexible enough to offer several methods to do this.

name: Main workflow

on:
  pull_request:
  push:
  schedule:
    # Prime the caches every Monday
    - cron: 0 1 * * MON

permissions: read-all

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os:
          - macos-latest
          - ubuntu-latest
          - windows-latest
        ocaml-compiler:
          - "5.0"

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout tree
        uses: actions/checkout@v3

      - name: Set-up OCaml ${{ matrix.ocaml-compiler }}
        uses: ocaml/setup-ocaml@v2
        with:
          ocaml-compiler: ${{ matrix.ocaml-compiler }}

      - run: opam install . --deps-only --with-test

      - run: opam exec -- dune build

      - run: opam exec -- dune runtest

Versioning

The actions are downloaded and run from the GitHub graph of repositories. The workflow references an action using a ref.

Note Binding to a major version is the latest of that major version (e.g. v2 = 2.*)

Major versions should guarantee compatibility. A major version can add net new capabilities but should not break existing input compatibility or break existing workflows.

- name: Set-up OCaml ${{ matrix.ocaml-compiler }}
  uses: ocaml/setup-ocaml@v2
  #                      ^^^
  with:
    ocaml-compiler: ${{ matrix.ocaml-compiler }}

Warning do not reference master since that is the latest code and can be carrying breaking changes of the next major version.

Major version binding allows you to take advantage of bug fixes and critical functionality and security fixes. The master branch has the latest code and is unstable to bind to since changes get committed to the master and released by creating a tag.

steps:
  # Reference the major version of a release (most recommended)
  - uses: ocaml/setup-ocaml@v2
  # Reference a specific commit (most strict)
  - uses: ocaml/setup-ocaml@<SHA>
  # Reference a semver version of a release (not recommended)
  - uses: ocaml/[email protected]
  # Reference a branch (most dangerous - do not do this)
  - uses: ocaml/setup-ocaml@master

Inputs

Name Required Description Type Default
ocaml-compiler Yes The OCaml compiler packages to initialise. Consult the supported version syntax section. string
opam-repositories No The name and URL pair of the repository to fetch the packages from. string
opam-pin No Enable the automation feature for opam pin. bool true
opam-depext No Enable the automation feature for opam depext. bool true
opam-depext-flags No The flags for the opam depext command. The flags must be separated by the comma. string
opam-local-packages No The local packages to be used by opam-pin or opam-depext. Consult the @actions/glob documentation package for supported patterns. string *.opam
opam-disable-sandboxing No Disable the opam sandboxing feature. bool false
dune-cache No Enable the dune cache feature. This feature requires dune 2.8.5 or later on the Windows runners. bool false
cache-prefix No The prefix of the cache keys. string v1

Supported version syntax

The ocaml-compiler input supports the Semantic Versioning Specification, for more detailed examples please refer to the documentation.

Note With the naughty exception of 4.02.2, point releases are meant to be strictly compatible, so once we (OCaml dev team) release a new point release, upgrading should be a no-brainer.

Examples:

  • Exact package name: ocaml-base-compiler.5.0.0, ocaml-variants.4.14.0+mingw64c
  • Combine multiple packages: ocaml-variants.5.0.0+options,ocaml-option-flambda,ocaml-option-musl,ocaml-option-static
  • Minor versions: 4.08, 4.14, 5.0, 5.0.x
  • More specific versions: ~4.02.2, 5.0.0,

Advanced Configurations

Consult the examples page for more complex patterns.

Extends

STATUS: EXPERIMENTAL

Note: All extends are recommended to use in separate jobs run on ubuntu-latest.

Automatically updating the actions with Dependabot

Consult the Configuring Dependabot version updates page and set .github/dependabot.yml as described below to allow Dependabot to update the actions automatically.

version: 2
updates:
  - package-ecosystem: github-actions
    directory: /
    schedule:
      interval: weekly

Note Renovate is also available for free as a third-party tool, which is much more flexible than Dependabot - depending on the project and your preferences. If you just want to automate GitHub Actions updates, Dependabot is good enough.

Roadmap

This action aims to provide an OS-neutral interface to opam, and so will not add features that only work on one operating system. It will also track the latest stable release of opam.

Support

Please feel free to post to the discuss.ocaml.org forum with any questions you have about this action.

Previous discussions include:

More Repositories

1

ocaml

The core OCaml system: compilers, runtime system, base libraries
OCaml
4,732
star
2

dune

A composable build system for OCaml.
OCaml
1,626
star
3

merlin

Context sensitive completion for OCaml in Vim and Emacs
OCaml
1,574
star
4

opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
OCaml
1,225
star
5

ocaml-lsp

OCaml Language Server Protocol implementation
OCaml
766
star
6

opam-repository

Main public package repository for opam, the source package manager of OCaml.
516
star
7

tuareg

Emacs OCaml mode
Emacs Lisp
346
star
8

v2.ocaml.org

Implementation of the ocaml.org website.
HTML
323
star
9

odoc

Documentation compiler for OCaml and Reason
OCaml
320
star
10

ocamlunix

Unix system programming in OCaml book
TeX
276
star
11

Zarith

The Zarith library implements arithmetic and logical operations over arbitrary-precision integers and rational numbers. The implementation, based on GMP, is very efficient.
OCaml
223
star
12

ocaml-re

Pure OCaml regular expressions, with support for Perl and POSIX-style strings
OCaml
208
star
13

ocaml.org

The official OCaml website.
HTML
162
star
14

omd

extensible Markdown library and tool in "pure OCaml"
OCaml
152
star
15

RFCs

Design discussions about the OCaml language
150
star
16

oasis

Cabal like system for OCaml
OCaml
124
star
17

ocamlbuild

The legacy OCamlbuild build manager
OCaml
121
star
18

ocaml-ci-scripts

Skeletons for CI scripts
OCaml
101
star
19

flexdll

a dlopen-like API for Windows
OCaml
100
star
20

vim-ocaml

Vim runtime files for OCaml
Vim Script
85
star
21

v3.ocaml.org-rescript

The next implementation of ocaml.org, built on OCaml, ReScript, NextJS, and Tailwind.
ReScript
75
star
22

graphics

The Graphics library from OCaml, in a standalone repository
C
51
star
23

infrastructure

WIki to hold the information about the machine resources available to OCaml.org
HTML
40
star
24

num

The legacy Num library for arbitrary-precision integer and rational arithmetic that used to be part of the OCaml core distribution
OCaml
35
star
25

MPP-language-blender

MPP: a meta preprocessor that blends programming languages
OCaml
33
star
26

obi

OCaml Build Infrastructure
OCaml
30
star
27

oasis2opam

Tool to convert OASIS metadata to OPAM package descriptions
OCaml
27
star
28

ocamlfind

The OCaml findlib library manager
OCaml
26
star
29

ocaml-logo

Official Logo for OCaml
26
star
30

caml-mode

Emacs mode to edit OCaml files
Emacs Lisp
19
star
31

code-of-conduct

Documents related to the Code of Conduct
17
star
32

ocaml-beta-repository

Opam2 remote for beta versions of the OCaml compiler
Shell
16
star
33

ocaml-manual

OBSOLETE, ARCHIVED mirror of the OCaml manual
TeX
15
star
34

opam-file-format

Parser and printer for the opam file syntax
OCaml
15
star
35

ood

OCaml.org v3 data repository
OCaml
14
star
36

camlp-streams

The Stream and Genlex libraries for use with Camlp4 and Camlp5
OCaml
14
star
37

platform-blog

Repository for the Platform blog
13
star
38

oloop

Evaluate code through the OCaml toploop for inclusion in educational material.
OCaml
12
star
39

dbm

The legacy CamlDBM library for accessing NDBM/GDBM database files
OCaml
12
star
40

ocaml-library-standard

Documenting how OCaml libraries are managed
11
star
41

stdlib-shims

Shim to substitute `Pervasives` with `Stdlib` before 4.08.
Standard ML
10
star
42

dune-www

Website for dune.build
SCSS
10
star
43

0install-tools

Tools for distributing OCaml via 0install
8
star
44

platform-dev

Dev versions of the tools used to build the upcoming platform
Shell
8
star
45

opam.ocaml.org

Scripts and documentation for the opam.ocaml.org website
Shell
7
star
46

oasis-db

Hackage like system for OCaml based on OASIS
OCaml
7
star
47

uchar

Uchar compatibility library
OCaml
6
star
48

stdlib-random

Versioned random number library
OCaml
6
star
49

oasis-website

Devel website for OASIS http://oasis.forge.ocamlcore.org
JavaScript
5
star
50

cwn-data

The data repository for the Caml Weekly News
HTML
5
star
51

ocaml-pr-repository

opam switches for all the proposed pull requests against the compiler
5
star
52

oasis2debian

Convert _oasis to debian/ directory.
OCaml
5
star
53

homebrew-ocaml

A Homebrew tap for OCaml and OPAM distribution
Ruby
5
star
54

ocaml.org-media

Media files that we don't want to include in main ocaml.org repo.
HTML
4
star
55

opam-source-archives

mirror of precious opam repository packages whose source websites have disappeared
Shell
4
star
56

subsystem-meetings

sharing documents for specialized developer meetings
4
star
57

ocaml.org-scripts

Scripts for the ocaml.org infrastructure machines
Shell
2
star
58

ocaml.org-infratest

Tests for ocaml.org websites and services.
Shell
2
star
59

release-readiness

Tracking release readiness for OCaml compiler releases
1
star
60

opam-bulk-logs

Logs of daily OPAM bulk package builds
1
star
61

obi-logs

Logs for OCaml Build Infrastructure
1
star