diff --git a/.circleci/config.yml b/.circleci/config.yml index 14e31a5..31c2327 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,3 +20,51 @@ jobs: - store_artifacts: path: test-reports + deploy: + docker: + - image: circleci/python:3.7.0 + steps: + - checkout + - run: + name: Install Python Dependencies + command: | + sudo pip install pipenv + pipenv install --three + + - run: + name: verify git tag vs. version + command: | + pipenv run python setup.py verify + - run: + name: init .pypirc + command: | + echo -e "[pypi]" >> ~/.pypirc + echo -e "username = therold" >> ~/.pypirc + echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc + - run: + name: create packages + command: | + pipenv run python setup.py sdist + pipenv run python setup.py bdist_wheel + - run: + name: upload to pypi + command: | + pipenv run twine upload dist/* + +workflows: + version: 2 + build_and_deploy: + jobs: + - build: + filters: + tags: + only: /.*/ + - deploy: + requires: + - build + filters: + tags: + only: /[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ + diff --git a/Pipfile b/Pipfile index b2134c7..0c955d6 100644 --- a/Pipfile +++ b/Pipfile @@ -5,6 +5,7 @@ name = "pypi" [packages] pytest = "==3.8.1" +twine = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index 431d3bb..98f76ed 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "ac8185ca5dae72b0537acc067b9910f26d093431a8d0f2dfab08a6060fbd66ef" + "sha256": "cdc187dc1ea98d440cb849c4a5aa5029162c9d0c88dfd472d6f1d5de9bacd263" }, "pipfile-spec": 6, "requires": { @@ -30,6 +30,48 @@ ], "version": "==18.2.0" }, + "bleach": { + "hashes": [ + "sha256:48d39675b80a75f6d1c3bdbffec791cf0bbbab665cf01e20da701c77de278718", + "sha256:73d26f018af5d5adcdabf5c1c974add4361a9c76af215fe32fdec8a6fc5fb9b9" + ], + "version": "==3.0.2" + }, + "certifi": { + "hashes": [ + "sha256:339dc09518b07e2fa7eda5450740925974815557727d6bd35d319c1524a04a4c", + "sha256:6d58c986d22b038c8c0df30d639f23a3e6d172a05c3583e766f4c0b785c0986a" + ], + "version": "==2018.10.15" + }, + "chardet": { + "hashes": [ + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + ], + "version": "==3.0.4" + }, + "docutils": { + "hashes": [ + "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6", + "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274", + "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6" + ], + "version": "==0.14" + }, + "future": { + "hashes": [ + "sha256:eb6d4df04f1fb538c99f69c9a28b255d1ee4e825d479b9c62fc38c0cf38065a4" + ], + "version": "==0.17.0" + }, + "idna": { + "hashes": [ + "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e", + "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16" + ], + "version": "==2.7" + }, "more-itertools": { "hashes": [ "sha256:c187a73da93e7a8acc0001572aebc7e3c69daf7bf6881a2cea10650bd4420092", @@ -38,12 +80,19 @@ ], "version": "==4.3.0" }, + "pkginfo": { + "hashes": [ + "sha256:5878d542a4b3f237e359926384f1dde4e099c9f5525d236b1840cf704fa8d474", + "sha256:a39076cb3eb34c333a0dd390b568e9e1e881c7bf2cc0aee12120636816f55aee" + ], + "version": "==1.4.2" + }, "pluggy": { "hashes": [ - "sha256:6e3836e39f4d36ae72840833db137f7b7d35105079aee6ec4a62d9f80d594dd1", - "sha256:95eb8364a4708392bae89035f45341871286a333f749c3141c20573d2b3876e1" + "sha256:447ba94990e8014ee25ec853339faf7b0fc8050cdc3289d4d71f7f410fb90095", + "sha256:bde19360a8ec4dfd8a20dcb811780a30998101f078fc7ded6162f0076f50508f" ], - "version": "==0.7.1" + "version": "==0.8.0" }, "py": { "hashes": [ @@ -52,6 +101,13 @@ ], "version": "==1.7.0" }, + "pygments": { + "hashes": [ + "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", + "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" + ], + "version": "==2.2.0" + }, "pytest": { "hashes": [ "sha256:0a72d8a9f559c006ba153e0c9b4838efd7b656cf1f993747ba7128770d6eb12c", @@ -60,12 +116,62 @@ "index": "pypi", "version": "==3.8.1" }, + "readme-renderer": { + "hashes": [ + "sha256:219a02f5359b6631f5ab952f6906c6c105bdd8bc4bf19c1ec5ee8bd9ea2dc1eb", + "sha256:f8f122ad9fd6d138337531379575a01a0b6ca70aedca78f094cb833da38c8c0c" + ], + "version": "==23.0" + }, + "requests": { + "hashes": [ + "sha256:99dcfdaaeb17caf6e526f32b6a7b780461512ab3f1d992187801694cba42770c", + "sha256:a84b8c9ab6239b578f22d1c21d51b696dcfe004032bb80ea832398d6909d7279" + ], + "version": "==2.20.0" + }, + "requests-toolbelt": { + "hashes": [ + "sha256:42c9c170abc2cacb78b8ab23ac957945c7716249206f90874651971a4acff237", + "sha256:f6a531936c6fa4c6cfce1b9c10d5c4f498d16528d2a54a22ca00011205a187b5" + ], + "version": "==0.8.0" + }, "six": { "hashes": [ "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" ], "version": "==1.11.0" + }, + "tqdm": { + "hashes": [ + "sha256:3c4d4a5a41ef162dd61f1edb86b0e1c7859054ab656b2e7c7b77e7fbf6d9f392", + "sha256:5b4d5549984503050883bc126280b386f5f4ca87e6c023c5d015655ad75bdebb" + ], + "version": "==4.28.1" + }, + "twine": { + "hashes": [ + "sha256:7d89bc6acafb31d124e6e5b295ef26ac77030bf098960c2a4c4e058335827c5c", + "sha256:fad6f1251195f7ddd1460cb76d6ea106c93adb4e56c41e0da79658e56e547d2c" + ], + "index": "pypi", + "version": "==1.12.1" + }, + "urllib3": { + "hashes": [ + "sha256:41c3db2fc01e5b907288010dec72f9d0a74e37d6994e6eb56849f59fea2265ae", + "sha256:8819bba37a02d143296a4d032373c4dd4aca11f6d4c9973335ca75f9c8475f59" + ], + "version": "==1.24" + }, + "webencodings": { + "hashes": [ + "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78", + "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923" + ], + "version": "==0.5.1" } }, "develop": {} diff --git a/setup.py b/setup.py index c7d08bd..6fd3165 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,33 @@ from setuptools import setup from setuptools.command.test import test as TestCommand +from setuptools.command.install import install import sys +import os import pybeerxml +# circleci.py version +VERSION = "1.0.3" + +def readme(): + """print long description""" + with open('README.md') as f: + return f.read() + + +class VerifyVersionCommand(install): + """Custom command to verify that the git tag matches our version""" + description = 'verify that the git tag matches our version' + + def run(self): + tag = os.getenv('CIRCLE_TAG') + + if tag != VERSION: + info = "Git tag: {0} does not match the version of this app: {1}".format( + tag, VERSION + ) + sys.exit(info) + class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) @@ -18,14 +42,17 @@ def run_tests(self): setup( name = 'pybeerxml', packages = ['pybeerxml'], - version = '1.0.2', + version = VERSION, description = 'A BeerXML Parser', author = 'Tom Herold', author_email = 'heroldtom@gmail.com', url = 'https://github.com/hotzenklotz/pybeerxml', - download_url = 'https://github.com/hotzenklotz/pybeerxml/tarball/1.0.2', + download_url = 'https://github.com/hotzenklotz/pybeerxml/tarball/{}'.format(VERSION), tests_require=['pytest'], - cmdclass={'test': PyTest}, + cmdclass={ + 'test': PyTest, + 'verify': VerifyVersionCommand + }, platforms='any', keywords = ['beerxml', 'beer', 'xml', 'brewing'], classifiers = [],