Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit fed1a27

Browse files
authored
Fix Windows build and beautify + format ci.yml (#580)
* ocaml/setup-ocaml@v2.0.3 -> ocaml/setup-ocaml@v2 * Remove setting default repo * Use matrix, not env for compiler version * Format ci.yml * Do not run format check on Windows * Beautify
1 parent 07167f0 commit fed1a27

File tree

3 files changed

+54
-49
lines changed

3 files changed

+54
-49
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,55 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

9-
env:
10-
OCAML_VERSION: 4.14.0
11-
129
jobs:
1310
test:
1411
strategy:
1512
fail-fast: false
1613
matrix:
1714
os: [macos-latest, ubuntu-latest, windows-latest, macos-arm]
15+
ocaml_compiler: [4.14.0]
1816

1917
runs-on: ${{matrix.os}}
20-
18+
2119
steps:
22-
- name: "Windows: Set git to use LF"
23-
if: runner.os == 'Windows'
24-
run: |
25-
git config --global core.autocrlf false
26-
git config --global core.eol lf
27-
28-
- uses: actions/checkout@v3
29-
30-
- name: Use OCaml ${{env.OCAML_VERSION}}
31-
if: runner.name != 'macos-arm'
32-
uses: ocaml/setup-ocaml@v2.0.3
33-
with:
34-
ocaml-compiler: ${{env.OCAML_VERSION}}
35-
# Set default repo explicitly.
36-
# Windows uses https://github.com/fdopen/opam-repository-mingw otherwise which may be out of date.
37-
opam-repositories: |
38-
default: https://github.com/ocaml/opam-repository.git
39-
opam-pin: false
40-
opam-depext: false
41-
42-
- name: Use OCaml ${{env.OCAML_VERSION}}
43-
if: runner.name == 'macos-arm'
44-
uses: AbstractMachinesLab/setup-ocaml@arm-support
45-
with:
46-
ocaml-compiler: ${{env.OCAML_VERSION}}
47-
opam-pin: false
48-
opam-depext: false
49-
50-
- name: Install dependencies
51-
run: opam install . --deps-only
52-
53-
- name: Build executables
54-
run: opam exec -- dune build
55-
56-
- name: Run roundtrip tests
57-
if: runner.os != 'Windows'
58-
run: opam exec -- make roundtrip-test
59-
60-
- name: Run tests (Windows)
61-
if: runner.os == 'Windows'
62-
run: opam exec -- make test
20+
- name: "Windows: Set git to use LF"
21+
if: runner.os == 'Windows'
22+
run: |
23+
git config --global core.autocrlf false
24+
git config --global core.eol lf
25+
26+
- uses: actions/checkout@v3
27+
28+
- name: Use OCaml ${{matrix.ocaml_compiler}}
29+
if: runner.name != 'macos-arm'
30+
uses: ocaml/setup-ocaml@v2
31+
with:
32+
ocaml-compiler: ${{matrix.ocaml_compiler}}
33+
opam-pin: false
34+
opam-depext: false
35+
36+
- name: Use OCaml ${{matrix.ocaml_compiler}} (macOS ARM)
37+
if: runner.name == 'macos-arm'
38+
uses: AbstractMachinesLab/setup-ocaml@arm-support
39+
with:
40+
ocaml-compiler: ${{matrix.ocaml_compiler}}
41+
opam-pin: false
42+
opam-depext: false
43+
44+
- name: Install dependencies
45+
run: opam install . --deps-only
46+
47+
- name: Build executables
48+
run: opam exec -- dune build
49+
50+
- name: Run roundtrip tests
51+
if: runner.os != 'Windows'
52+
run: opam exec -- make roundtrip-test
53+
54+
- name: Run tests (Windows)
55+
if: runner.os == 'Windows'
56+
run: opam exec -- make test

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ test: build
1313
dune exec -- testrunner
1414
dune exec -- bash ./scripts/test.sh
1515
make reanalyze
16-
make checkformat
1716
bash ./scripts/testok.sh
1817

1918
roundtrip-test: build
2019
dune exec -- testrunner
2120
ROUNDTRIP_TEST=1 dune exec -- bash ./scripts/test.sh
2221
make reanalyze
23-
make checkformat
2422
bash ./scripts/testok.sh
2523

2624
reanalyze: build

scripts/test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,16 @@ if [[ $ROUNDTRIP_TEST = 1 ]]; then
105105
fi
106106

107107
rm -r temp/
108+
109+
# Check format (does not work on Windows)
110+
case "$(uname -s)" in
111+
Darwin|Linux)
112+
echo "Checking code formatting..."
113+
if dune build @fmt; then
114+
printf "${successGreen}✅ Code formatting ok.${reset}\n"
115+
else
116+
printf "${warningYellow}⚠️ Code formatting failed.${reset}\n"
117+
exit 1
118+
fi
119+
;;
120+
esac

0 commit comments

Comments
 (0)