review changes #1162
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
name: Linter | |
on: [push,pull_request] | |
env: | |
OCAML_DEFAULT_VERSION: 4.14.2 | |
# Add OPAMYES=true to the environment, this is usefill to replace `-y` option | |
# in any opam call | |
OPAMYES: true | |
jobs: | |
check_indentation: | |
# Check that all `.ml` and `.mli` file are correctly indent with ocp-indent | |
name: Check indentation | |
strategy: | |
matrix: | |
ocp-indent-version: | |
# Fixed ocp-indent version. A PR with updated indented code is needed | |
# if this version is changed | |
- 1.8.1 | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code of the current branch | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Get an OCaml environment with opam installed and the proper ocaml version | |
# opam will used opam cache environment if retrieved | |
- name: Use OCaml ${{ env.OCAML_DEFAULT_VERSION }} | |
uses: ocaml/setup-ocaml@v3 | |
with: | |
ocaml-compiler: ${{ env.OCAML_DEFAULT_VERSION }} | |
dune-cache: true | |
# Install ocp-indent with the fixed version | |
# Do nothing if ocp-indent is already installed | |
- name: Install ocp-indent ${{ matrix.ocp-indent-version }} | |
run: opam install ocp-indent.${{ matrix.ocp-indent-version }} | |
# Run indentation script, this script returns exit code 1 if some files | |
# are not well indented | |
- name: Run check_indentation.sh script | |
run: opam exec -- rsc/extra/check_indentation.sh | |
check_style: | |
# Check that all `.ml` and `.mli` files don't have line longer than | |
# 80 characters | |
name: Check style | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code of the current branch | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Get an OCaml environment with opam installed and the proper ocaml version | |
# opam will used opam cache environment if retrieved | |
- name: Use OCaml ${{ env.OCAML_DEFAULT_VERSION }} | |
uses: ocaml/setup-ocaml@v3 | |
with: | |
ocaml-compiler: ${{ env.OCAML_DEFAULT_VERSION }} | |
dune-cache: true | |
# Install dependencies of the ocpchecker executable | |
# Dune and stdlib-shims is needed to build the executable | |
# Since this executable has no opam file we need to manually add | |
# dependencies here | |
- name: opam install ocpchecker deps | |
run: opam install dune stdlib-shims | |
# Run check style script, this script build ocpchecker and run it on | |
# every *.ml and *.mli file, it returns exit code 1 if some files | |
# have line longer than 80 characters | |
- name: Run check_style.sh script | |
run: opam exec -- rsc/extra/check_style.sh |