1
1
name : Rust CI
2
-
3
2
on :
4
3
push :
5
4
pull_request :
6
5
schedule :
7
6
- cron : " 0 0 * * *"
8
-
9
7
env :
10
8
CARGO_TERM_COLOR : always
11
9
CARGO_INCREMENTAL : 0
12
10
# Required by cargo-insta: https://insta.rs/docs/quickstart/#continuous-integration
13
11
CI : true
14
12
SCCACHE_GHA_ENABLED : true
15
13
RUSTC_WRAPPER : sccache
16
-
17
14
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
18
15
# This will ensure that only one commit will be running tests at a time on each PR.
19
16
concurrency :
20
17
group : ${{ github.ref }}-${{ github.workflow }}
21
18
cancel-in-progress : true
22
-
23
19
jobs :
24
20
build :
25
21
# Run on external PRs and pushes to branches on the repo
@@ -29,118 +25,93 @@ jobs:
29
25
matrix :
30
26
rust : [stable]
31
27
os : [ubuntu-latest, macos-latest, windows-latest]
32
-
33
28
name : Build & test
34
29
runs-on : ${{ matrix.os }}
35
30
steps :
36
31
- name : Checkout source
37
32
uses : actions/checkout@v4
38
-
39
33
- name : Install Rust toolchain
40
34
uses : dtolnay/rust-toolchain@master
41
35
with :
42
36
toolchain : ${{ matrix.rust }}
43
-
44
37
- name : Cache Cargo registry
45
38
uses : Swatinem/rust-cache@v2
46
39
with :
47
40
shared-key : ' rust-ci'
48
41
cache-bin : ' false'
49
-
50
42
- name : Run sccache-cache
51
43
uses : mozilla-actions/sccache-action@v0.0.9
52
-
53
44
- name : Fetch dependencies
54
45
run : cargo +${{ matrix.rust }} fetch --locked
55
-
56
46
- name : Build
57
47
run : cargo +${{ matrix.rust }} build --all-features --tests
58
-
59
48
- name : Test
60
49
run : cargo +${{ matrix.rust }} test run --all-features
61
-
62
50
clippy :
63
51
if : github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
64
-
65
52
name : Clippy lint checks
66
53
runs-on : ubuntu-latest
67
54
needs : ["build"]
68
55
steps :
69
56
- name : Checkout source
70
57
uses : actions/checkout@v4
71
-
72
58
- name : Install Rust toolchain
73
59
uses : dtolnay/rust-toolchain@master
74
60
with :
75
61
toolchain : stable
76
62
components : clippy
77
-
78
63
- name : Cache Cargo registry
79
64
uses : Swatinem/rust-cache@v2
80
65
with :
81
66
shared-key : ' rust-ci'
82
67
cache-bin : ' false'
83
68
save-if : ' false'
84
-
85
69
- name : Run sccache-cache
86
70
uses : mozilla-actions/sccache-action@v0.0.9
87
-
88
71
- name : Run clippy
89
72
run : cargo clippy --no-deps --all-targets -- -D warnings
90
-
91
73
rustfmt :
92
74
if : github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
93
-
94
75
name : Code formatting checks
95
76
runs-on : ubuntu-latest
96
77
needs : ["build"]
97
78
steps :
98
79
- name : Checkout source
99
80
uses : actions/checkout@v4
100
-
101
81
- name : Install Rust toolchain
102
82
uses : dtolnay/rust-toolchain@master
103
83
with :
104
84
toolchain : nightly
105
85
components : rustfmt
106
-
107
86
- name : Cache Cargo registry
108
87
uses : Swatinem/rust-cache@v2
109
88
with :
110
89
shared-key : ' rust-ci'
111
90
cache-bin : ' false'
112
91
save-if : ' false'
113
-
114
92
- name : Run sccache-cache
115
93
uses : mozilla-actions/sccache-action@v0.0.9
116
-
117
94
- name : Run fmt
118
95
run : cargo fmt --all -- --check
119
-
120
96
machete :
121
97
if : github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
122
-
123
98
name : Machete dependencies checks
124
99
runs-on : ubuntu-latest
125
100
needs : ["build"]
126
101
steps :
127
102
- name : Checkout source
128
103
uses : actions/checkout@v4
129
-
130
104
- name : Install Rust toolchain
131
105
uses : dtolnay/rust-toolchain@master
132
106
with :
133
107
toolchain : stable
134
-
135
108
- name : Cache Cargo registry
136
109
uses : Swatinem/rust-cache@v2
137
110
with :
138
111
shared-key : ' rust-ci'
139
112
cache-bin : ' false'
140
113
save-if : ' false'
141
-
142
114
- name : Run sccache-cache
143
115
uses : mozilla-actions/sccache-action@v0.0.9
144
-
145
116
- name : Run cargo-machete
146
117
uses : bnjbvr/cargo-machete@v0.8.0
0 commit comments