1818 - " uv.lock"
1919 - " pyproject.toml"
2020 - " .pre-commit-config.yaml"
21- pull_request : # TEMPORARY: remove after testing
2221 schedule :
2322 - cron : " 0 6 * * *" # Daily at 06:00 UTC
2423 workflow_dispatch :
4140
4241 env :
4342 UV_FROZEN : " 1"
44- # Pin cache dir so setup-uv doesn't override it to a temp path.
45- # Must match the path in setup-python-deps/action.yml cache restore.
46- UV_CACHE_DIR : /home/runner/.cache/uv
4743
4844 steps :
4945 - name : Checkout main branch
6561
6662 echo "Warming cache for PR #${{ inputs.pr_number }} from ${FORK_REPO}@${FORK_REF}"
6763
68- # Fetch only lockfiles from the fork — .github/actions/ always
69- # comes from main to prevent code injection from forks.
7064 git remote add fork "https://github.com/${FORK_REPO}.git"
7165 git fetch --depth=1 fork "${FORK_REF}"
7266 git checkout FETCH_HEAD -- uv.lock pyproject.toml .pre-commit-config.yaml
@@ -81,14 +75,16 @@ jobs:
8175
8276 - name : Install uv
8377 uses : astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
78+ with :
79+ cache-local-path : ~/.cache/uv
8480
8581 - name : Install Hatch
8682 uses : pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc # install
8783
8884 - name : Install Python versions for test matrix
89- run : uv python install 3.10 3. 11 3.12 3.13
85+ run : uv python install 3.11 3.12 3.13
9086
91- - name : Create all hatch environments (populates uv cache)
87+ - name : Create hatch environments (populates uv cache)
9288 run : |
9389 set -euo pipefail
9490 hatch env create default
@@ -101,21 +97,31 @@ jobs:
10197 - name : Warm pre-commit cache
10298 run : hatch run pre-commit install-hooks
10399
104- - name : Build and warm pip cache for verify environment
100+ - name : Create pip wheelhouse
105101 run : |
106102 set -euo pipefail
107- hatch -v build
108- # Run verify to populate ~/.cache/pip/ with runtime transitive deps.
109- # Allow failure — we only care about populating the cache.
110- hatch run verify:check-all || true
103+ mkdir -p ~/.cache/pip-wheelhouse
104+ hatch run python -c "
105+ try:
106+ import tomllib
107+ except ImportError:
108+ import tomli as tomllib
109+ with open('pyproject.toml', 'rb') as f:
110+ data = tomllib.load(f)
111+ for dep in data['project']['dependencies']:
112+ print(dep)
113+ " > /tmp/runtime-deps.txt
114+ hatch run pip download --dest ~/.cache/pip-wheelhouse \
115+ setuptools wheel twine check-wheel-contents \
116+ -r /tmp/runtime-deps.txt
117+
118+ - name : Build package
119+ run : hatch -v build
111120
112121 - name : Generate cache key
113122 id : cache-key
114123 shell : bash
115124 run : |
116- # Hash first so consumers can prefix-match on the hash alone.
117- # Timestamp suffix ensures each run creates a new immutable entry;
118- # consumers pick the latest timestamp for a given hash.
119125 TIMESTAMP=$(date -u +%Y%m%d%H%M%S)
120126 LOCK_HASH="${{ hashFiles('uv.lock', 'pyproject.toml') }}"
121127 echo "python-deps-key=python-deps-${LOCK_HASH}-${TIMESTAMP}" >> "$GITHUB_OUTPUT"
@@ -129,6 +135,7 @@ jobs:
129135 path : |
130136 ~/.cache/uv
131137 ~/.cache/pip
138+ ~/.cache/pip-wheelhouse
132139 key : ${{ steps.cache-key.outputs.python-deps-key }}
133140
134141 - name : Save pre-commit cache
0 commit comments