1+ # bitbucket-pipelines.yml
2+ # See https://support.atlassian.com/bitbucket-cloud/docs/get-started-with-bitbucket-pipelines/
3+
4+ image: ghcr.io/astral-sh/uv:latest-python3.13-bookworm-slim
5+
6+ definitions:
7+ caches:
8+ uv: .uv-cache
9+ pip: .cache/pip
10+
11+ # Shared configuration for uv
12+ services:
13+ docker:
14+ memory: 2048
15+
16+ pipelines:
17+ # Default pipeline for pushes to any branch
18+ default:
19+ - step:
20+ name: Python Quality Checks
21+ caches:
22+ - uv
23+ - pip
24+ script:
25+ - export UV_CACHE_DIR=.uv-cache
26+ - export UV_LINK_MODE=copy
27+ - uv --version
28+ - uvx nox -s format-python
29+ - uvx nox -s lint-python
30+ - uvx nox -s typecheck
31+ - uv cache prune --ci
32+ after-script:
33+ - echo "Python quality checks completed"
34+
35+ {% if cookiecutter.add_rust_extension == 'y' -%}
36+ - step:
37+ name: Rust Quality Checks
38+ image: rust:latest
39+ script:
40+ - rustup component add rustfmt clippy
41+ - curl -LsSf https://astral.sh/uv/install.sh | sh
42+ - export PATH="$PATH:/root/.cargo/bin"
43+ - uvx nox -s format-rust
44+ - uvx nox -s lint-rust
45+ after-script:
46+ - echo "Rust quality checks completed"
47+ {%- endif %}
48+
49+ - step:
50+ name: Security Checks
51+ caches:
52+ - uv
53+ - pip
54+ script:
55+ - export UV_CACHE_DIR=.uv-cache
56+ - export UV_LINK_MODE=copy
57+ - uvx nox -s security-python
58+ - uv cache prune --ci
59+ after-script:
60+ - echo "Security checks completed"
61+
62+ # Parallel test execution across Python versions
63+ - parallel:
64+ steps:
65+ - step:
66+ name: Test Python 3.9
67+ image: ghcr.io/astral-sh/uv:latest-python3.9-bookworm-slim
68+ caches:
69+ - uv
70+ - pip
71+ script:
72+ - export UV_CACHE_DIR=.uv-cache
73+ - export UV_LINK_MODE=copy
74+ - uvx nox -s tests-python-39
75+ - uv cache prune --ci
76+ artifacts:
77+ - tests/results/*.xml
78+ - coverage.xml
79+
80+ - step:
81+ name: Test Python 3.10
82+ image: ghcr.io/astral-sh/uv:latest-python3.10-bookworm-slim
83+ caches:
84+ - uv
85+ - pip
86+ script:
87+ - export UV_CACHE_DIR=.uv-cache
88+ - export UV_LINK_MODE=copy
89+ - uvx nox -s tests-python-310
90+ - uv cache prune --ci
91+ artifacts:
92+ - tests/results/*.xml
93+ - coverage.xml
94+
95+ - step:
96+ name: Test Python 3.11
97+ image: ghcr.io/astral-sh/uv:latest-python3.11-bookworm-slim
98+ caches:
99+ - uv
100+ - pip
101+ script:
102+ - export UV_CACHE_DIR=.uv-cache
103+ - export UV_LINK_MODE=copy
104+ - uvx nox -s tests-python-311
105+ - uv cache prune --ci
106+ artifacts:
107+ - tests/results/*.xml
108+ - coverage.xml
109+
110+ - step:
111+ name: Test Python 3.12
112+ image: ghcr.io/astral-sh/uv:latest-python3.12-bookworm-slim
113+ caches:
114+ - uv
115+ - pip
116+ script:
117+ - export UV_CACHE_DIR=.uv-cache
118+ - export UV_LINK_MODE=copy
119+ - uvx nox -s tests-python-312
120+ - uv cache prune --ci
121+ artifacts:
122+ - tests/results/*.xml
123+ - coverage.xml
124+
125+ - step:
126+ name: Test Python 3.13
127+ image: ghcr.io/astral-sh/uv:latest-python3.13-bookworm-slim
128+ caches:
129+ - uv
130+ - pip
131+ script:
132+ - export UV_CACHE_DIR=.uv-cache
133+ - export UV_LINK_MODE=copy
134+ - uvx nox -s tests-python-313
135+ - uv cache prune --ci
136+ artifacts:
137+ - tests/results/*.xml
138+ - coverage.xml
139+
140+ {% if cookiecutter.add_rust_extension == 'y' -%}
141+ - step:
142+ name: Test Rust
143+ image: rust:latest
144+ script:
145+ - curl -LsSf https://astral.sh/uv/install.sh | sh
146+ - export PATH="$PATH:/root/.cargo/bin"
147+ - uvx nox -s test-rust
148+ {%- endif %}
149+
150+ # Pipeline for main/master branch
151+ branches:
152+ main:
153+ - step:
154+ name: Python Quality Checks
155+ caches:
156+ - uv
157+ - pip
158+ script:
159+ - export UV_CACHE_DIR=.uv-cache
160+ - export UV_LINK_MODE=copy
161+ - uv --version
162+ - uvx nox -s format-python
163+ - uvx nox -s lint-python
164+ - uvx nox -s typecheck
165+ - uv cache prune --ci
166+
167+ {% if cookiecutter.add_rust_extension == 'y' -%}
168+ - step:
169+ name: Rust Quality Checks
170+ image: rust:latest
171+ script:
172+ - rustup component add rustfmt clippy
173+ - curl -LsSf https://astral.sh/uv/install.sh | sh
174+ - export PATH="$PATH:/root/.cargo/bin"
175+ - uvx nox -s format-rust
176+ - uvx nox -s lint-rust
177+ {%- endif %}
178+
179+ - step:
180+ name: Security Checks
181+ caches:
182+ - uv
183+ - pip
184+ script:
185+ - export UV_CACHE_DIR=.uv-cache
186+ - export UV_LINK_MODE=copy
187+ - uvx nox -s security-python
188+ - uv cache prune --ci
189+
190+ # Parallel test execution
191+ - parallel:
192+ steps:
193+ - step:
194+ name: Test Python 3.9
195+ image: ghcr.io/astral-sh/uv:latest-python3.9-bookworm-slim
196+ caches:
197+ - uv
198+ - pip
199+ script:
200+ - export UV_CACHE_DIR=.uv-cache
201+ - export UV_LINK_MODE=copy
202+ - uvx nox -s tests-python-39
203+ - uv cache prune --ci
204+ artifacts:
205+ - tests/results/*.xml
206+ - coverage.xml
207+
208+ - step:
209+ name: Test Python 3.10
210+ image: ghcr.io/astral-sh/uv:latest-python3.10-bookworm-slim
211+ caches:
212+ - uv
213+ - pip
214+ script:
215+ - export UV_CACHE_DIR=.uv-cache
216+ - export UV_LINK_MODE=copy
217+ - uvx nox -s tests-python-310
218+ - uv cache prune --ci
219+ artifacts:
220+ - tests/results/*.xml
221+ - coverage.xml
222+
223+ - step:
224+ name: Test Python 3.11
225+ image: ghcr.io/astral-sh/uv:latest-python3.11-bookworm-slim
226+ caches:
227+ - uv
228+ - pip
229+ script:
230+ - export UV_CACHE_DIR=.uv-cache
231+ - export UV_LINK_MODE=copy
232+ - uvx nox -s tests-python-311
233+ - uv cache prune --ci
234+ artifacts:
235+ - tests/results/*.xml
236+ - coverage.xml
237+
238+ - step:
239+ name: Test Python 3.12
240+ image: ghcr.io/astral-sh/uv:latest-python3.12-bookworm-slim
241+ caches:
242+ - uv
243+ - pip
244+ script:
245+ - export UV_CACHE_DIR=.uv-cache
246+ - export UV_LINK_MODE=copy
247+ - uvx nox -s tests-python-312
248+ - uv cache prune --ci
249+ artifacts:
250+ - tests/results/*.xml
251+ - coverage.xml
252+
253+ - step:
254+ name: Test Python 3.13
255+ image: ghcr.io/astral-sh/uv:latest-python3.13-bookworm-slim
256+ caches:
257+ - uv
258+ - pip
259+ script:
260+ - export UV_CACHE_DIR=.uv-cache
261+ - export UV_LINK_MODE=copy
262+ - uvx nox -s tests-python-313
263+ - uv cache prune --ci
264+ artifacts:
265+ - tests/results/*.xml
266+ - coverage.xml
267+
268+ {% if cookiecutter.add_rust_extension == 'y' -%}
269+ - step:
270+ name: Test Rust
271+ image: rust:latest
272+ script:
273+ - curl -LsSf https://astral.sh/uv/install.sh | sh
274+ - export PATH="$PATH:/root/.cargo/bin"
275+ - uvx nox -s test-rust
276+ {%- endif %}
277+
278+ - step:
279+ name: Build Package
280+ caches:
281+ - uv
282+ - pip
283+ script:
284+ - export UV_CACHE_DIR=.uv-cache
285+ - export UV_LINK_MODE=copy
286+ - uvx nox -s build-python
287+ - uv cache prune --ci
288+ artifacts:
289+ - dist/**
290+
291+ # Pipeline for pull requests
292+ pull-requests:
293+ '**':
294+ - step:
295+ name: Python Quality Checks
296+ caches:
297+ - uv
298+ - pip
299+ script:
300+ - export UV_CACHE_DIR=.uv-cache
301+ - export UV_LINK_MODE=copy
302+ - uv --version
303+ - uvx nox -s format-python
304+ - uvx nox -s lint-python
305+ - uvx nox -s typecheck
306+ - uv cache prune --ci
307+
308+ {% if cookiecutter.add_rust_extension == 'y' -%}
309+ - step:
310+ name: Rust Quality Checks
311+ image: rust:latest
312+ script:
313+ - rustup component add rustfmt clippy
314+ - curl -LsSf https://astral.sh/uv/install.sh | sh
315+ - export PATH="$PATH:/root/.cargo/bin"
316+ - uvx nox -s format-rust
317+ - uvx nox -s lint-rust
318+ {%- endif %}
319+
320+ - step:
321+ name: Security Checks
322+ caches:
323+ - uv
324+ - pip
325+ script:
326+ - export UV_CACHE_DIR=.uv-cache
327+ - export UV_LINK_MODE=copy
328+ - uvx nox -s security-python
329+ - uv cache prune --ci
330+
331+ # Parallel test execution for PRs (reduced matrix for speed)
332+ - parallel:
333+ steps:
334+ - step:
335+ name: Test Python 3.9
336+ image: ghcr.io/astral-sh/uv:latest-python3.9-bookworm-slim
337+ caches:
338+ - uv
339+ - pip
340+ script:
341+ - export UV_CACHE_DIR=.uv-cache
342+ - export UV_LINK_MODE=copy
343+ - uvx nox -s tests-python-39
344+ - uv cache prune --ci
345+
346+ - step:
347+ name: Test Python 3.13
348+ image: ghcr.io/astral-sh/uv:latest-python3.13-bookworm-slim
349+ caches:
350+ - uv
351+ - pip
352+ script:
353+ - export UV_CACHE_DIR=.uv-cache
354+ - export UV_LINK_MODE=copy
355+ - uvx nox -s tests-python-313
356+ - uv cache prune --ci
357+
358+ {% if cookiecutter.add_rust_extension == 'y' -%}
359+ - step:
360+ name: Test Rust
361+ image: rust:latest
362+ script:
363+ - curl -LsSf https://astral.sh/uv/install.sh | sh
364+ - export PATH="$PATH:/root/.cargo/bin"
365+ - uvx nox -s test-rust
366+ {%- endif %}
367+
368+ # Pipeline for tags (releases)
369+ tags:
370+ 'v*':
371+ - step:
372+ name: Build and Release
373+ caches:
374+ - uv
375+ - pip
376+ script:
377+ - export UV_CACHE_DIR=.uv-cache
378+ - export UV_LINK_MODE=copy
379+ - uvx nox -s build-python
380+ - uvx nox -s publish-python
381+ - uv cache prune --ci
382+ artifacts:
383+ - dist/**
0 commit comments