Skip to content

Commit

Permalink
ci: add code format check
Browse files Browse the repository at this point in the history
  • Loading branch information
nrdxp committed Aug 2, 2024
1 parent f3cf3a7 commit 4b1eb86
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ jobs:
- uses: nixbuild/nix-quick-install-action@v28
- name: Structural Integirty Test
run: cd test && ./bld.sh
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v28
- name: Code Format Check
run: eval "$(nix print-dev-env -f shell.nix)" && treefmt --fail-on-change
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.direnv
1 change: 1 addition & 0 deletions dev/mod.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ }
11 changes: 11 additions & 0 deletions dev/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
pkgs ? import <nixpkgs> { },
}:
pkgs.mkShell {
packages = with pkgs; [
treefmt
npins
nixfmt-rfc-style
shfmt
];
}
4 changes: 4 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let
dev = import ./. ./dev;
in
dev.shell
2 changes: 1 addition & 1 deletion test/bld.res.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
g = 5;
h = 8;
};
test = scopedImport {std = builtins;} "${../std/set/filterMap.nix}";
test = scopedImport { std = builtins; } "${../std/set/filterMap.nix}";
x = builtins.readFile ./bld/bum;
}
11 changes: 11 additions & 0 deletions treefmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[formatter.nix]
command = "nixfmt"
options = []
includes = [ "*.nix" ]
excludes = []

[formatter.sh]
command = "shfmt"
options = []
includes = [ "*.sh" ]
excludes = []

0 comments on commit 4b1eb86

Please sign in to comment.