-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,53 +5,86 @@ on: | |
- pull_request | ||
|
||
jobs: | ||
|
||
lint-fmt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use OCaml 5.1 | ||
uses: ocaml/setup-ocaml@v2 | ||
- name: Use OCaml 5.2 | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: 5.1 | ||
ocaml-compiler: 5.2 | ||
dune-cache: true | ||
opam-depext-flags: "--with-doc" | ||
allow-prerelease-opam: true | ||
|
||
- name: Lint fmt | ||
uses: ocaml/setup-ocaml/lint-fmt@v2 | ||
uses: ocaml/setup-ocaml/lint-fmt@v3 | ||
|
||
# auto fix formatting, Thanks to robur.coop for the implementation | ||
# https://discuss.ocaml.org/t/ocamlformat-and-github-actions/15464 | ||
lint-auto-fmt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use OCaml 5.2 | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: 5.2 | ||
dune-cache: true | ||
allow-prerelease-opam: true | ||
|
||
- name: Install ocamlformat | ||
run: grep '^version' .ocamlformat | cut -d '=' -f 2 | xargs -I V opam install ocamlformat=V | ||
|
||
- name: Format code | ||
run: | | ||
git ls-files '*.ml' '*.mli' | xargs opam exec -- ocamlformat --inplace | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | ||
|
||
- name: Commit and push changes | ||
if: ${{ steps.git-check.outputs.modified == 'true' }} | ||
run: | | ||
git config --global user.name "Automated ocamlformat GitHub action, developed by robur.coop" | ||
git config --global user.email "[email protected]" | ||
git add -A | ||
git commit -m "formatted code" | ||
git push | ||
lint-opam: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use OCaml 5.1 | ||
uses: ocaml/setup-ocaml@v2 | ||
- name: Use OCaml 5.2 | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: 5.1 | ||
ocaml-compiler: 5.2 | ||
dune-cache: true | ||
opam-depext-flags: "--with-doc" | ||
allow-prerelease-opam: true | ||
|
||
- name: Lint opam | ||
uses: ocaml/setup-ocaml/lint-opam@v2 | ||
uses: ocaml/setup-ocaml/lint-opam@v3 | ||
|
||
lint-doc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use OCaml 5.1 | ||
uses: ocaml/setup-ocaml@v2 | ||
- name: Use OCaml 5.2 | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: 5.1 | ||
ocaml-compiler: 5.2 | ||
dune-cache: true | ||
opam-depext-flags: "--with-doc" | ||
allow-prerelease-opam: true | ||
|
||
- name: Lint doc | ||
uses: ocaml/setup-ocaml/lint-doc@v2 | ||
uses: ocaml/setup-ocaml/lint-doc@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters