File tree Expand file tree Collapse file tree 2 files changed +37
-12
lines changed
Expand file tree Collapse file tree 2 files changed +37
-12
lines changed Original file line number Diff line number Diff line change 2323jobs :
2424 build :
2525 runs-on : ubuntu-latest
26+ env :
27+ PYTHON_VERSION : 3.9
28+ UV_CACHE_DIR : /tmp/.uv-cache
2629
2730 steps :
2831 - uses : actions/checkout@v4
2932
30- - name : Install python
31- uses : actions/setup-python@v4
32- id : install-python
33- with :
34- python-version : 3.9
33+ - name : Set up uv
34+ run : curl -LsSf https://astral.sh/uv/install.sh | sh
35+
36+ - name : Set up Python ${{ env.PYTHON_VERSION }}
37+ id : setup-python
38+ run : |
39+ uv python install ${{ env.PYTHON_VERSION }}
40+ uv python pin ${{ env.PYTHON_VERSION }}
41+ uv lock
42+ PY=$(uv run python -VV | shasum -a 256 | cut -d' ' -f1)
43+ echo PY: $PY
44+ echo "PY=$PY" >> "$GITHUB_OUTPUT"
3545
36- - name : Install uv
37- uses : yezz123/setup-uv@v4
38- id : install-uv
46+ - name : Restore uv cache
47+ uses : actions/cache@v4
48+ id : uv-cache
49+ with :
50+ path : /tmp/.uv-cache
51+ key : uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }}
52+ restore-keys : |
53+ uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }}
54+ uv-${{ steps.setup-python.outputs.PY }}
3955
4056 - name : Install dependencies
41- run : |
42- uv sync
57+ if : steps.uv-cache.outputs.cache-hit != 'true'
58+ run : uv sync
59+
60+ - name : Restore pre-commit cache
61+ uses : actions/cache@v4
62+ with :
63+ path : ~/.cache/pre-commit
64+ key : pre-commit-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('.pre-commit-config.yaml') }}
4365
4466 - name : Code checks
4567 run : |
46- uv run pre-commit run --all-files --show-diff-on-failure
68+ uv run pre-commit run --all-files --show-diff-on-failure
69+
70+ - name : Minimize uv cache
71+ run : uv cache prune --ci
Original file line number Diff line number Diff line change 55 - " -a ruff:ruff:v:"
66 - " -a ruff:ruff-format:v:"
77 repo : https://github.com/phi-friday/sync-uv-pre-commit
8- rev : v0.1.0
8+ rev : v0.1.1
99
1010 - hooks :
1111 - id : ruff
You can’t perform that action at this time.
0 commit comments