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
*.sh text eol=lf
*.nix text eol=lf
* text eol=lf
hooks/pre-push text eol=lf

27
.gitignore vendored
View File

@@ -1,12 +1,15 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
.idea/
*.user
*.DotSettings
.profile*
test.sqlite
__pycache__/
.idea
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
.idea/
*.user
*.DotSettings
.profile*
test.sqlite
__pycache__/
.idea
.DS_Store
/result

View File

@@ -1,18 +1,18 @@
steps:
build:
image: nixos/nix
commands:
- echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf
# Lint
steps:
build:
image: nixos/nix
commands:
- echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf
# Lint
- "nix flake check"
- "nix develop --command bash -c 'dotnet tool restore && ./hooks/pre-push'"
# Test
- nix build
- nix run . -- verify AnkiStatic.Test/CapitalsOfTheWorld.json
- nix develop --command dotnet -- test
- nix develop --command dotnet -- test --configuration Release
when:
- event: "push"
evaluate: 'CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH'
- event: "pull_request"

View File

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

View File

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

View File

@@ -39,9 +39,10 @@
runHook postInstall
'';
};
fantomas = dotnetTool "fantomas" (builtins.fromJSON (builtins.readFile ./.config/dotnet-tools.json)).tools.fantomas.version "sha256-83RodORaC3rkYfbFMHsYLEtl0+8+akZXcKoSJdgwuUo=";
in {
packages = {
fantomas = dotnetTool "fantomas" (builtins.fromJSON (builtins.readFile ./.config/dotnet-tools.json)).tools.fantomas.version "sha256-83RodORaC3rkYfbFMHsYLEtl0+8+akZXcKoSJdgwuUo=";
fantomas = fantomas;
fetchDeps = let
flags = [];
runtimeIds = ["win-x64"] ++ map (system: pkgs.dotnetCorePackages.systemToDotnetRid system) dotnet-sdk.meta.platforms;
@@ -87,5 +88,27 @@
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;
};
};
});
}