77 aws-cli : circleci/aws-cli@5.1
88
99jobs :
10- build_and_test :
10+ build :
1111 docker :
1212 - image : cimg/python:3.10
1313 steps :
@@ -29,19 +29,50 @@ jobs:
2929 name : Build Distribution
3030 command : |
3131 python setup.py sdist bdist_wheel
32+ - persist_to_workspace :
33+ root : ~/project
34+ paths :
35+ - dist
36+ - ./*
37+
38+ unit_tests :
39+ docker :
40+ - image : cimg/python:3.10
41+ steps :
42+ - attach_workspace :
43+ at : ~/project
44+ - restore_cache :
45+ keys :
46+ - v1-dependencies-{{ checksum "requirements.txt" }}
47+ - v1-dependencies-
3248 - run :
3349 name : Run Unit Tests
3450 command : |
35- pytest tests/ -v --junitxml=test-results/junit.xml || true
51+ pytest tests/unit -v --junitxml=test-results/unit /junit.xml || true
3652 - store_test_results :
3753 path : test-results
3854 - store_artifacts :
3955 path : test-results
40- - persist_to_workspace :
41- root : ~/project
42- paths :
43- - dist
44- - ./*
56+
57+ integration_tests :
58+ docker :
59+ - image : cimg/python:3.10
60+ steps :
61+ - attach_workspace :
62+ at : ~/project
63+ - restore_cache :
64+ keys :
65+ - v1-dependencies-{{ checksum "requirements.txt" }}
66+ - v1-dependencies-
67+ - run :
68+ name : Run Integration Tests
69+ command : |
70+ pytest tests/integration -v --junitxml=test-results/integration/junit.xml || true
71+ - store_test_results :
72+ path : test-results
73+ - store_artifacts :
74+ path : test-results
75+
4576 snyk-scan :
4677 docker :
4778 - image : cimg/python:3.10
@@ -129,11 +160,21 @@ workflows:
129160 context :
130161 - okta-dcp
131162
132- # Build and test only after security scans pass
133- - build_and_test :
163+ # Build only after security scans pass
164+ - build :
134165 requires :
135166 - snyk-scan
136167 - reversing-labs
168+
169+ # Unit tests run after build succeeds
170+ - unit_tests :
171+ requires :
172+ - build
173+
174+ # Integration tests run after unit tests pass
175+ - integration_tests :
176+ requires :
177+ - unit_tests
137178
138179 # Publish workflow - only runs on master branch
139180 publish :
@@ -157,8 +198,8 @@ workflows:
157198 tags :
158199 only : /^v.*/
159200
160- # Build and test only after security scans pass
161- - build_and_test :
201+ # Build only after security scans pass
202+ - build :
162203 requires :
163204 - snyk-scan
164205 - reversing-labs
@@ -168,12 +209,32 @@ workflows:
168209 tags :
169210 only : /^v.*/
170211
171- # Publish only after build and tests are successful
212+ # Unit tests run after build succeeds
213+ - unit_tests :
214+ requires :
215+ - build
216+ filters :
217+ branches :
218+ only : master
219+ tags :
220+ only : /^v.*/
221+
222+ # Integration tests run after unit tests pass
223+ - integration_tests :
224+ requires :
225+ - unit_tests
226+ filters :
227+ branches :
228+ only : master
229+ tags :
230+ only : /^v.*/
231+
232+ # Publish only after all tests are successful
172233 - publish_to_pypi :
173234 context :
174235 - pypi-publish
175236 requires :
176- - build_and_test
237+ - integration_tests
177238 filters :
178239 branches :
179240 only : master
0 commit comments