Skip to content

Commit 3c96f9a

Browse files
committed
refactor: move some script checks and clean up into the uv-cache anchor
1 parent 352e90e commit 3c96f9a

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

{{cookiecutter.project_name}}/.gitlab-ci.yml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ stages:
3232
- $UV_CACHE_DIR
3333
- $PIP_CACHE_DIR
3434
policy: pull-push
35+
before_script:
36+
- uv --version
37+
after_script:
38+
- uv cache prune --ci
3539

3640
# Shared rules for when to run jobs
3741
.on-merge-requests-and-main: &on-merge-requests-and-main
@@ -91,10 +95,6 @@ stages:
9195
stage: quality
9296
<<: *uv-cache
9397
<<: *on-merge-requests-and-main
94-
before_script:
95-
- uv --version
96-
after_script:
97-
- uv cache prune --ci
9898

9999
# Python Quality Checks Job
100100
quality-python:
@@ -116,12 +116,8 @@ typecheck-python:
116116
matrix:
117117
- PYTHON_VERSION: ["3.9", "3.10", "3.11", "3.12", "3.13"]
118118
image: ghcr.io/astral-sh/uv:latest-python$PYTHON_VERSION-bookworm-slim
119-
before_script:
120-
- uv --version
121119
script:
122120
- uvx nox -s typecheck-$PYTHON_VERSION
123-
after_script:
124-
- uv cache prune --ci
125121
rules:
126122
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
127123
changes: *python-typecheck-files
@@ -136,8 +132,6 @@ security-python:
136132
<<: *uv-cache
137133
script:
138134
- uvx nox -s security-python
139-
after_script:
140-
- uv cache prune --ci
141135
allow_failure: true
142136
rules:
143137
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
@@ -157,8 +151,6 @@ test-python:
157151
image: ghcr.io/astral-sh/uv:latest-python$PYTHON_VERSION-bookworm-slim
158152
script:
159153
- uvx nox -s tests-python-${PYTHON_VERSION//.}
160-
after_script:
161-
- uv cache prune --ci
162154
artifacts:
163155
reports:
164156
junit: tests/results/*.xml
@@ -280,8 +272,6 @@ build-python:
280272
<<: *uv-cache
281273
script:
282274
- uvx nox -s build-python
283-
after_script:
284-
- uv cache prune --ci
285275
artifacts:
286276
paths:
287277
- dist/
@@ -297,8 +287,6 @@ build-docs:
297287
<<: *uv-cache
298288
script:
299289
- uvx nox -s build-docs
300-
after_script:
301-
- uv cache prune --ci
302290
artifacts:
303291
paths:
304292
- docs/_build/html/
@@ -318,8 +306,6 @@ pages:
318306
script:
319307
- uvx nox -s build-docs
320308
- mv docs/_build/html public
321-
after_script:
322-
- uv cache prune --ci
323309
artifacts:
324310
paths:
325311
- public
@@ -335,8 +321,6 @@ test-release-python:
335321
script:
336322
- export PYPI_URL=https://test.pypi.org/legacy/
337323
- uvx nox -s publish-python
338-
after_script:
339-
- uv cache prune --ci
340324
rules:
341325
- if: $CI_COMMIT_TAG
342326
environment:
@@ -349,8 +333,6 @@ release-python:
349333
<<: *uv-cache
350334
script:
351335
- uvx nox -s publish-python
352-
after_script:
353-
- uv cache prune --ci
354336
rules:
355337
- if: $CI_COMMIT_TAG
356338
environment:

0 commit comments

Comments
 (0)