mirror of
https://github.com/nmattia/niv.git
synced 2024-09-05 20:15:26 +03:00
Add CI check for formatting
This commit is contained in:
parent
15c82fd184
commit
ab9cc41caf
18
default.nix
18
default.nix
@ -198,6 +198,24 @@ rec
|
||||
tests-github = pkgs.callPackage ./tests/github { inherit niv; };
|
||||
tests-git = pkgs.callPackage ./tests/git { inherit niv; };
|
||||
|
||||
fmt-check =
|
||||
pkgs.stdenv.mkDerivation
|
||||
{
|
||||
name = "fmt-check";
|
||||
buildInputs = [ pkgs.ormolu pkgs.glibcLocales ];
|
||||
src = niv-source;
|
||||
phases = [ "unpackPhase" "checkPhase" ];
|
||||
LANG = "en_US.UTF-8";
|
||||
checkPhase = ''
|
||||
cp ${./script/fmt} ./fmt
|
||||
patchShebangs ./fmt
|
||||
chmod +x fmt
|
||||
bash fmt -c
|
||||
touch $out
|
||||
'';
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
readme = pkgs.runCommand "README.md" { nativeBuildInputs = [ niv ]; }
|
||||
''
|
||||
cp ${./README.tpl.md} $out
|
||||
|
@ -1,4 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash
|
||||
#!nix-shell -I nixpkgs=./nix
|
||||
#!nix-shell -p ormolu
|
||||
#!nix-shell -p glibcLocales
|
||||
#!nix-shell --keep GITHUB_TOKEN
|
||||
###
|
||||
### fmt - Format Haskell files with Ormolu
|
||||
###
|
||||
@ -40,6 +45,7 @@ fmt() {
|
||||
if [ "$mode" == "check" ]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "Please run ./script/fmt"
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user