diff --git a/.github/workflows/ci-check-app.yml b/.github/workflows/ci-check-app.yml index 4cf1b45..e247418 100644 --- a/.github/workflows/ci-check-app.yml +++ b/.github/workflows/ci-check-app.yml @@ -84,6 +84,7 @@ jobs: components: clippy - name: Restore Cargo cache + id: cache-restore uses: actions/cache/restore@v4 with: path: | @@ -95,6 +96,10 @@ jobs: restore-keys: | ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-clippy- + - name: Clean target if Cargo.lock changed + if: steps.cache-restore.outputs.cache-hit != 'true' + run: rm -rf target/ + - name: Install Protoc if: ${{ inputs.install-protoc == true }} uses: arduino/setup-protoc@v3 @@ -135,6 +140,7 @@ jobs: components: rustfmt - name: Restore Cargo cache + id: cache-restore uses: actions/cache/restore@v4 with: path: | @@ -146,6 +152,10 @@ jobs: restore-keys: | ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-formatting- + - name: Clean target if Cargo.lock changed + if: steps.cache-restore.outputs.cache-hit != 'true' + run: rm -rf target/ + - name: Run sccache-cache if: ${{ inputs.use-sccache == true }} uses: mozilla-actions/sccache-action@v0.0.4 @@ -180,6 +190,7 @@ jobs: toolchain: ${{ inputs.rust-toolchain }} - name: Restore Cargo cache + id: cache-restore uses: actions/cache/restore@v4 with: path: | @@ -191,6 +202,10 @@ jobs: restore-keys: | ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-tests- + - name: Clean target if Cargo.lock changed + if: steps.cache-restore.outputs.cache-hit != 'true' + run: rm -rf target/ + - name: Install Protoc if: ${{ inputs.install-protoc == true }} uses: arduino/setup-protoc@v3 @@ -244,6 +259,7 @@ jobs: toolchain: ${{ inputs.rust-toolchain }} - name: Restore Cargo cache + id: cache-restore uses: actions/cache/restore@v4 with: path: | @@ -255,6 +271,10 @@ jobs: restore-keys: | ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-tests-suites- + - name: Clean target if Cargo.lock changed + if: steps.cache-restore.outputs.cache-hit != 'true' + run: rm -rf target/ + - name: Install Protoc if: ${{ inputs.install-protoc == true }} uses: arduino/setup-protoc@v3 @@ -296,6 +316,7 @@ jobs: toolchain: ${{ inputs.rust-toolchain-udeps }} - name: Restore Cargo cache + id: cache-restore uses: actions/cache/restore@v4 with: path: | @@ -307,6 +328,10 @@ jobs: restore-keys: | ${{ inputs.rust-cache-prefix }}-${{ runner.os }}-cargo-unused-deps- + - name: Clean target if Cargo.lock changed + if: steps.cache-restore.outputs.cache-hit != 'true' + run: rm -rf target/ + - name: Run sccache-cache if: ${{ inputs.use-sccache == true }} uses: mozilla-actions/sccache-action@v0.0.4 diff --git a/examples/sub-validate.yml b/examples/sub-validate.yml index 99a5dc1..91ea9ee 100644 --- a/examples/sub-validate.yml +++ b/examples/sub-validate.yml @@ -46,6 +46,7 @@ jobs: toolchain: ${{ vars.RUST_VERSION }} - name: Restore Cargo cache + id: cache-restore uses: actions/cache/restore@v4 with: path: | @@ -57,6 +58,10 @@ jobs: restore-keys: | v0-rust-${{ runner.os }}-cargo-integration- + - name: Clean target if Cargo.lock changed + if: steps.cache-restore.outputs.cache-hit != 'true' + run: rm -rf target/ + - name: "Run Integration Tests" env: PROJECT_ID: ${{ secrets.PROJECT_ID }}