From 40e797fbf4d7bb47ef48597f25fda4e0b78633c7 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 22 Apr 2024 11:55:55 +0200 Subject: ci: check code formatting --- .github/workflows/ci.yml | 1 + Makefile | 3 ++- flake.nix | 20 +++++++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b5aacf0..66fda7af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ jobs: steps: #- uses: cachix/install-nix-action@v22 - uses: actions/checkout@v4 + - run: nix build -L .#checks.x86_64-linux.aeneas-check-tidiness - run: nix build -L .#aeneas - run: nix build -L .#checks.x86_64-linux.aeneas-tests - run: nix build -L .#checks.x86_64-linux.aeneas-verify-fstar diff --git a/Makefile b/Makefile index 4ecc2a3e..08359d49 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,8 @@ verify: # Reformat the project .PHONY: format format: - cd compiler && dune build @fmt --auto-promote + @# `|| `true` because the command returns an error if it changed anything, which we don't care about. + cd compiler && dune fmt || true # The commands to run Charon to generate the .llbc files ifeq (, $(REGEN_LLBC)) diff --git a/flake.nix b/flake.nix index f6a5f04e..1ef810b7 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,23 @@ }; buildInputs = [ ocamlPackages.calendar ]; }; + + aeneas-check-tidiness = pkgs.stdenv.mkDerivation { + name = "aeneas-check-tidiness"; + src = ./compiler; + buildInputs = [ + ocamlPackages.dune_3 + ocamlPackages.ocaml + ocamlPackages.ocamlformat + ]; + buildPhase = '' + if ! dune build @fmt; then + echo 'ERROR: Code is not fmrmatted. Run `make format` to format the project files'. + exit 1 + fi + ''; + installPhase = "touch $out"; + }; aeneas = ocamlPackages.buildDunePackage { pname = "aeneas"; version = "0.1.0"; @@ -167,6 +184,7 @@ inherit aeneas aeneas-tests aeneas-verify-fstar aeneas-verify-coq - aeneas-verify-hol4; }; + aeneas-verify-hol4 + aeneas-check-tidiness; }; }); } -- cgit v1.2.3 From 468377f078c5d01ec909f1927b329dec13dd46fd Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 22 Apr 2024 13:15:42 +0200 Subject: ci: Forbid compilation warnings --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 1ef810b7..5817ee33 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,7 @@ version = "0.1.0"; duneVersion = "3"; src = ./compiler; + OCAMLPARAM="_,warn-error=+A"; # Turn all warnings into errors. propagatedBuildInputs = [ easy_logging charon.packages.${system}.charon-ml ] ++ (with ocamlPackages; [ -- cgit v1.2.3 From 10e5ca4c48c1d5729ee877612b7d95dfe2636159 Mon Sep 17 00:00:00 2001 From: Guillaume Boisseau Date: Tue, 23 Apr 2024 09:34:43 +0200 Subject: Typo Co-authored-by: Son HO --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 5817ee33..f77bd23b 100644 --- a/flake.nix +++ b/flake.nix @@ -41,7 +41,7 @@ ]; buildPhase = '' if ! dune build @fmt; then - echo 'ERROR: Code is not fmrmatted. Run `make format` to format the project files'. + echo 'ERROR: Code is not formatted. Run `make format` to format the project files'. exit 1 fi ''; -- cgit v1.2.3