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

Fix Windows build and beautify + format ci.yml #580

Merged
merged 6 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 41 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,55 @@ name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

env:
OCAML_VERSION: 4.14.0

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest, macos-arm]
ocaml_compiler: [4.14.0]

runs-on: ${{matrix.os}}

steps:
- name: "Windows: Set git to use LF"
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v3

- name: Use OCaml ${{env.OCAML_VERSION}}
if: runner.name != 'macos-arm'
uses: ocaml/setup-ocaml@v2.0.3
with:
ocaml-compiler: ${{env.OCAML_VERSION}}
# Set default repo explicitly.
# Windows uses https://github.com/fdopen/opam-repository-mingw otherwise which may be out of date.
opam-repositories: |
default: https://github.com/ocaml/opam-repository.git
opam-pin: false
opam-depext: false

- name: Use OCaml ${{env.OCAML_VERSION}}
if: runner.name == 'macos-arm'
uses: AbstractMachinesLab/setup-ocaml@arm-support
with:
ocaml-compiler: ${{env.OCAML_VERSION}}
opam-pin: false
opam-depext: false

- name: Install dependencies
run: opam install . --deps-only

- name: Build executables
run: opam exec -- dune build

- name: Run roundtrip tests
if: runner.os != 'Windows'
run: opam exec -- make roundtrip-test

- name: Run tests (Windows)
if: runner.os == 'Windows'
run: opam exec -- make test
- name: "Windows: Set git to use LF"
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v3

- name: Use OCaml ${{matrix.ocaml_compiler}}
if: runner.name != 'macos-arm'
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{matrix.ocaml_compiler}}
opam-pin: false
opam-depext: false

- name: Use OCaml ${{matrix.ocaml_compiler}} (macOS ARM)
if: runner.name == 'macos-arm'
uses: AbstractMachinesLab/setup-ocaml@arm-support
with:
ocaml-compiler: ${{matrix.ocaml_compiler}}
opam-pin: false
opam-depext: false

- name: Install dependencies
run: opam install . --deps-only

- name: Build executables
run: opam exec -- dune build

- name: Run roundtrip tests
if: runner.os != 'Windows'
run: opam exec -- make roundtrip-test

- name: Run tests (Windows)
if: runner.os == 'Windows'
run: opam exec -- make test
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ test: build
dune exec -- testrunner
dune exec -- bash ./scripts/test.sh
make reanalyze
make checkformat
bash ./scripts/testok.sh

roundtrip-test: build
dune exec -- testrunner
ROUNDTRIP_TEST=1 dune exec -- bash ./scripts/test.sh
make reanalyze
make checkformat
bash ./scripts/testok.sh

reanalyze: build
Expand Down
13 changes: 13 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,16 @@ if [[ $ROUNDTRIP_TEST = 1 ]]; then
fi

rm -r temp/

# Check format (does not work on Windows)
case "$(uname -s)" in
Darwin|Linux)
echo "Checking code formatting..."
if dune build @fmt; then
printf "${successGreen}✅ Code formatting ok.${reset}\n"
else
printf "${warningYellow}⚠️ Code formatting failed.${reset}\n"
exit 1
fi
;;
esac