@@ -88,6 +88,41 @@ executors:
8888 macos :
8989 xcode : 11.4
9090jobs :
91+ build :
92+ docker :
93+ - image : circleci/python:3.7
94+ steps :
95+ - checkout
96+ - restore_cache :
97+ keys :
98+ - poetry-{{ checksum "poetry.lock" }}
99+ - run :
100+ name : Install Tools
101+ command : |
102+ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
103+ - run :
104+ name : Build
105+ command : |
106+ source $HOME/.poetry/env
107+ poetry install
108+ poetry run poetry-dynamic-versioning
109+ poetry build
110+ - save_cache :
111+ key : poetry-{{ checksum "poetry.lock" }}
112+ paths :
113+ - ~/.poetry
114+ - store_artifacts :
115+ path : dist
116+ - store_artifacts :
117+ path : output
118+ - persist_to_workspace :
119+ # Must be an absolute path, or relative path from working_directory. This is a directory on the container which is
120+ # taken to be the root directory of the workspace.
121+ root : .
122+ # Must be relative path from root
123+ paths :
124+ - dist
125+ - output
91126 test-unit :
92127 parameters :
93128 os :
97132 executor : << parameters.os >>
98133 steps :
99134 - checkout
100- # - python/load-cache
135+ - attach_workspace :
136+ at : /tmp/workspace
101137 - run :
102138 name : install deps
103139 command : |
@@ -109,18 +145,15 @@ jobs:
109145 eval "$(pyenv init -)"
110146 pyenv install << parameters.python-version >>
111147 pyenv global << parameters.python-version >>
112- virtualenv .venv
113- pip install --upgrade virtualenv
114- source .venv/bin/activate
115- pip install -r requirements.txt
116- pip install -e .
148+ pyenv local << parameters.python-version >>
149+ pip install /tmp/workspace/dist/*
150+ pip install pytest
151+ pip install pytest-cov
152+ pip install pytest-expect
153+ pip install pyaml
154+ pip install mock
117155 mkdir test-results || true
118- - python/save-cache
119- - run :
120- command : |
121- source .venv/bin/activate
122156 python -m pytest --junitxml=test-results/results.xml --cov=solnlib --cov-report=html tests
123- name : Test
124157 - store_test_results :
125158 path : test-results
126159 - store_artifacts :
@@ -166,6 +199,8 @@ jobs:
166199 echo PASSWORD=Chang3d! >>$SPLUNK_HOME/etc/system/local/user-seed.conf
167200 /opt/splunk/bin/splunk start --accept-license
168201 # - python/load-cache
202+ - attach_workspace :
203+ at : /tmp/workspace
169204 - run :
170205 name : Install deps
171206 command : |
@@ -177,18 +212,14 @@ jobs:
177212 eval "$(pyenv init -)"
178213 pyenv install << parameters.python-version >>
179214 pyenv global << parameters.python-version >>
180- virtualenv .venv
181- pip install --upgrade virtualenv
182- source .venv/bin/activate
183- pip install -r requirements.txt
184- pip install -e .
215+ pyenv local << parameters.python-version >>
216+ pip install /tmp/workspace/dist/*
217+ pip install pytest
218+ pip install pytest-cov
219+ pip install pytest-expect
220+ pip install pyaml
185221 mkdir test-results || true
186- - python/save-cache
187- - run :
188- command : |
189- source .venv/bin/activate
190222 SPLUNK_HOME=/opt/splunk/ python -m pytest --junitxml=test-results/results.xml -v examples
191- name : Test
192223 - store_test_results :
193224 path : test-results
194225 - store_artifacts :
@@ -202,21 +233,29 @@ jobs:
202233 steps :
203234 - setup_remote_docker :
204235 docker_layer_caching : true
205- - attach_workspace :
206- at : /tmp/workspace
207236 - checkout
237+ - restore_cache :
238+ keys :
239+ - poetry-{{ checksum "poetry.lock" }}
240+ - run :
241+ name : Install Tools
242+ command : |
243+ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
208244 - run :
209- name : " Publish on PyPI "
245+ name : Build
210246 command : |
211- PATH=$PATH:/usr/local/go/bin
212- pip install twine
213- python setup.py sdist bdist_wheel
214- twine upload dist/*
247+ source $HOME/.poetry/env
248+ poetry install
249+ poetry run poetry-dynamic-versioning
250+ poetry publish --build -u ${TWINE_USERNAME} -p ${TWINE_PASSWORD}
215251
216252workflows :
217253 main :
218254 jobs :
255+ - build
219256 - test-unit :
257+ requires :
258+ - build
220259 matrix :
221260 parameters :
222261 os : [linux]
@@ -225,6 +264,8 @@ workflows:
225264 branches :
226265 only : /.*/
227266 - test-splunk :
267+ requires :
268+ - build
228269 matrix :
229270 parameters :
230271 os : [linux]
0 commit comments