mirror of
https://github.com/nmattia/niv.git
synced 2024-09-16 01:47:08 +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-github = pkgs.callPackage ./tests/github { inherit niv; };
|
||||||
tests-git = pkgs.callPackage ./tests/git { 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 ]; }
|
readme = pkgs.runCommand "README.md" { nativeBuildInputs = [ niv ]; }
|
||||||
''
|
''
|
||||||
cp ${./README.tpl.md} $out
|
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
|
### fmt - Format Haskell files with Ormolu
|
||||||
###
|
###
|
||||||
@ -40,6 +45,7 @@ fmt() {
|
|||||||
if [ "$mode" == "check" ]; then
|
if [ "$mode" == "check" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "Please run ./script/fmt"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user