feat: nix checks

This commit is contained in:
trev 2025-04-17 07:33:41 -04:00
parent 0093a0879e
commit 7a799868fb
3 changed files with 56 additions and 49 deletions

View File

@ -24,29 +24,5 @@ jobs:
name: trevstack
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Install NPM Packages
working-directory: ./client
run: npm i && npm ci # https://github.com/npm/cli/issues/7793
- uses: nicknovitski/nix-develop@v1
- run: npx prettier --check .
working-directory: ./client
- run: npx eslint .
working-directory: ./client
- run: npx svelte-check
working-directory: ./client
- run: revive -config revive.toml -set_exit_status ./...
working-directory: ./server
- run: sqlfluff lint
working-directory: ./server
- run: buf lint
- run: nix fmt -- flake.nix --check
- run: nix flake check --all-systems
- name: Run checks
run: nix flake check --all-systems

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
git_root=$(git rev-parse --show-toplevel)
echo "linting client"
cd "${git_root}/client"
npx prettier --check .
npx eslint .
npx svelte-check
echo "linting server"
cd "${git_root}/server"
revive -config revive.toml -set_exit_status ./...
sqlfluff lint
echo "linting protobuf"
cd "${git_root}"
buf lint
echo "linting nix"
cd "${git_root}"
nix fmt -- flake.nix --check
nix flake check --all-systems

View File

@ -92,6 +92,60 @@
};
});
checks = forSystem ({pkgs, ...}: {
buf = with pkgs;
runCommandLocal "check-buf" {
nativeBuildInputs = with pkgs; [
buf
];
} ''
export HOME=$(pwd)
cd ${./.}
buf lint
touch $out
'';
nix = with pkgs;
runCommandLocal "check-nix" {
nativeBuildInputs = with pkgs; [
alejandra
];
} ''
cd ${./.}
alejandra -c .
touch $out
'';
client = with pkgs;
buildNpmPackage {
pname = "check-client";
inherit version;
src = ./client;
npmDepsHash = "sha256-u7zkBgaxDEB2XFrNl0f7/HtW0Oy2B7FVPot9MLPzXGc=";
dontNpmInstall = true;
buildPhase = ''
npx prettier --check .
npx eslint .
npx svelte-kit sync && npx svelte-check
touch $out
'';
};
server = with pkgs;
runCommandLocal "check-server" {
nativeBuildInputs = with pkgs; [
revive
sqlfluff
];
} ''
cd ${./server}
revive -config revive.toml -set_exit_status ./...
sqlfluff lint
touch $out
'';
});
formatter = forSystem ({pkgs, ...}: pkgs.alejandra);
packages = forSystem ({pkgs, ...}: rec {