Skip to content

Commit

Permalink
fixing deployments (#7)
Browse files Browse the repository at this point in the history
* fixing deployments

* refactoring publish pipeline

* refactoring publish pipeline

* revert changed version code

* pep8

* refactor to do curl in another step
  • Loading branch information
mwaaas authored Oct 13, 2019
1 parent 5c07039 commit 8458a68
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
command: |
docker-compose up -d
sleep 10
curl --retry 20 --retry-delay 5 -v http://localhost:8007
- run:
name: Running tests
command: |
curl --retry 20 --retry-delay 5 -v http://localhost:8007
docker-compose run app bash -c 'coverage run --omit=*test*,*ven* manage.py test && bash <(curl -s https://codecov.io/bash) && python-codacy-coverage -r coverage.xml'
deploy:
<<: *defaults
Expand All @@ -38,7 +38,7 @@ jobs:
- run:
name: deploying
command: |
docker-compose run --no-deps -e PYPI_PASSWORD=$PYPI_PASSWORD -e PYPI_USER=$PYPI_USER -e VERSION=$CIRCLE_TAG app bash -c 'printf "[distutils]\nindex-servers = pypi \n[pypi]\nusername:$PYPI_USER\npassword:$PYPI_PASSWORD" > ~/.pypirc && python setup.py sdist upload'
make deploy version=$CIRCLE_TAG
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

test:
@docker-compose run --service-port app python manage.py test

Expand All @@ -10,3 +11,6 @@ compile_documentation:

create_dynamodb_table:
docker-compose run ansible ./create_dynamodb.sh

deploy:
docker-compose run --no-deps -e VERSION=$(version) -e PYPI_PASSWORD=$(PYPI_PASSWORD) -e PYPI_USER=$(PYPI_USER) app ./publish.sh
20 changes: 20 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e

if [[ -z "${VERSION}" ]] ; then
echo "Version not defined ";
exit 1
fi

echo "version ${VERSION}"

printf "[distutils]\nindex-servers = pypi \n[pypi]\nusername:${PYPI_USER}\npassword:${PYPI_PASSWORD}\n" > ~/.pypirc


sed -i 's/VERSION = .*/'VERSION="'${VERSION}'"'/' ussd/__init__.py

python setup.py sdist

git checkout ussd/__init__.py

twine upload dist/*
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ django-cors-headers==2.4.0
boto3==1.9.87
awscli==1.16.15
ipdb==0.12.2
twine==1.15.0
# using mwaaas branch here as we wait for this pull request to be merged
# https://github.com/steven-bruce-au/dynamodb-local-cloud-formation/pull/4
git+https://github.com/mwaaas/dynamodb-local-cloud-formation.git@4bc92a0430ec319dc3ce33e9fffadd6ba1c861a8
3 changes: 2 additions & 1 deletion ussd/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VERSION = '0.1.0'
# Version is filled during publish or deploy
VERSION = 'GENERATED_VERSION'

0 comments on commit 8458a68

Please sign in to comment.