From 6421cac7bf6a4c0036d9ddb78587de02f3bfea56 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Wed, 24 Apr 2024 21:00:47 +0100 Subject: [PATCH 1/6] Because they should only slightly diff from main --- .github/workflows/rust.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ecd2bbe..2ef4c3e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -21,7 +21,7 @@ jobs: components: rustfmt - uses: Swatinem/rust-cache@v2 - name: Load results cache - uses: pat-s/always-upload-cache@v3.0.11 + uses: pat-s/always-upload-cache/restore@v3.0.11 with: path: results/*.yaml key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }} @@ -39,3 +39,11 @@ jobs: USERNAME_FOR_GITHUB: ${{ secrets.USERNAME_FOR_GITHUB }} TOKEN_FOR_GITHUB: ${{ secrets.TOKEN_FOR_GITHUB }} RUST_LOG: warn + - name: Save results cache + uses: pat-s/always-upload-cache/save@v3.0.11 + if: github.ref == 'refs/heads/main' + with: + path: results/*.yaml + key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }} + + From a548c5d2355dee5e38b379ac7d357b0c61dc189c Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Wed, 24 Apr 2024 21:10:15 +0100 Subject: [PATCH 2/6] Use upstream cache --- .github/workflows/rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2ef4c3e..5203807 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -21,7 +21,7 @@ jobs: components: rustfmt - uses: Swatinem/rust-cache@v2 - name: Load results cache - uses: pat-s/always-upload-cache/restore@v3.0.11 + uses: actions/cache/restore@v4 with: path: results/*.yaml key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }} @@ -40,8 +40,8 @@ jobs: TOKEN_FOR_GITHUB: ${{ secrets.TOKEN_FOR_GITHUB }} RUST_LOG: warn - name: Save results cache - uses: pat-s/always-upload-cache/save@v3.0.11 - if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/only-cache-results-on-main' with: path: results/*.yaml key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }} From 3107b04f30ba702615d4f793f6541ed0a5e4298b Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Wed, 24 Apr 2024 21:13:11 +0100 Subject: [PATCH 3/6] Add branch ref by id --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5203807..9eacc54 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -41,7 +41,7 @@ jobs: RUST_LOG: warn - name: Save results cache uses: actions/cache/save@v4 - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/only-cache-results-on-main' + if: github.ref == 'refs/heads/main' || github.ref == 'refs/pull/1716/merge' with: path: results/*.yaml key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }} From bafae0bdeb89f52a3597ece883bc0f093c6749e8 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Wed, 24 Apr 2024 21:14:52 +0100 Subject: [PATCH 4/6] Add always check --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9eacc54..9803162 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -41,7 +41,7 @@ jobs: RUST_LOG: warn - name: Save results cache uses: actions/cache/save@v4 - if: github.ref == 'refs/heads/main' || github.ref == 'refs/pull/1716/merge' + if: always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/pull/1716/merge') with: path: results/*.yaml key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }} From 5e8c558e88e625e2e48219d32899275d6b45f9a9 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Wed, 24 Apr 2024 21:18:55 +0100 Subject: [PATCH 5/6] Make key unique per run attempt --- .github/workflows/rust.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9803162..21f8dec 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,8 +24,9 @@ jobs: uses: actions/cache/restore@v4 with: path: results/*.yaml - key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }} + key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }}-${{ github.run_attempt }} restore-keys: | + results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }}- results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}- results-${{ hashFiles('Cargo.lock') }}- results- @@ -44,6 +45,6 @@ jobs: if: always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/pull/1716/merge') with: path: results/*.yaml - key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }} + key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }}-${{ github.run_attempt }} From 0524a09fbb46ade282a5f50056dcf76f62d815a5 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Wed, 24 Apr 2024 21:19:36 +0100 Subject: [PATCH 6/6] Remove extra spacing from CI config --- .github/workflows/rust.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 21f8dec..4ef4a57 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -46,5 +46,3 @@ jobs: with: path: results/*.yaml key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }}-${{ github.run_attempt }} - -