@@ -6,6 +6,13 @@ name: Build and Test
66
77# TODO(#234) re-include cache steps, also using Rust version in cache key
88
9+ # Note: Each of these jobs, except for the clippy job and the optional benchmarking/coverage
10+ # jobs, maps to a `ci-job-foo` entry in Makefile.toml. If adding further CI jobs, please add them
11+ # as makefile targets as well, and list them under `ci-all`.
12+ #
13+ # Clippy is special because we're using actions-rs/clippy-check which is able to surface clippy failures on
14+ # PR bodies
15+
916on :
1017 push :
1118 branches : [ main ]
1522jobs :
1623
1724 # Build job - basic smoke test
18- build :
25+ check :
1926 runs-on : ubuntu-latest
2027 steps :
2128 - uses : actions/checkout@v2
2229 - name : Load the default Rust toolchain via the rust-toolchain file.
2330 run : rustup show
31+
32+ - name : Get cargo-make version
33+ id : cargo-make-version
34+ run : |
35+ echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)"
36+ shell : bash
37+ - name : Attempt to load cached cargo-make
38+ uses : actions/cache@v2
39+ id : cargo-make-cache
40+ with :
41+ path : |
42+ ~/.cargo/bin/cargo-make
43+ ~/.cargo/bin/cargo-make.exe
44+ key : ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }}
45+ - name : Install cargo-make
46+ if : steps.cargo-make-cache.outputs.cache-hit != 'true'
47+ uses : actions-rs/install@v0.1.2
48+ with :
49+ crate : cargo-make
50+ version : latest
51+
2452 - name : Check
2553 uses : actions-rs/cargo@v1.0.1
2654 with :
27- command : check
28- args : --all-targets --all-features
55+ command : make
56+ args : ci-job-check
2957
3058 # Test job - runs all "cargo make" testing commands
3159 test :
@@ -39,26 +67,43 @@ jobs:
3967 - uses : actions/checkout@v2
4068 - name : Load the default Rust toolchain via the rust-toolchain file.
4169 run : rustup show
70+
71+ - name : Get cargo-make version
72+ id : cargo-make-version
73+ run : |
74+ echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)"
75+ shell : bash
76+ - name : Attempt to load cached cargo-make
77+ uses : actions/cache@v2
78+ id : cargo-make-cache
79+ with :
80+ path : |
81+ ~/.cargo/bin/cargo-make
82+ ~/.cargo/bin/cargo-make.exe
83+ key : ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }}
84+ - name : Install cargo-make
85+ if : steps.cargo-make-cache.outputs.cache-hit != 'true'
86+ uses : actions-rs/install@v0.1.2
87+ with :
88+ crate : cargo-make
89+ version : latest
90+
4291 - name : Build
4392 uses : actions-rs/cargo@v1.0.1
4493 with :
4594 command : build
4695 args : --all-targets --all-features
47- - name : Test All Targets
48- uses : actions-rs/cargo@v1.0.1
49- with :
50- command : test-all
51- - name : Test Docs
96+ - name : Run `cargo make ci-job-test`
5297 uses : actions-rs/cargo@v1.0.1
5398 with :
54- command : test-docs
99+ command : make
100+ args : ci-job-test
55101
56102
57103 # Feature coverage job - builds all permutations of features
58104 features :
59105 runs-on : ubuntu-latest
60- needs : [build]
61-
106+ needs : [check]
62107 steps :
63108 - uses : actions/checkout@v2
64109 - name : Load the default Rust toolchain via the rust-toolchain file.
@@ -68,19 +113,37 @@ jobs:
68113 with :
69114 command : install
70115 args : cargo-all-features --version "^1.4"
71- - name : Test Docs with Default Features
72- uses : actions-rs/cargo@v1.0.1
116+
117+ - name : Get cargo-make version
118+ id : cargo-make-version
119+ run : |
120+ echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)"
121+ shell : bash
122+ - name : Attempt to load cached cargo-make
123+ uses : actions/cache@v2
124+ id : cargo-make-cache
125+ with :
126+ path : |
127+ ~/.cargo/bin/cargo-make
128+ ~/.cargo/bin/cargo-make.exe
129+ key : ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }}
130+ - name : Install cargo-make
131+ if : steps.cargo-make-cache.outputs.cache-hit != 'true'
132+ uses : actions-rs/install@v0.1.2
73133 with :
74- command : test-docs-defaults
134+ crate : cargo-make
135+ version : latest
136+
75137 - name : Build All Feature Permutations
76138 uses : actions-rs/cargo@v1.0.1
77139 with :
78- command : build-all-features
140+ command : make
141+ args : ci-job-features
79142
80143 # WASM Tests - runs Node.js tests for WASM bindings
81144 wasm :
82145 runs-on : ubuntu-latest
83- needs : [build ]
146+ needs : [check ]
84147
85148 steps :
86149 - uses : actions/checkout@v2
@@ -92,11 +155,27 @@ jobs:
92155 run : |
93156 sudo apt-get install wabt binaryen
94157 cargo install twiggy
158+
159+ - name : Get cargo-make version
160+ id : cargo-make-version
161+ run : |
162+ echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)"
163+ shell : bash
164+ - name : Attempt to load cached cargo-make
165+ uses : actions/cache@v2
166+ id : cargo-make-cache
167+ with :
168+ path : |
169+ ~/.cargo/bin/cargo-make
170+ ~/.cargo/bin/cargo-make.exe
171+ key : ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }}
95172 - name : Install cargo-make
173+ if : steps.cargo-make-cache.outputs.cache-hit != 'true'
96174 uses : actions-rs/install@v0.1.2
97175 with :
98176 crate : cargo-make
99177 version : latest
178+
100179 - name : Build
101180 uses : actions-rs/cargo@v1.0.1
102181 with :
@@ -106,14 +185,14 @@ jobs:
106185 uses : actions/setup-node@v1
107186 with :
108187 node-version : 14.17.0
109- - name : Test
110- run : |
111- npm install
112- npm test
113- working-directory : ./ffi/ wasm/ test
188+ - name : Build
189+ uses : actions-rs/cargo@v1.0.1
190+ with :
191+ command : make
192+ args : wasm- test-release
114193
115- # Lint job - runs all " cargo make" linting commands
116- lint :
194+ # Fmt job - runs cargo fmt
195+ fmt :
117196 runs-on : ubuntu-latest
118197 steps :
119198 - uses : actions/checkout@v2
@@ -124,60 +203,91 @@ jobs:
124203 - name : Install rustfmt
125204 run : rustup component add rustfmt
126205
206+
207+ - name : Get cargo-make version
208+ id : cargo-make-version
209+ run : |
210+ echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)"
211+ shell : bash
212+ - name : Attempt to load cached cargo-make
213+ uses : actions/cache@v2
214+ id : cargo-make-cache
215+ with :
216+ path : |
217+ ~/.cargo/bin/cargo-make
218+ ~/.cargo/bin/cargo-make.exe
219+ key : ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }}
127220 - name : Install cargo-make
221+ if : steps.cargo-make-cache.outputs.cache-hit != 'true'
128222 uses : actions-rs/install@v0.1.2
129223 with :
130224 crate : cargo-make
131225 version : latest
132226
133- - name : Install cargo-readme
134- uses : actions-rs/install@v0.1.2
135- with :
136- crate : cargo-readme
137- version : latest
138-
139- # TODO(#234) re-include cache steps, also using Rust version in cache key
140227
141228 - name : Check Format
142229 uses : actions-rs/cargo@v1.0.1
143230 with :
144- command : fmt-check
145-
146- - name : Check License Headers
147- uses : actions-rs/cargo@v1.0.1
148- with :
149- command : license-check
231+ command : make
232+ args : ci-job-fmt
150233
151- - name : Check Generated README.md
152- uses : actions-rs/cargo@v1.0.1
153- with :
154- command : readme-check
155234
156- # Bincode job - Test that the bincode data provider can be generated correctly.
157- bincode :
235+ # Tidy job - runs all "cargo make" tidy commands
236+ tidy :
158237 runs-on : ubuntu-latest
159- # Wait for the initial build to finish. Note that this step does not currently re-use any
160- # artifacts from the build step. It's only waiting on the build to minimize resource use
161- # in case the build fails.
162- needs : [build]
163238 steps :
164239 - uses : actions/checkout@v2
165240
166241 - name : Load the default Rust toolchain via the rust-toolchain file.
167242 run : rustup show
168243
244+ - name : Get cargo-make version
245+ id : cargo-make-version
246+ run : |
247+ echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)"
248+ shell : bash
249+ - name : Attempt to load cached cargo-make
250+ uses : actions/cache@v2
251+ id : cargo-make-cache
252+ with :
253+ path : |
254+ ~/.cargo/bin/cargo-make
255+ ~/.cargo/bin/cargo-make.exe
256+ key : ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }}
169257 - name : Install cargo-make
258+ if : steps.cargo-make-cache.outputs.cache-hit != 'true'
170259 uses : actions-rs/install@v0.1.2
171260 with :
172261 crate : cargo-make
173262 version : latest
174263
264+ - name : Get cargo-readme version
265+ id : cargo-readme-version
266+ run : |
267+ echo "::set-output name=hash::$(cargo search cargo-readme | grep '^cargo-readme =' | md5sum)"
268+ shell : bash
269+ - name : Attempt to load cached cargo-readme
270+ uses : actions/cache@v2
271+ id : cargo-readme-cache
272+ with :
273+ path : |
274+ ~/.cargo/bin/cargo-readme
275+ ~/.cargo/bin/cargo-readme.exe
276+ key : ${{ runner.os }}-${{ steps.cargo-readme-version.outputs.hash }}
277+ - name : Install cargo-readme
278+ if : steps.cargo-readme-cache.outputs.cache-hit != 'true'
279+ uses : actions-rs/install@v0.1.2
280+ with :
281+ crate : cargo-readme
282+ version : latest
283+
175284 # TODO(#234) re-include cache steps, also using Rust version in cache key
176285
177- - name : Build the bincode
286+ - name : Tidy
178287 uses : actions-rs/cargo@v1.0.1
179288 with :
180- command : bincode-gen-testdata
289+ command : make
290+ args : ci-job-tidy
181291
182292 # Clippy job (cargo-clippy) - completes and puts warnings inline in PR
183293 clippy :
@@ -223,7 +333,7 @@ jobs:
223333
224334 runs-on : ubuntu-latest
225335
226- needs : [build ]
336+ needs : [check ]
227337
228338 steps :
229339 - uses : actions/checkout@v2
@@ -354,7 +464,7 @@ jobs:
354464
355465 # Only run the memory benchmark if the main build succeeded. The memory benchmark does not
356466 # rely on any of the build artifacts.
357- needs : [build ]
467+ needs : [check ]
358468
359469 steps :
360470 - uses : actions/checkout@v2
@@ -451,7 +561,7 @@ jobs:
451561
452562 runs-on : ubuntu-latest
453563
454- needs : [build, lint, bincode , benchmark, memory]
564+ needs : [check, tidy , benchmark, memory]
455565
456566 # # Only create docs for merges/pushes to main (skip PRs).
457567 # # Multiple unfinished PRs should not clobber docs from approved code.
0 commit comments