File tree 2 files changed +18
-30
lines changed
2 files changed +18
-30
lines changed Original file line number Diff line number Diff line change 7
7
RUST_BACKTRACE : full
8
8
9
9
jobs :
10
- format :
11
- name : Format
10
+ style :
11
+ name : Code style check
12
12
runs-on : ubuntu-latest
13
13
steps :
14
14
- name : Checkout
15
15
uses : actions/checkout@v3
16
- - name : Install Rust
17
- uses : actions-rs/toolchain@v1
18
- with :
19
- profile : minimal
20
- toolchain : nightly
21
- components : rustfmt
22
- - name : Check format
23
- run : cargo fmt --all -- --check
24
-
25
- clippy :
26
- name : Clippy
27
- runs-on : ubuntu-latest
28
- steps :
29
- - name : Checkout
30
- uses : actions/checkout@v3
31
- # For builtins.
32
16
- name : Install Nix
33
17
uses : cachix/install-nix-action@v17
34
- - name : Install Rust
35
- uses : actions-rs/toolchain@v1
36
- with :
37
- profile : minimal
38
- toolchain : stable
39
- components : clippy
40
- - name : Check clippy
41
- run : cargo clippy --all -- -D warnings
18
+ - name : Prepare devShell
19
+ run : nix develop --command true
20
+ - name : Run pre-commit
21
+ run : nix develop --command pre-commit
42
22
43
23
test :
44
24
name : Test
Original file line number Diff line number Diff line change 38
38
pkgs = nixpkgs . legacyPackages . ${ system } ;
39
39
rustPkgs = rust-overlay . packages . ${ system } ;
40
40
41
+ clippyFlags = lib . concatStringsSep " " [
42
+ "-D" "warnings"
43
+ "-D" "clippy::dbg_macro"
44
+ ] ;
45
+
41
46
pre-commit = pkgs . writeShellScriptBin "pre-commit" ''
42
47
set -e
43
48
die() { echo "$*" >&2; exit 1; }
44
49
45
- cd "$(git rev-parse --show-toplevel)"
46
- rg --fixed-strings 'dbg!' --glob '*.rs' \
47
- && die 'Found dbg!()'
48
- cargo fmt --quiet --check >/dev/null \
50
+ if git_dir= "$(git rev-parse --show-toplevel)"; then
51
+ cd "$git_dir"
52
+ fi
53
+ cargo fmt --all --check \
49
54
|| die 'Format failed'
55
+ cargo clippy --all --all-targets -- ${ clippyFlags } \
56
+ || die 'Clippy failed'
50
57
'' ;
51
58
52
59
nil = pkgs . callPackage mkNil { } ;
79
86
80
87
RUST_BACKTRACE = "short" ;
81
88
NIXPKGS = nixpkgs ;
89
+ CLIPPY_FLAGS = clippyFlags ;
82
90
83
91
# bash
84
92
shellHook = ''
You can’t perform that action at this time.
0 commit comments