@@ -2,55 +2,305 @@ version: 2.1
22orbs :
33 python : circleci/python@dev:<<pipeline.git.revision>>
44 orb-tools :
circleci/[email protected] 5- windows : circleci/windows@5
5+ filters : &filters
6+ tags :
7+ only : /.*/
8+ parameters :
9+ cache-version :
10+ type : string
11+ default : v4
612
713executors :
8- linux :
9- docker :
10- - image : cimg/python:3.12
11- resource_class : small
14+ macos :
15+ macos :
16+ xcode : 16.1
1217
13- commands :
14- python-install-pipenv-packages :
18+ jobs :
19+ pip-install-test :
20+ parameters :
21+ executor :
22+ type : executor
23+ default : python/default
24+ executor : << parameters.executor >>
1525 steps :
26+ - checkout
1627 - python/install-packages :
17- app-dir : sample_pipenv
18- pkg-manager : pipenv
19- include-branch-in-cache-key : false
20- args : --dev
21- install-python-on-windows :
28+ pkg-manager : pip
29+ cache-version : << pipeline.parameters.cache-version >>
30+ app-dir : ~/project/sample_pip
31+ - run :
32+ name : " Test"
33+ working_directory : ~/project/sample_pip
34+ command : |
35+ pytest
36+ pip-install-rel-dir :
37+ executor : python/default
2238 steps :
39+ - checkout
40+ - python/install-packages :
41+ pkg-manager : pip
42+ cache-version : << pipeline.parameters.cache-version >>
43+ app-dir : " ./sample_pip"
2344 - run :
24- name : Install Python 3.12
45+ name : " Test"
46+ working_directory : ~/project/sample_pip
2547 command : |
26- set -euxo pipefail
27- choco feature enable -n allowGlobalConfirmation
28- # skip python install if we already have something that's good enough
29- if ! python --version | grep -q 'Python 3\.12'; then
30- choco upgrade python312 --package-parameters="/NoLockdown"
31- fi
32- pip install pipenv
33-
34- jobs :
35- python-cache-dependencies :
48+ pytest
49+ pip-install-test-no-packages :
50+ executor : python/default
51+ steps :
52+ - checkout
53+ - run :
54+ name : " Test"
55+ working_directory : ~/project/sample_pip
56+ command : |
57+ pytest
58+ pip-install-test-args :
59+ executor : python/default
60+ steps :
61+ - checkout
62+ - python/install-packages :
63+ pkg-manager : pip
64+ app-dir : ~/project/sample_pip
65+ cache-version : << pipeline.parameters.cache-version >>
66+ args : pytest
67+ pip-dependency-file : " "
68+ - run :
69+ name : " Test"
70+ working_directory : ~/project/sample_pip
71+ command : |
72+ pytest
73+ dist-test :
74+ executor : python/default
3675 parameters :
37- executor :
38- type : executor
39- executor : << parameters.executor >>
76+ build-tool :
77+ type : enum
78+ enum : ["wheel", "build"]
79+ default : " wheel"
80+ description : Build command to run.
4081 steps :
4182 - checkout
42- - python-install-pipenv-packages
43-
83+ - python/dist :
84+ build-tool : << parameters.build-tool >>
85+ app-dir : ~/project/sample_pip
86+ dist-test-build-opts :
87+ executor : python/default
88+ steps :
89+ - checkout
90+ - python/dist :
91+ build-tool : build
92+ wheel-separate : true
93+ sdist-separate : true
94+ no-isolation : true
95+ skip-dependency-check : true
96+ app-dir : ~/project/sample_pip
97+ pipenv-test :
98+ executor : python/default
99+ steps :
100+ - checkout
101+ - python/install-packages :
102+ app-dir : ~/project/sample_pipenv
103+ pkg-manager : " pipenv"
104+ cache-version : << pipeline.parameters.cache-version >>
105+ - run :
106+ working_directory : ~/project/sample_pipenv
107+ command : |
108+ cp Pipfile.lock Pipfile.lock.tmp
109+ cp Pipfile Pipfile.tmp
110+ pipenv run pytest --version
111+ name : Ensure pipenv is working and copy lock file for cache testing
112+ - run :
113+ command : pipenv install pytest==4.6.1
114+ working_directory : ~/project/sample_pipenv
115+ - run :
116+ working_directory : ~/project/sample_pipenv
117+ command : |
118+ cp Pipfile.lock.tmp Pipfile.lock
119+ cp Pipfile.tmp Pipfile
120+ name : Overwrite the lockfile with the one that should load the cache.
121+ - python/install-packages :
122+ app-dir : ~/project/sample_pipenv
123+ pkg-manager : " pipenv"
124+ pypi-cache : false
125+ venv-cache : false
126+ cache-version : << pipeline.parameters.cache-version >>
127+ - run :
128+ command : pipenv run pytest
129+ working_directory : ~/project/sample_pipenv
130+ poetry-test :
131+ executor : python/default
132+ steps :
133+ - checkout
134+ - python/install-packages :
135+ app-dir : ~/project/sample_poetry
136+ cache-version : << pipeline.parameters.cache-version >>
137+ pkg-manager : poetry
138+ - run :
139+ working_directory : ~/project/sample_poetry
140+ command : |-
141+ poetry run pytest
44142workflows :
45- build-and- test :
143+ test-deploy :
46144 jobs :
47- - python-cache-dependencies :
48- name : server cache dependencies linux
49- executor : linux
50- - python-cache-dependencies :
51- name : server cache dependencies windows
145+ # Make sure to include "filters: *filters" in every test job you want to run as part of your deployment.
146+ - pip-install-test :
147+ name : " pip-install-macos"
148+ filters : *filters
149+ executor : macos
150+ - pip-install-test :
151+ filters : *filters
152+ - pip-install-test-args :
153+ filters : *filters
154+ - pipenv-test :
155+ filters : *filters
156+ - poetry-test :
157+ filters : *filters
158+ - dist-test :
159+ name : " dist-test-wheel"
160+ filters : *filters
161+ - dist-test :
162+ name : " dist-test-build"
163+ build-tool : " build"
164+ filters : *filters
165+ - dist-test-build-opts :
166+ name : " dist-test-build-opts"
167+ filters : *filters
168+ - pip-install-rel-dir :
169+ filters : *filters
170+ - python/test :
171+ filters : *filters
172+ name : job-test-poetry
173+ pkg-manager : poetry
174+ cache-version : poetry-<< pipeline.parameters.cache-version >>
175+ args : " | tee install_output.txt"
176+ include-branch-in-cache-key : false
177+ app-dir : ~/project/sample_poetry
178+ post-steps :
179+ - run :
180+ name : Verify cache was successful
181+ working_directory : ~/project/sample_poetry
182+ command : ' cat install_output.txt | grep "No dependencies to install or update"'
183+ - python/test :
184+ filters : *filters
185+ name : job-test-pipenv
186+ pkg-manager : pipenv
187+ include-branch-in-cache-key : false
188+ cache-version : pipenv-<< pipeline.parameters.cache-version >>
189+ app-dir : ~/project/sample_pipenv
190+ - python/test :
191+ filters : *filters
192+ name : job-test-pip
193+ pkg-manager : pip
194+ include-branch-in-cache-key : false
195+ cache-version : pip-<< pipeline.parameters.cache-version >>
196+ test-tool : unittest
197+ app-dir : ~/project/sample_pip
198+ args : " | tee install_output.txt"
199+ post-steps :
200+ - run :
201+ name : Verify cache was successful
202+ working_directory : ~/project/sample_pip
203+ command : ' cat install_output.txt | grep "Requirement already satisfied: pytest"'
204+ - python/test :
205+ filters : *filters
206+ name : job-auto-test-poetry
207+ cache-version : poetry-auto-<< pipeline.parameters.cache-version >>
208+ args : " | tee install_output.txt"
209+ include-branch-in-cache-key : false
210+ app-dir : ~/project/sample_poetry
211+ post-steps :
212+ - run :
213+ name : Verify cache was successful
214+ working_directory : ~/project/sample_poetry
215+ command : ' cat install_output.txt | grep "No dependencies to install or update"'
216+ - python/test :
217+ filters : *filters
218+ name : job-auto-test-pipenv
219+ cache-version : pipenv-auto-<< pipeline.parameters.cache-version >>
220+ app-dir : ~/project/sample_pipenv
221+ include-branch-in-cache-key : false
222+ - python/test :
223+ filters : *filters
224+ name : job-auto-test-pip
225+ test-tool : unittest
226+ venv-cache : false
227+ include-branch-in-cache-key : false
228+ args : " | tee install_output.txt"
229+ cache-version : pip-auto-<< pipeline.parameters.cache-version >>
230+ app-dir : ~/project/sample_pip
231+ post-steps :
232+ - run :
233+ name : Verify cache was successful
234+ working_directory : ~/project/sample_pip
235+ command : ' cat install_output.txt | grep "Requirement already satisfied: pytest"'
236+ - python/test :
237+ filters : *filters
238+ name : job-test-pip-no-reqs
239+ pkg-manager : pip
240+ pip-dependency-file : " "
241+ include-branch-in-cache-key : false
242+ test-tool : unittest
243+ cache-version : pip-noreqs-<< pipeline.parameters.cache-version >>
244+ app-dir : ~/project/sample_pip
245+ - python/test :
246+ filters : *filters
52247 executor :
53- name : windows/default
54- shell : bash.exe
55- pre-steps :
56- - install-python-on-windows
248+ name : python/default
249+ tag : 3.8.2
250+ name : job-test-pip-dist
251+ pkg-manager : pip-dist
252+ include-branch-in-cache-key : false
253+ cache-version : pip-dist-<< pipeline.parameters.cache-version >>
254+ app-dir : ~/project/sample_pip
255+ # pip-dependency-file: setup.py
256+ post-steps :
257+ - run :
258+ name : Attempt to set the other python version - this should fail, but if the cache is broken, this will succeed.
259+ command : |
260+ ! pyenv local 3.8.6
261+ - run :
262+ name : If another python version is loaded - its broken - this verifies that it's broken
263+ when : on_fail
264+ command : python --version
265+ - python/test :
266+ filters : *filters
267+ executor :
268+ name : python/default
269+ tag : 3.11.4
270+ name : job-test-pip-dist-pyproject
271+ pkg-manager : pip-dist
272+ include-branch-in-cache-key : false
273+ cache-version : pip-dist-pyproject-<< pipeline.parameters.cache-version >>
274+ app-dir : ~/project/sample_pip_pyproject
275+ - orb-tools/pack :
276+ filters : *filters
277+ - orb-tools/publish :
278+ orb-name : circleci/python
279+ github-token : GHI_TOKEN
280+ vcs-type : << pipeline.project.type >>
281+ pub-type : production
282+ requires :
283+ - orb-tools/pack
284+ - pip-install-test
285+ - pip-install-macos
286+ - pip-install-test-args
287+ - pipenv-test
288+ - poetry-test
289+ - pip-install-rel-dir
290+ - job-test-poetry
291+ - job-test-pipenv
292+ - job-test-pip
293+ - job-test-pip-dist
294+ - job-test-pip-dist-pyproject
295+ - job-auto-test-poetry
296+ - job-auto-test-pipenv
297+ - job-auto-test-pip
298+ - dist-test-wheel
299+ - dist-test-build
300+ - dist-test-build-opts
301+ context : orb-publisher
302+ filters :
303+ branches :
304+ ignore : /.*/
305+ tags :
306+ only : /^v[0-9]+\.[0-9]+\.[0-9]+$/
0 commit comments