flake: run tests in flake check, actually check fourmolu
This commit is contained in:
parent
d8aa028814
commit
bb174a7145
3 changed files with 15 additions and 12 deletions
8
Makefile
8
Makefile
|
|
@ -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
|
.PHONY: hoogle format haddock usage
|
||||||
|
|
||||||
|
|
@ -10,7 +11,7 @@ usage:
|
||||||
@echo " format -- Format the project"
|
@echo " format -- Format the project"
|
||||||
@echo " haddock -- Generate Haddock docs for project"
|
@echo " haddock -- Generate Haddock docs for project"
|
||||||
|
|
||||||
hoogle:
|
hoogle:
|
||||||
hoogle generate --local=haddock --database=hoo/local.hoo
|
hoogle generate --local=haddock --database=hoo/local.hoo
|
||||||
hoogle server --local -p 8081 >> /dev/null &
|
hoogle server --local -p 8081 >> /dev/null &
|
||||||
hoogle server --local --database=hoo/local.hoo -p 8082 >> /dev/null &
|
hoogle server --local --database=hoo/local.hoo -p 8082 >> /dev/null &
|
||||||
|
|
@ -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 '.*\.nix' | xargs nixfmt
|
||||||
git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.cabal' | xargs cabal-fmt -i
|
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:
|
haddock:
|
||||||
cabal haddock --haddock-html --haddock-hoogle --builddir=haddock
|
cabal haddock --haddock-html --haddock-hoogle --builddir=haddock
|
||||||
|
|
|
||||||
|
|
@ -148,11 +148,9 @@ test-suite agora-test
|
||||||
main-is: Spec.hs
|
main-is: Spec.hs
|
||||||
hs-source-dirs: agora-test
|
hs-source-dirs: agora-test
|
||||||
other-modules:
|
other-modules:
|
||||||
Spec.Stake
|
|
||||||
Spec.Sample.Stake
|
|
||||||
|
|
||||||
Spec.Model.MultiSig
|
Spec.Model.MultiSig
|
||||||
|
Spec.Sample.Stake
|
||||||
|
Spec.Stake
|
||||||
Spec.Util
|
Spec.Util
|
||||||
|
|
||||||
build-depends: agora
|
build-depends: agora
|
||||||
|
|
|
||||||
13
flake.nix
13
flake.nix
|
|
@ -93,9 +93,9 @@
|
||||||
pkgs = nixpkgsFor system;
|
pkgs = nixpkgsFor system;
|
||||||
pkgs' = nixpkgsFor' system;
|
pkgs' = nixpkgsFor' system;
|
||||||
inherit (pkgs.haskell-nix.tools ghcVersion {
|
inherit (pkgs.haskell-nix.tools ghcVersion {
|
||||||
inherit (plutarch.tools) fourmolu hlint;
|
inherit (plutarch.tools) fourmolu;
|
||||||
})
|
})
|
||||||
fourmolu hlint;
|
fourmolu;
|
||||||
in pkgs.runCommand "format-check" {
|
in pkgs.runCommand "format-check" {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkgs'.git
|
pkgs'.git
|
||||||
|
|
@ -103,14 +103,13 @@
|
||||||
pkgs'.haskellPackages.cabal-fmt
|
pkgs'.haskellPackages.cabal-fmt
|
||||||
pkgs'.nixpkgs-fmt
|
pkgs'.nixpkgs-fmt
|
||||||
fourmolu
|
fourmolu
|
||||||
hlint
|
|
||||||
];
|
];
|
||||||
} ''
|
} ''
|
||||||
export LC_CTYPE=C.UTF-8
|
export LC_CTYPE=C.UTF-8
|
||||||
export LC_ALL=C.UTF-8
|
export LC_ALL=C.UTF-8
|
||||||
export LANG=C.UTF-8
|
export LANG=C.UTF-8
|
||||||
cd ${self}
|
cd ${self}
|
||||||
make format_check
|
make format_check || (echo " Please run 'make format'" ; exit 1)
|
||||||
mkdir $out
|
mkdir $out
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
|
|
@ -118,9 +117,13 @@
|
||||||
flake = perSystem (system: (projectFor system).flake { });
|
flake = perSystem (system: (projectFor system).flake { });
|
||||||
|
|
||||||
packages = perSystem (system: self.flake.${system}.packages);
|
packages = perSystem (system: self.flake.${system}.packages);
|
||||||
|
|
||||||
|
# Define what we want to test
|
||||||
checks = perSystem (system:
|
checks = perSystem (system:
|
||||||
self.flake.${system}.checks // {
|
self.flake.${system}.checks // {
|
||||||
formatCheck = formatCheckFor system;
|
formatCheck = formatCheckFor system;
|
||||||
|
agora = self.flake.${system}.packages."agora:lib:agora";
|
||||||
|
agora-test = self.flake.${system}.packages."agora:test:agora-test";
|
||||||
});
|
});
|
||||||
check = perSystem (system:
|
check = perSystem (system:
|
||||||
(nixpkgsFor system).runCommand "combined-test" {
|
(nixpkgsFor system).runCommand "combined-test" {
|
||||||
|
|
@ -130,7 +133,5 @@
|
||||||
touch $out
|
touch $out
|
||||||
'');
|
'');
|
||||||
devShell = perSystem (system: self.flake.${system}.devShell);
|
devShell = perSystem (system: self.flake.${system}.devShell);
|
||||||
defaultPackage =
|
|
||||||
perSystem (system: self.flake.${system}.packages."agora:lib:agora");
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue