From f109a708bb3cead9d1a83480e65f58e890bf471c Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 4 May 2026 05:58:47 +0200 Subject: [PATCH] ci: do not store Rust cache from PRs caches only dependencies, and dependencies don't change most of the time, so PRs store the same cache as already stored by the main branch commit PRs are based on. Hash of Cargo.{toml,lock} is part of the cache key, so for dependency updating PRs the cache key is new. Such PRs rebuild everything from scratch, which is a separate problem. Storing such cache from PR is however not useful because most of the time dependency updating PR is going to be rebased again before merging as Dependabot PRs are opened in a batch and then merged one by one while Dependabot rebases remaining PRs. --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1b69bb17..f6af3bf63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,8 @@ jobs: shell: bash - name: Cache rust cargo artifacts uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} - name: Run rustfmt run: cargo fmt --all -- --check - name: Run clippy @@ -92,6 +94,8 @@ jobs: persist-credentials: false - name: Cache rust cargo artifacts uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} - name: Rustdoc run: cargo doc --document-private-items --no-deps @@ -135,6 +139,8 @@ jobs: - name: Cache rust cargo artifacts uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} - name: Install nextest uses: taiki-e/install-action@5f57d6cb7cd20b14a8a27f522884c4bc8a187458 @@ -169,6 +175,8 @@ jobs: - name: Cache rust cargo artifacts uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} - name: Build C library run: cargo build -p deltachat_ffi @@ -195,6 +203,8 @@ jobs: - name: Cache rust cargo artifacts uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} - name: Build deltachat-rpc-server run: cargo build -p deltachat-rpc-server