8484 components : clippy
8585
8686 - name : Restore Cargo cache
87+ id : cache-restore
8788 uses : actions/cache/restore@v4
8889 with :
8990 path : |
9596 restore-keys : |
9697 ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-clippy-
9798
99+ - name : Clean target if Cargo.lock changed
100+ if : steps.cache-restore.outputs.cache-hit != 'true'
101+ run : rm -rf target/
102+
98103 - name : Install Protoc
99104 if : ${{ inputs.install-protoc == true }}
100105 uses : arduino/setup-protoc@v3
@@ -135,6 +140,7 @@ jobs:
135140 components : rustfmt
136141
137142 - name : Restore Cargo cache
143+ id : cache-restore
138144 uses : actions/cache/restore@v4
139145 with :
140146 path : |
@@ -146,6 +152,10 @@ jobs:
146152 restore-keys : |
147153 ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-formatting-
148154
155+ - name : Clean target if Cargo.lock changed
156+ if : steps.cache-restore.outputs.cache-hit != 'true'
157+ run : rm -rf target/
158+
149159 - name : Run sccache-cache
150160 if : ${{ inputs.use-sccache == true }}
151161 uses : mozilla-actions/sccache-action@v0.0.4
@@ -180,6 +190,7 @@ jobs:
180190 toolchain : ${{ inputs.rust-toolchain }}
181191
182192 - name : Restore Cargo cache
193+ id : cache-restore
183194 uses : actions/cache/restore@v4
184195 with :
185196 path : |
@@ -191,6 +202,10 @@ jobs:
191202 restore-keys : |
192203 ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-tests-
193204
205+ - name : Clean target if Cargo.lock changed
206+ if : steps.cache-restore.outputs.cache-hit != 'true'
207+ run : rm -rf target/
208+
194209 - name : Install Protoc
195210 if : ${{ inputs.install-protoc == true }}
196211 uses : arduino/setup-protoc@v3
@@ -244,6 +259,7 @@ jobs:
244259 toolchain : ${{ inputs.rust-toolchain }}
245260
246261 - name : Restore Cargo cache
262+ id : cache-restore
247263 uses : actions/cache/restore@v4
248264 with :
249265 path : |
@@ -255,6 +271,10 @@ jobs:
255271 restore-keys : |
256272 ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-tests-suites-
257273
274+ - name : Clean target if Cargo.lock changed
275+ if : steps.cache-restore.outputs.cache-hit != 'true'
276+ run : rm -rf target/
277+
258278 - name : Install Protoc
259279 if : ${{ inputs.install-protoc == true }}
260280 uses : arduino/setup-protoc@v3
@@ -296,6 +316,7 @@ jobs:
296316 toolchain : ${{ inputs.rust-toolchain-udeps }}
297317
298318 - name : Restore Cargo cache
319+ id : cache-restore
299320 uses : actions/cache/restore@v4
300321 with :
301322 path : |
@@ -307,6 +328,10 @@ jobs:
307328 restore-keys : |
308329 ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-unused-deps-
309330
331+ - name : Clean target if Cargo.lock changed
332+ if : steps.cache-restore.outputs.cache-hit != 'true'
333+ run : rm -rf target/
334+
310335 - name : Run sccache-cache
311336 if : ${{ inputs.use-sccache == true }}
312337 uses : mozilla-actions/sccache-action@v0.0.4
0 commit comments