10
10
CARGO_TERM_COLOR : always
11
11
12
12
jobs :
13
- check :
14
-
13
+ install_toolchain :
15
14
runs-on : ubuntu-latest
16
-
17
15
steps :
18
- - uses : actions/checkout@v3
19
-
16
+ - uses : actions/checkout@v4
20
17
- name : Set-Up
21
- run : sudo apt install -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler
18
+ run : sudo apt-get update && sudo apt-get install -f -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler eatmydata
19
+
20
+ - name : Cache toolchain
21
+ id : cache-rustup
22
+ uses : actions/cache@v3
23
+ with :
24
+ key : ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
25
+ path : |
26
+ ~/.cargo/
27
+ ~/.rustup/
22
28
23
29
- name : Install Rustup
30
+ id : install-rustup
31
+ if : steps.cache-rustup.outputs.cache-hit != 'true'
24
32
run : |
25
33
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
26
34
source ~/.cargo/env
@@ -30,11 +38,103 @@ jobs:
30
38
rustup toolchain install nightly
31
39
rustup target add wasm32-unknown-unknown --toolchain nightly
32
40
33
- - name : Check format
34
- run : cargo fmt --all -- --check
41
+ build-deps :
42
+ runs-on : ubuntu-latest
43
+ needs : [install_toolchain]
35
44
45
+ steps :
46
+ - name : Install protoc
47
+ uses : arduino/setup-protoc@v2
48
+ - uses : actions/checkout@v4
49
+ - uses : actions/cache/restore@v3
50
+ with :
51
+ key : ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
52
+ path : |
53
+ ~/.cargo/
54
+ ~/.rustup/
55
+ - name : cache dependencies
56
+ id : cache-cargo
57
+ uses : actions/cache@v3
58
+ with :
59
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
60
+ path : |
61
+ ~/.cargo/
62
+ ./target/
63
+ - name : cargo check
64
+ id : cargo-check
65
+ if : steps.cache-toolchain.outputs.cache-hit != 'true'
66
+ run : SKIP_WASM_BUILD= cargo check --all
67
+
68
+ build :
69
+ runs-on : ubuntu-latest
70
+ needs : [install_toolchain,build-deps]
71
+ steps :
72
+ - name : Install protoc
73
+ uses : arduino/setup-protoc@v2
74
+ - uses : actions/checkout@v4
75
+ - uses : actions/cache/restore@v3
76
+ with :
77
+ key : ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
78
+ path : |
79
+ ~/.cargo/
80
+ ~/.rustup/
81
+ - uses : actions/cache/restore@v3
82
+ with :
83
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
84
+ path : |
85
+ ~/.cargo/
86
+ ./target/
36
87
- name : Build
37
88
run : SKIP_WASM_BUILD= cargo check --all-targets --features runtime-benchmarks
38
-
89
+
90
+ fmt :
91
+ runs-on : ubuntu-latest
92
+ needs : [install_toolchain,build-deps]
93
+ steps :
94
+ - name : Install protoc
95
+ uses : arduino/setup-protoc@v2
96
+ - uses : actions/checkout@v4
97
+ - uses : actions/cache/restore@v3
98
+ with :
99
+ key : ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
100
+ path : |
101
+ ~/.cargo/
102
+ ~/.rustup/
103
+ - uses : actions/cache/restore@v3
104
+ with :
105
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
106
+ path : |
107
+ ~/.cargo/
108
+ ./target/
109
+ - name : Check format
110
+ run : cargo fmt --all -- --check
111
+
112
+ test :
113
+ runs-on : ubuntu-latest
114
+ needs : [install_toolchain,build-deps]
115
+ steps :
116
+ - name : Install protoc
117
+ uses : arduino/setup-protoc@v2
118
+ - uses : actions/checkout@v4
119
+ - uses : actions/cache/restore@v3
120
+ with :
121
+ key : ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
122
+ path : |
123
+ ~/.cargo/
124
+ ~/.rustup/
125
+ - uses : actions/cache/restore@v3
126
+ with :
127
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
128
+ path : |
129
+ ~/.cargo/
130
+ ./target/
131
+ - name : cargo test cache
132
+ id : cache-cargo-test
133
+ uses : actions/cache@v3
134
+ with :
135
+ key : ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
136
+ path : |
137
+ ~/.cargo/
138
+ ./target/
39
139
- name : Test
40
- run : SKIP_WASM_BUILD= cargo test --workspace --features runtime-benchmarks -- --nocapture
140
+ run : SKIP_WASM_BUILD= cargo test --workspace --features runtime-benchmarks
0 commit comments