|
1 | 1 | name: 'Setup UV with Cache' |
2 | | -description: 'Install UV and restore cached environment' |
| 2 | +description: 'Install UV + restore the project venv; sync only on a cache miss' |
3 | 3 | inputs: |
4 | 4 | cache-key: |
5 | | - description: 'Cache key for UV environment' |
| 5 | + description: 'Cache key for the .venv (from the caller''s setup-cache job).' |
6 | 6 | required: true |
7 | 7 | fail-on-cache-miss: |
8 | | - description: 'Whether to fail if cache is not found' |
| 8 | + description: 'Fail if the .venv cache is not found.' |
9 | 9 | required: false |
10 | | - default: 'true' |
| 10 | + default: 'false' |
11 | 11 |
|
12 | 12 | runs: |
13 | 13 | using: 'composite' |
14 | 14 | steps: |
| 15 | + # Pin the interpreter BEFORE uv so uv never tries to fetch/build a Python. |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 |
| 18 | + with: |
| 19 | + python-version: '3.12' |
| 20 | + |
| 21 | + # setup-uv's native cache warms UV_CACHE_DIR (the wheel/download cache uv |
| 22 | + # actually uses), keyed on uv.lock, so a cold sync links wheels instead of |
| 23 | + # downloading them. |
15 | 24 | - name: Install UV |
16 | 25 | uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 |
| 26 | + with: |
| 27 | + version: "0.9.6" |
| 28 | + enable-cache: true |
| 29 | + cache-dependency-glob: "uv.lock" |
17 | 30 |
|
18 | | - - name: Restore UV environment |
19 | | - id: restore-cache |
| 31 | + # Restore the fully-built .venv so a warm hit skips `uv sync` entirely. |
| 32 | + - name: Restore project venv |
| 33 | + id: restore-venv |
20 | 34 | uses: actions/cache/restore@a7833574556fa59680c1b7cb190c1735db73ebf0 # v5.0.0 |
21 | 35 | with: |
22 | | - path: | |
23 | | - .venv |
24 | | - ~/.cache/uv |
25 | | - ~/.local/bin/uv |
26 | | - /opt/hostedtoolcache/uv |
| 36 | + path: .venv |
27 | 37 | key: ${{ inputs.cache-key }} |
28 | 38 | fail-on-cache-miss: ${{ inputs.fail-on-cache-miss }} |
29 | 39 |
|
30 | | - - name: Install dependencies if cache miss |
31 | | - if: steps.restore-cache.outputs.cache-hit != 'true' |
| 40 | + # Only sync on a .venv miss. ORB_SKIP_UI_BUILD is CRITICAL: `uv sync` builds |
| 41 | + # the orb-py package → setup.py build hook → build_ui.sh (reflex + bun) → a |
| 42 | + # >30-min SPA build that times the job out. These jobs don't need the SPA. |
| 43 | + - name: Install dependencies (on venv cache miss) |
| 44 | + if: steps.restore-venv.outputs.cache-hit != 'true' |
32 | 45 | shell: bash |
33 | | - run: make dev-install |
| 46 | + env: |
| 47 | + ORB_SKIP_UI_BUILD: "1" |
| 48 | + run: uv sync --frozen --all-groups |
0 commit comments