@@ -5,7 +5,20 @@ description: .
5
5
inputs :
6
6
python-version :
7
7
description : The python version to install
8
- required : true
8
+ required : false
9
+ default : ' 3.8'
10
+ use-cached-uv-lock :
11
+ description : Whether to download the uv lock cache.
12
+ required : false
13
+ default : ' true'
14
+ update-uv-lock :
15
+ description : Whether to update the uv lock file. Allows the cache to fail.
16
+ required : false
17
+ default : ' false'
18
+ uv-resolution-strategy :
19
+ description : The uv resolution strategy to use. See https://docs.astral.sh/uv/reference/environment/#uv_resolution for details.
20
+ required : false
21
+ default : ' highest'
9
22
outputs :
10
23
python-version :
11
24
description : The python version that was installed.
@@ -14,32 +27,52 @@ outputs:
14
27
runs :
15
28
using : composite
16
29
steps :
17
- - name : Set up pdm with python ${{ inputs.python-version }}
30
+ - name : Download uv lock
31
+ uses : actions/cache/restore@v4
32
+ if : ${{ inputs.use-cached-uv-lock != 'false' }}
33
+ id : restore-uv-lock
34
+ with :
35
+ key : uv-lock-resolved-${{ inputs.uv-resolution-strategy }}
36
+ path : uv.lock
37
+ restore-keys : |
38
+ uv-lock-resolved-${{ inputs.uv-resolution-strategy }}
39
+ enableCrossOsArchive : true
40
+ fail-on-cache-miss : ${{ inputs.update-uv-lock != 'true' }}
41
+
42
+ - name : Set up uv with python ${{ inputs.python-version }}
18
43
id : setup-python
19
- uses : pdm-project /setup-pdm@v4
44
+ uses : astral-sh /setup-uv@v6
20
45
with :
46
+ version : ' 0.8.14'
47
+ enable-cache : true
48
+ # this doesn't install python but pins the uv version; its the same as providing UV_PYTHON
21
49
python-version : ${{ inputs.python-version }}
22
- version : " 2.20.1" # last version to support python 3.8
23
- cache : false
24
50
25
- - name : Disable PDM version check
51
+ - name : Install python ${{ inputs.python- version }}
26
52
shell : bash
53
+ env :
54
+ UV_PYTHON_DOWNLOADS : automatic
27
55
run : |
28
- pdm config check_update false
56
+ uv python install ${{ inputs.python-version }}
29
57
30
- - name : Ignore saved pythons
58
+ - name : Install nox
31
59
shell : bash
32
60
run : |
33
- echo "PDM_IGNORE_SAVED_PYTHON=1" >> $GITHUB_ENV
61
+ uv tool install nox
34
62
35
- - name : Install nox
63
+ - name : Lock dependencies
64
+ id : lock-uv-deps
65
+ if : ${{ inputs.update-uv-lock }}
36
66
shell : bash
37
- run : pip install nox
67
+ env :
68
+ UV_LOCKED : 0
69
+ run : uv lock --refresh
38
70
39
71
- name : Set python version
40
72
id : python-version
41
73
shell : bash
42
- run : echo "python-version=$(python -c 'import sys; print(".".join(map(str,sys.version_info[:2])))')" >> $GITHUB_OUTPUT
43
-
44
- - name : Configure cache
45
- uses : ./.github/actions/cache-pdm
74
+ env :
75
+ UV_VENV_CLEAR : 1
76
+ run : |
77
+ uv venv .venv
78
+ echo "python-version=$(uv run python -c 'import sys; print(".".join(map(str,sys.version_info[:2])))')" >> $GITHUB_OUTPUT
0 commit comments