feat: nix checks
This commit is contained in:
parent
0093a0879e
commit
7a799868fb
28
.github/workflows/lint.yaml
vendored
28
.github/workflows/lint.yaml
vendored
@ -24,29 +24,5 @@ jobs:
|
|||||||
name: trevstack
|
name: trevstack
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
|
||||||
- name: Install NPM Packages
|
- name: Run checks
|
||||||
working-directory: ./client
|
run: nix flake check --all-systems
|
||||||
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
|
|
@ -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
|
|
54
flake.nix
54
flake.nix
@ -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);
|
formatter = forSystem ({pkgs, ...}: pkgs.alejandra);
|
||||||
|
|
||||||
packages = forSystem ({pkgs, ...}: rec {
|
packages = forSystem ({pkgs, ...}: rec {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user