From 02f8cb15316bd48706eb13aa2cf9b192744581c4 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 24 Jun 2022 17:17:01 +0200 Subject: [PATCH 1/6] ocaml/setup-ocaml@v2.0.3 -> ocaml/setup-ocaml@v2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97bb86e2..88097a0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Use OCaml ${{env.OCAML_VERSION}} if: runner.name != 'macos-arm' - uses: ocaml/setup-ocaml@v2.0.3 + uses: ocaml/setup-ocaml@v2 with: ocaml-compiler: ${{env.OCAML_VERSION}} # Set default repo explicitly. From 596e6b924e3da9c035fbf85dafceb3de2098af25 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 24 Jun 2022 17:31:49 +0200 Subject: [PATCH 2/6] Remove setting default repo --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88097a0d..d35f05a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,10 +32,6 @@ jobs: uses: ocaml/setup-ocaml@v2 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 From 2af5aa3e56e009d62bcdfa7b6f39f5752a0f9d4d Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 24 Jun 2022 17:42:06 +0200 Subject: [PATCH 3/6] Use matrix, not env for compiler version --- .github/workflows/ci.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d35f05a9..06e84f42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,15 +6,13 @@ on: pull_request: 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}} @@ -27,19 +25,19 @@ jobs: - uses: actions/checkout@v3 - - name: Use OCaml ${{env.OCAML_VERSION}} + - name: Use OCaml ${{matrix.ocaml_compiler}} if: runner.name != 'macos-arm' uses: ocaml/setup-ocaml@v2 with: - ocaml-compiler: ${{env.OCAML_VERSION}} + ocaml-compiler: ${{matrix.ocaml_compiler}} opam-pin: false opam-depext: false - - name: Use OCaml ${{env.OCAML_VERSION}} + - name: Use OCaml ${{matrix.ocaml_compiler}} if: runner.name == 'macos-arm' uses: AbstractMachinesLab/setup-ocaml@arm-support with: - ocaml-compiler: ${{env.OCAML_VERSION}} + ocaml-compiler: ${{matrix.ocaml_compiler}} opam-pin: false opam-depext: false From e4b2423b9ec0bbf34a90a29f3fdb67bf594d96a3 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 24 Jun 2022 17:46:50 +0200 Subject: [PATCH 4/6] Format ci.yml --- .github/workflows/ci.yml | 80 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06e84f42..4d75b9e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: test: @@ -15,42 +15,42 @@ jobs: 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 ${{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}} - 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 + - 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}} + 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 From 47e74bb04e074fd236182aba499a8265c0905e40 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 24 Jun 2022 20:31:51 +0200 Subject: [PATCH 5/6] Do not run format check on Windows --- Makefile | 2 -- scripts/test.sh | 13 +++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3616ab7e..8579ab74 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/scripts/test.sh b/scripts/test.sh index a55cd638..6b59f0cd 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -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 From 85b63f9a36d468d9606b85af4000cc922947b62b Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 24 Jun 2022 20:50:22 +0200 Subject: [PATCH 6/6] Beautify --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d75b9e0..78677fb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: opam-pin: false opam-depext: false - - name: Use OCaml ${{matrix.ocaml_compiler}} + - name: Use OCaml ${{matrix.ocaml_compiler}} (macOS ARM) if: runner.name == 'macos-arm' uses: AbstractMachinesLab/setup-ocaml@arm-support with: