Skip to content

Commit

Permalink
Add Ocaml CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kupolak committed Jan 24, 2024
1 parent fb7ce62 commit 9a713fa
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
pull_request:
branches: [main]

workflow_dispatch:

jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ocaml-base-compiler.4.14.1

- name: Install ocamlformat
run: make install-ocamlformat

- name: Format code
run: opam exec -- dune build @fmt

build:
name: Build and test
needs: [fmt]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
ocaml-compiler:
- ocaml-base-compiler.4.14.1
steps:
- uses: actions/checkout@v4

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

- name: Install opam dependencies
run: opam install --deps-only --with-test .

- name: Build project
run: opam exec -- dune build @install

- name: Run tests
run: opam exec -- dune test
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

DUNE = dune

.PHONY: all install test clean uninstall format
.PHONY: all install test clean uninstall format install-ocamlformat

all:
$(DUNE) build
Expand All @@ -31,4 +31,7 @@ utop:
format:
$(DUNE) build --auto-promote @fmt
opam lint --normalise hello.opam > hello.tmp && mv hello.tmp hello.opam
git ls-files '**/*.[ch]' | xargs -n1 indent -nut -i8
git ls-files '**/*.[ch]' | xargs -n1 indent -nut -i8

install-ocamlformat:
opam install -y ocamlformat=0.26.1

0 comments on commit 9a713fa

Please sign in to comment.