Skip to content

Commit c3cc86e

Browse files
committed
chore(ci): run cargo fmt and clippy in parallel
1 parent d636fd2 commit c3cc86e

File tree

2 files changed

+74
-48
lines changed

2 files changed

+74
-48
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ on:
1717
- "**.md"
1818

1919
jobs:
20-
checks:
21-
name: pre / code quality
20+
check:
21+
name: check
2222
runs-on: macos-latest
2323
steps:
2424
- uses: actions/checkout@v2
@@ -37,19 +37,40 @@ jobs:
3737
~/.cargo/git
3838
target
3939
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
40-
- name: build | format
41-
uses: actions-rs/cargo@v1
40+
- run: cargo check
41+
42+
lint:
43+
name: lint
44+
needs: check
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
cargo-cmd:
49+
- fmt --all -- --check
50+
- clippy --all-targets --all-features -- -D warnings
51+
runs-on: macos-latest
52+
steps:
53+
- uses: actions/checkout@v2
54+
- name: setup | rust
55+
uses: actions-rs/toolchain@v1
4256
with:
43-
command: fmt
44-
args: --all -- --check
45-
- name: build | lint
46-
uses: actions-rs/cargo@v1
57+
toolchain: stable
58+
default: true
59+
profile: minimal
60+
components: clippy, rustfmt
61+
- name: setup | cache
62+
uses: actions/cache@v2
4763
with:
48-
command: clippy
49-
args: --all-targets --all-features -- -D warnings
64+
path: |
65+
~/.cargo/registry
66+
~/.cargo/git
67+
target
68+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
69+
- run: cargo ${{ matrix['cargo-cmd'] }}
5070

5171
tests:
52-
name: tests
72+
name: test
73+
needs: check
5374
strategy:
5475
fail-fast: false
5576
matrix:
@@ -73,20 +94,12 @@ jobs:
7394
~/.cargo/git
7495
target
7596
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
76-
- name: build | check
77-
uses: actions-rs/cargo@v1
78-
with:
79-
command: check
80-
args: --all
81-
- name: build | tests
82-
uses: actions-rs/cargo@v1
83-
with:
84-
command: test
85-
args: --all-features --all --locked -- -Z unstable-options
97+
- name: cargo test
98+
run: cargo test --all-features --all --locked -- -Z unstable-options
8699

87100
audit:
88-
name: post / audit
89-
needs: tests
101+
name: security audit
102+
needs: check
90103
runs-on: macos-latest
91104
steps:
92105
- uses: actions/checkout@v2
@@ -104,7 +117,7 @@ jobs:
104117
~/.cargo/git
105118
target
106119
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
107-
- name: build | audit
120+
- name: audit
108121
uses: actions-rs/audit-check@v1
109122
with:
110123
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ on:
1414

1515
# NOTE: needs to stay in sync with ./build.yml
1616
jobs:
17-
checks:
18-
name: pre / code quality
17+
check:
18+
name: check
1919
runs-on: macos-latest
2020
steps:
2121
- uses: actions/checkout@v2
@@ -34,19 +34,40 @@ jobs:
3434
~/.cargo/git
3535
target
3636
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
37-
- name: build | format
38-
uses: actions-rs/cargo@v1
37+
- run: cargo check
38+
39+
lint:
40+
name: lint
41+
needs: check
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
cargo-cmd:
46+
- fmt --all -- --check
47+
- clippy --all-targets --all-features -- -D warnings
48+
runs-on: macos-latest
49+
steps:
50+
- uses: actions/checkout@v2
51+
- name: setup | rust
52+
uses: actions-rs/toolchain@v1
3953
with:
40-
command: fmt
41-
args: --all -- --check
42-
- name: build | lint
43-
uses: actions-rs/cargo@v1
54+
toolchain: stable
55+
default: true
56+
profile: minimal
57+
components: clippy, rustfmt
58+
- name: setup | cache
59+
uses: actions/cache@v2
4460
with:
45-
command: clippy
46-
args: --all-targets --all-features -- -D warnings
61+
path: |
62+
~/.cargo/registry
63+
~/.cargo/git
64+
target
65+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
66+
- run: cargo ${{ matrix['cargo-cmd'] }}
4767

4868
tests:
49-
name: tests
69+
name: test
70+
needs: check
5071
strategy:
5172
fail-fast: false
5273
matrix:
@@ -70,20 +91,12 @@ jobs:
7091
~/.cargo/git
7192
target
7293
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
73-
- name: build | check
74-
uses: actions-rs/cargo@v1
75-
with:
76-
command: check
77-
args: --all
78-
- name: build | tests
79-
uses: actions-rs/cargo@v1
80-
with:
81-
command: test
82-
args: --all-features --all --locked -- -Z unstable-options
94+
- name: cargo test
95+
run: cargo test --all-features --all --locked -- -Z unstable-options
8396

8497
audit:
85-
name: post / audit
86-
needs: tests
98+
name: security audit
99+
needs: check
87100
runs-on: macos-latest
88101
steps:
89102
- uses: actions/checkout@v2
@@ -101,7 +114,7 @@ jobs:
101114
~/.cargo/git
102115
target
103116
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
104-
- name: build | audit
117+
- name: audit
105118
uses: actions-rs/audit-check@v1
106119
with:
107120
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)