Skip to content

Commit 685b181

Browse files
author
Ryan Faircloth
authored
Feature/poetry (#6)
POETRY based build and release
1 parent 2a7da60 commit 685b181

File tree

151 files changed

+1018
-40666
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+1018
-40666
lines changed

.circleci/config.yml

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,41 @@ executors:
8888
macos:
8989
xcode: 11.4
9090
jobs:
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:
@@ -97,7 +132,8 @@ jobs:
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
216252
workflows:
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]

MANIFEST.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# README
2+
3+
Splunk Solutions SDK is an open source packaged solution for getting data into Splunk using modular inputs.
4+
This SDK is used by Splunk Add-on builder, and Splunk UCC based add-ons and is intended for use by partner
5+
developers. This SDK/Library extends the Splunk SDK for python
6+
7+
## Support
8+
9+
Splunk Solutions SDK is an open source product developed by Splunkers. This SDK is not "Supported Software" by Splunk, Inc. issues and defects can be reported
10+
via the public issue tracker
11+
12+
## Contributing
13+
14+
We do not accept external contributions at this time
15+
16+
## License
17+
18+
* Configuration and documentation licensed subject to [APACHE-2.0](LICENSE)

README.txt

Whitespace-only changes.

examples/test__kvstore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
1111
from solnlib.credentials import get_session_key
1212
import context
13-
from solnlib.packages.splunklib import binding
14-
from solnlib.packages.splunklib import client
15-
from solnlib.packages.splunklib.binding import HTTPError
13+
from splunklib import binding
14+
from splunklib import client
15+
from splunklib.binding import HTTPError
1616

1717

1818
def test_kvstore():

0 commit comments

Comments
 (0)