Skip to content

Commit a3388dc

Browse files
authored
Add uv cache busting (#115)
* Add uv cache busting * We only run on Linux * Add cl * Simplify
1 parent fb2942d commit a3388dc

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77

88
## [Unreleased](https://github.com/hynek/build-and-inspect-python-package/compare/v2.2.1...main)
99

10+
### Added
11+
12+
- Cache busting for the *uv* cache.
13+
GitHub Actions's caching behavior is a bit idiosyncratic:
14+
Once a cache is created, it's immutable.
15+
But as long as it's accessed within 7 days, it never goes away.
16+
17+
Therefore, *baipp* now uses the hash of the requirements file as part of the cache key.
18+
Behaviorally, nothing changes, except that the cache doesn't grow useless over time.
19+
[#115](https://github.com/hynek/build-and-inspect-python-package/pull/115)
20+
1021

1122
## [2.2.1](https://github.com/hynek/build-and-inspect-python-package/compare/v2.2.0...v2.2.1) - 2024-04-02
1223

action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,18 @@ runs:
5151
run: curl -LsSf https://astral.sh/uv/install.sh | sh
5252
shell: bash
5353

54-
- name: Find uv cache
55-
run: echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV
54+
- name: Find uv cache and hash lock file
55+
run: |
56+
echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV
57+
58+
echo "REQS_HASH=$(sha256sum ${{ github.action_path }}/requirements/tools.txt | cut -d' ' -f1)" >>$GITHUB_ENV
5659
shell: bash
5760

5861
- name: Cache uv
5962
uses: actions/cache@v4
6063
with:
6164
path: ${{ env.UV_CACHE }}
62-
key: ${{ runner.os }}-uv
65+
key: baipp-${{ env.REQS_HASH }}
6366

6467
- name: Create venv for tools
6568
run: >

0 commit comments

Comments
 (0)