Skip to content

Commit

Permalink
Merge pull request #3 from kbernst30/updated_build_pipeline
Browse files Browse the repository at this point in the history
Updated build pipeline
  • Loading branch information
kbernst30 authored Aug 27, 2019
2 parents a298065 + 7008654 commit 86a04e6
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 2 deletions.
53 changes: 52 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,93 @@
version: 2.1

jobs:

test:
working_directory: ~/django-data-seeder
docker:
- image: circleci/python:3.6.4
steps:
- checkout
- run:
name: install python depedencies
command: |
sudo virtualenv venv
source venv/bin/activate
- run:
name: install django
command: |
sudo pip install django
- run:
name: run tests
command: |
python runtests.py
lint:
working_directory: ~/django-data-seeder
docker:
- image: circleci/python:3.6.4
steps:
- checkout
- run:
name: install python depedencies
command: |
sudo virtualenv venv
source venv/bin/activate
- run:
name: install linter
command: |
sudo pip install flake8
- run:
name: run linter
command: |
flake8 data_seeder
deploy:
working_directory: ~/django-data-seeder
docker:
- image: circleci/python:3.6.4
steps:
- checkout
- run:
name: install python depedencies
command: |
sudo virtualenv venv
source venv/bin/activate
- run:
name: install setuptools
command: |
sudo pip install setuptools wheel
- run:
name: verify git tag vs. version
command: |
python setup.py verify
- run:
name: init .pypirc
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = __token__" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: create packages
command: |
python setup.py sdist bdist_wheel twine
- run:
name: upload to pypi
command: |
python twine upload dist/*
workflows:
version: 2
test_and_lint:
build:
jobs:
- test
- lint
- deploy:
requires:
- test
- lint
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
27 changes: 26 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
import os
import sys

from setuptools import find_packages, setup
from setuptools.command.install import install

VERSION = '0.1.2'

with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()

# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))


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 and tag != 'v' + VERSION:
info = "Git tag: {0} does not match app version: {1}".format(
tag, VERSION
)

sys.exit(info)


setup(
name='django-data-seeder',
version='0.1.1',
version=VERSION,
packages=find_packages(),
include_package_data=True,
license='BSD-3-Clause',
Expand All @@ -30,4 +52,7 @@
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
cmdclass={
'verify': VerifyVersionCommand,
},
)

0 comments on commit 86a04e6

Please sign in to comment.