flake: run tests in flake check, actually check fourmolu

This commit is contained in:
Emily Martins 2022-03-22 16:27:20 +01:00
parent 14e1d66f60
commit a0ed939175
3 changed files with 15 additions and 12 deletions

View file

@ -1,4 +1,5 @@
SHELL := /usr/bin/env bash
# This really ought to be `/usr/bin/env bash`, but nix flakes don't like that.
SHELL := /bin/sh
.PHONY: hoogle format haddock usage
@ -21,5 +22,8 @@ format:
git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.nix' | xargs nixfmt
git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.cabal' | xargs cabal-fmt -i
format_check:
find -name '*.hs' -not -path './dist-*/*' | xargs fourmolu $(FORMAT_EXTENSIONS) -m check
haddock:
cabal haddock --haddock-html --haddock-hoogle --builddir=haddock

View file

@ -148,11 +148,9 @@ test-suite agora-test
main-is: Spec.hs
hs-source-dirs: agora-test
other-modules:
Spec.Stake
Spec.Sample.Stake
Spec.Model.MultiSig
Spec.Sample.Stake
Spec.Stake
Spec.Util
build-depends: agora

View file

@ -93,9 +93,9 @@
pkgs = nixpkgsFor system;
pkgs' = nixpkgsFor' system;
inherit (pkgs.haskell-nix.tools ghcVersion {
inherit (plutarch.tools) fourmolu hlint;
inherit (plutarch.tools) fourmolu;
})
fourmolu hlint;
fourmolu;
in pkgs.runCommand "format-check" {
nativeBuildInputs = [
pkgs'.git
@ -103,14 +103,13 @@
pkgs'.haskellPackages.cabal-fmt
pkgs'.nixpkgs-fmt
fourmolu
hlint
];
} ''
export LC_CTYPE=C.UTF-8
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
cd ${self}
make format_check
make format_check || (echo " Please run 'make format'" ; exit 1)
mkdir $out
'';
in {
@ -118,9 +117,13 @@
flake = perSystem (system: (projectFor system).flake { });
packages = perSystem (system: self.flake.${system}.packages);
# Define what we want to test
checks = perSystem (system:
self.flake.${system}.checks // {
formatCheck = formatCheckFor system;
agora = self.flake.${system}.packages."agora:lib:agora";
agora-test = self.flake.${system}.packages."agora:test:agora-test";
});
check = perSystem (system:
(nixpkgsFor system).runCommand "combined-test" {
@ -130,7 +133,5 @@
touch $out
'');
devShell = perSystem (system: self.flake.${system}.devShell);
defaultPackage =
perSystem (system: self.flake.${system}.packages."agora:lib:agora");
};
}