From eac53361adbabfb17b30bf7f79baa7dfd0aec4d5 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Thu, 11 Apr 2024 09:08:07 -0700 Subject: [PATCH 1/4] Add uv cache busting --- action.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 893e78b..ad88033 100644 --- a/action.yml +++ b/action.yml @@ -52,14 +52,17 @@ runs: shell: bash - name: Find uv cache - run: echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV + run: | + echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV + DEPS="${{ github.action_path }}/requirements/tools.txt" + echo "REQS_HASH=$(sha256sum $DEPS | cut -d' ' -f1)" >>$GITHUB_ENV shell: bash - name: Cache uv uses: actions/cache@v4 with: path: ${{ env.UV_CACHE }} - key: ${{ runner.os }}-uv + key: baipp-${{ runner.os }}-${{ env.REQS_HASH }} - name: Create venv for tools run: > From 71526e4b814adba059d387423ac948b646a4c886 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Thu, 11 Apr 2024 09:37:41 -0700 Subject: [PATCH 2/4] We only run on Linux --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index ad88033..d7918f5 100644 --- a/action.yml +++ b/action.yml @@ -62,7 +62,7 @@ runs: uses: actions/cache@v4 with: path: ${{ env.UV_CACHE }} - key: baipp-${{ runner.os }}-${{ env.REQS_HASH }} + key: baipp-${{ env.REQS_HASH }} - name: Create venv for tools run: > From 5ea8064d273e1c7c2542edca8472f1ff3ee0cae6 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Thu, 11 Apr 2024 09:41:22 -0700 Subject: [PATCH 3/4] Add cl --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a56af1f..4daf46f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased](https://github.com/hynek/build-and-inspect-python-package/compare/v2.2.1...main) +### Added + +- Cache busting for the *uv* cache. + GitHub Actions's caching behavior is a bit idiosyncratic: + Once a cache is created, it's immutable. + But as long as it's accessed within 7 days, it never goes away. + + Therefore, *baipp* now uses the hash of the requirements file as part of the cache key. + Behaviorally, nothing changes, except that the cache doesn't grow useless over time. + [#115](https://github.com/hynek/build-and-inspect-python-package/pull/115) + ## [2.2.1](https://github.com/hynek/build-and-inspect-python-package/compare/v2.2.0...v2.2.1) - 2024-04-02 From 140f05e7240c32d1ba16da9e19307f38513c30e2 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Thu, 11 Apr 2024 09:43:47 -0700 Subject: [PATCH 4/4] Simplify --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index d7918f5..acb1e0c 100644 --- a/action.yml +++ b/action.yml @@ -51,11 +51,11 @@ runs: run: curl -LsSf https://astral.sh/uv/install.sh | sh shell: bash - - name: Find uv cache + - name: Find uv cache and hash lock file run: | echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV - DEPS="${{ github.action_path }}/requirements/tools.txt" - echo "REQS_HASH=$(sha256sum $DEPS | cut -d' ' -f1)" >>$GITHUB_ENV + + echo "REQS_HASH=$(sha256sum ${{ github.action_path }}/requirements/tools.txt | cut -d' ' -f1)" >>$GITHUB_ENV shell: bash - name: Cache uv