@@ -3,53 +3,29 @@ name: Formatting and Linting
3
3
on : [push, pull_request]
4
4
5
5
jobs :
6
- check :
6
+ fmt :
7
+ name : Cargo fmt
7
8
runs-on : ubuntu-latest
8
9
steps :
9
10
- uses : actions/checkout@v3
10
- - uses : dtolnay/rust-toolchain@stable
11
+ - uses : dtolnay/rust-toolchain@nightly
12
+ with :
13
+ components : rustfmt
11
14
- uses : Swatinem/rust-cache@v2
12
-
13
15
- name : Run fmt check
14
16
id : cargoFmt
15
17
shell : bash
16
- run : cargo fmt --all -- --check
17
- - name : Notify fmt check
18
- if : failure() && steps.cargoFmt.outcome == 'failure'
19
- uses : actions/github-script@v6
20
- with :
21
- script : |
22
- const message = `👋 It looks like your code is not formatted like we expect.
23
-
24
- Please run \`cargo fmt\` and push the code again.`;
25
-
26
- await github.rest.issues.createComment({
27
- issue_number : context.issue.number,
28
- owner : context.repo.owner,
29
- repo : context.repo.repo,
30
- body : message,
31
- });
32
- core.setFailed('It looks like there are formatting errors');
33
-
18
+ run : cargo +nightly fmt --all -- --check
19
+ clippy :
20
+ name : Cargo clippy
21
+ runs-on : ubuntu-latest
22
+ steps :
23
+ - uses : actions/checkout@v3
24
+ - uses : dtolnay/rust-toolchain@stable
25
+ - uses : Swatinem/rust-cache@v2
34
26
- name : Run clippy check
35
27
id : cargoClippy
36
28
shell : bash
37
29
run : cargo clippy --workspace --all-features -- -D warnings
38
- - name : Notify fmt check
39
- if : failure() && steps.cargoClippy.outcome == 'failure'
40
- uses : actions/github-script@v6
41
- with :
42
- script : |
43
- const message = `👋 It looks like your code has some linting issues.
44
-
45
- Please run \`cargo clippy --fix\` and push the code again.`;
46
-
47
- await github.rest.issues.createComment({
48
- issue_number : context.issue.number,
49
- owner : context.repo.owner,
50
- repo : context.repo.repo,
51
- body : message,
52
- });
53
- core.setFailed('It looks like there are linting errors');
54
30
55
31
0 commit comments