@@ -15,9 +15,12 @@ various Docker images with pre-installed ``uv``: `Available images
1515 :linenos :
1616
1717 variables :
18- UV_VERSION : 0.4
19- PYTHON_VERSION : 3.12
20- BASE_LAYER : bookworm-slim
18+ UV_VERSION : 0.11
19+ PYTHON_VERSION : 3.14
20+ BASE_LAYER : trixie-slim
21+ # GitLab CI creates a separate mountpoint for the build directory,
22+ # so we need to copy instead of using hard links.
23+ UV_LINK_MODE : copy
2124
2225
2326 stages :
@@ -38,7 +41,7 @@ various Docker images with pre-installed ``uv``: `Available images
3841 # YOUR UV COMMANDS
3942 - uv cache prune --ci
4043
41- Line 23
44+ Line 25
4245 This reduces the cache size, see also `Caching in continuous integration
4346 <https://docs.astral.sh/uv/concepts/cache/#caching-in-continuous-integration> `_.
4447
@@ -66,12 +69,13 @@ installed packages:
6669 runs-on : ubuntu-latest
6770
6871 steps :
69- - uses : actions/checkout@v4
72+ - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
73+ with :
74+ persist-credentials : false
7075
71- - name : Install uv
72- uses : astral-sh/setup-uv@v3
73- with :
74- version : " 0.4.24"
76+ - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
77+ with :
78+ persist-credentials : false
7579
7680 You can then install either a single Python version or a matrix with uv:
7781
8892.. code-block :: yaml
8993 :caption : ci.yml
9094
91- - name : Set up Python
92- uses : actions/setup-python@v5
93- with :
94- python-version-file : " .python-version"
95+ - uses : actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
96+ with :
97+ python-version-file : .python-version
9598
9699 or
97100
98101.. code-block :: yaml
99102 :caption : ci.yml
100103
101- name : ci
102-
103104 strategy :
104105 matrix :
105106 python-version :
106- - " 3.9 "
107+
107108 - " 3.10"
108109 - " 3.11"
109110 - " 3.12"
110111 - " 3.13"
112+ - " 3.14"
111113
112- jobs :
113- test :
114- name : python
115- # ...
116- - name : Set up Python ${{ matrix.python-version }}
117- run : uv python install ${{ matrix.python-version }}
114+ steps :
115+ - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
116+ - name : Install uv and set the Python version
117+ uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
118+ with :
119+ python-version : ${{ matrix.python-version }}
118120
119121 .. seealso ::
120122 * `Using uv in GitHub Actions
@@ -130,11 +132,11 @@ and commands can be executed in the environment with ``uv run``, for example for
130132.. code-block :: yaml
131133 :caption : ci.yml
132134
133- - name : Install the project
134- run : uv sync --all-extras --dev
135+ - name : Install the project
136+ run : uv sync --group tests
135137
136- - name : Run tests
137- run : uv run pytest tests
138+ - name : Run tests
139+ run : uv run pytest
138140
139141 Caching
140142~~~~~~~
@@ -144,18 +146,19 @@ The uv cache improves runtimes:
144146.. code-block :: yaml
145147 :caption : ci.yml
146148
147- - name : Enable caching
148- uses : astral-sh/setup-uv@v3
149- with :
150- enable-cache : true
149+ - name : Enable caching
150+ uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
151+ with :
152+ enable-cache : true
151153
152154 Invalidates the cache if :file: `uv.lock ` changes:
153155
154156.. code-block :: yaml
155157 :caption : ci.yml
156158
157- - name : Define a cache dependency glob
158- uses : astral-sh/setup-uv@v3
159- with :
160- enable-cache : true
161- cache-dependency-glob : " uv.lock"
159+ - name : Define a cache dependency glob
160+ uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
161+
162+ with :
163+ enable-cache : true
164+ cache-dependency-glob : " uv.lock"
0 commit comments