Skip to content

Commit

Permalink
Add uv cache busting (#115)
Browse files Browse the repository at this point in the history
* Add uv cache busting

* We only run on Linux

* Add cl

* Simplify
  • Loading branch information
hynek committed Apr 11, 2024
1 parent fb2942d commit a3388dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@ runs:
run: curl -LsSf https://astral.sh/uv/install.sh | sh
shell: bash

- name: Find uv cache
run: echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV
- name: Find uv cache and hash lock file
run: |
echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV
echo "REQS_HASH=$(sha256sum ${{ github.action_path }}/requirements/tools.txt | 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-${{ env.REQS_HASH }}

- name: Create venv for tools
run: >
Expand Down

0 comments on commit a3388dc

Please sign in to comment.