Skip to content

Commit

Permalink
add ocamlformat github action
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed Jul 2, 2024
1 parent 8ebfa04 commit 6c28363
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ocamlformat

on: [push, pull_request]

jobs:
format:
name: ocamlformat

strategy:
fail-fast: false
matrix:
ocaml-version: ["4.14.2"]
operating-system: [ubuntu-latest]

runs-on: ${{ matrix.operating-system }}

steps:
- name: Checkout code
uses: actions/checkout@v2

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

- name: Install ocamlformat
run: grep version .ocamlformat | cut -d '=' -f 2 | xargs -I V opam install ocamlformat=V

- name: Format code
run: |
find . -name \*\.ml -maxdepth 1 | xargs opam exec -- ocamlformat --inplace
git diff --quiet
3 changes: 3 additions & 0 deletions .ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version = 0.26.2
profile = conventional
parse-docstrings = true

0 comments on commit 6c28363

Please sign in to comment.