-
Notifications
You must be signed in to change notification settings - Fork 33
79 lines (64 loc) · 2.6 KB
/
linter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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