Add flake-check (#7)
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful

Co-authored-by: Smaug123 <patrick+github@patrickstevens.co.uk>
Reviewed-on: #7
This commit is contained in:
2023-10-04 08:40:27 +00:00
parent 8d1904d5ce
commit 97ab6ee820
6 changed files with 60 additions and 35 deletions

3
.gitattributes vendored
View File

@@ -1,4 +1,3 @@
* text=auto * text=auto
*.sh text eol=lf * text eol=lf
*.nix text eol=lf
hooks/pre-push text eol=lf hooks/pre-push text eol=lf

3
.gitignore vendored
View File

@@ -10,3 +10,6 @@ riderModule.iml
test.sqlite test.sqlite
__pycache__/ __pycache__/
.idea .idea
.DS_Store
/result

View File

@@ -4,7 +4,7 @@ steps:
commands: commands:
- echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf - echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf
# Lint # Lint
image: nixos/nix - "nix flake check"
- "nix develop --command bash -c 'dotnet tool restore && ./hooks/pre-push'" - "nix develop --command bash -c 'dotnet tool restore && ./hooks/pre-push'"
# Test # Test
- nix build - nix build

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>

View File

@@ -39,9 +39,10 @@
runHook postInstall runHook postInstall
''; '';
}; };
fantomas = dotnetTool "fantomas" (builtins.fromJSON (builtins.readFile ./.config/dotnet-tools.json)).tools.fantomas.version "sha256-83RodORaC3rkYfbFMHsYLEtl0+8+akZXcKoSJdgwuUo=";
in { in {
packages = { packages = {
fantomas = dotnetTool "fantomas" (builtins.fromJSON (builtins.readFile ./.config/dotnet-tools.json)).tools.fantomas.version "sha256-83RodORaC3rkYfbFMHsYLEtl0+8+akZXcKoSJdgwuUo="; fantomas = fantomas;
fetchDeps = let fetchDeps = let
flags = []; flags = [];
runtimeIds = ["win-x64"] ++ map (system: pkgs.dotnetCorePackages.systemToDotnetRid system) dotnet-sdk.meta.platforms; runtimeIds = ["win-x64"] ++ map (system: pkgs.dotnetCorePackages.systemToDotnetRid system) dotnet-sdk.meta.platforms;
@@ -87,5 +88,27 @@
else [] else []
); );
}; };
checks = {
fantomas = pkgs.stdenvNoCC.mkDerivation {
name = "fantomas-check";
src = ./.;
checkPhase = ''
${fantomas}/bin/fantomas --check .
'';
installPhase = "mkdir $out";
dontBuild = true;
doCheck = true;
};
verify = pkgs.stdenvNoCC.mkDerivation {
name = "verify-schema";
src = ./.;
checkPhase = ''
${self.packages.${system}.default}/bin/AnkiStatic verify AnkiStatic.Test/CapitalsOfTheWorld.json
'';
installPhase = "mkdir $out";
dontBuild = true;
doCheck = true;
};
};
}); });
} }