From 609ed34df5efb16ee4096f8475b32815a1260699 Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Tue, 14 Jan 2020 13:13:49 -0800 Subject: [PATCH 01/12] BNCASB-2204: Initial changes to update the package version --- .circleci/config.yml | 24 ++++++++++++++++++++++++ VERSION | 1 + setup.py | 15 +++++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 VERSION diff --git a/.circleci/config.yml b/.circleci/config.yml index 7bca975..30f6ce9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,6 +5,13 @@ workflows: jobs: - test-python-3-7 - test-python-2-7 + - bump-version: + filters: + branches: + only: /BNCASB-2204.*/ + requires: + - test-python-3-7 + - test-python-2-7 jobs: test-python-3-7: &test-template docker: @@ -24,3 +31,20 @@ jobs: <<: *test-template docker: - image: circleci/python:2.7.16 + bump-version: + docker: + - image: circleci/python:3.7.6 + steps: + - add_ssh_keys + - checkout + - run: + name: Update version number + command: | + OLD_VER=$(cat VERSION) && NEW_VER=$(echo $OLD_VER + .01 | bc) && echo $NEW_VER > VERSION + echo $OLD_VER + echo $NEW_VER + cat VERSION + - run: + name: Push to GitHub + command: | + echo "pushing to github..." diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..1caa5ab --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.36 \ No newline at end of file diff --git a/setup.py b/setup.py index d340bd7..b9a848c 100644 --- a/setup.py +++ b/setup.py @@ -2,20 +2,31 @@ from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) +VERSION = open(os.path.join(here, 'VERSION')).read() README = open(os.path.join(here, 'README.md')).read() setup( - name='django-eb-sqs', - version='1.36', + name='django-task-sqs', + version=VERSION, package_dir={'eb_sqs': 'eb_sqs'}, include_package_data=True, packages=find_packages(), description='A simple task manager for AWS SQS', long_description=README, + long_description_content_type="text/markdown", url='https://github.com/cuda-networks/django-eb-sqs', install_requires=[ 'boto3>=1.9.86', 'Django>=1.10.6', 'requests>=2.10.0', + ], + classifiers=[ + 'Intended Audience :: Developers', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 2.7', + 'Topic :: Software Development', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Framework :: Django' ] ) From d6210ad07a9817f75f907af4a37f2c28776027de Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Tue, 14 Jan 2020 13:18:49 -0800 Subject: [PATCH 02/12] BNCASB-2204: Fix the indentation --- .circleci/config.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 30f6ce9..2b3350a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,17 +34,17 @@ jobs: bump-version: docker: - image: circleci/python:3.7.6 - steps: - - add_ssh_keys - - checkout - - run: - name: Update version number - command: | - OLD_VER=$(cat VERSION) && NEW_VER=$(echo $OLD_VER + .01 | bc) && echo $NEW_VER > VERSION - echo $OLD_VER - echo $NEW_VER - cat VERSION - - run: - name: Push to GitHub - command: | - echo "pushing to github..." + steps: + - add_ssh_keys + - checkout + - run: + name: Update version number + command: | + OLD_VER=$(cat VERSION) && NEW_VER=$(echo $OLD_VER + .01 | bc) && echo $NEW_VER > VERSION + echo $OLD_VER + echo $NEW_VER + cat VERSION + - run: + name: Push to GitHub + command: | + echo "pushing to github..." From 873433f5fa9c4d7a7bbf9a018a3f4303ccc5d55b Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Tue, 14 Jan 2020 15:16:36 -0800 Subject: [PATCH 03/12] Bump the version to 1.36 --- .circleci/config.yml | 6 ++---- VERSION | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2b3350a..e67ec38 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,9 +6,6 @@ workflows: - test-python-3-7 - test-python-2-7 - bump-version: - filters: - branches: - only: /BNCASB-2204.*/ requires: - test-python-3-7 - test-python-2-7 @@ -40,6 +37,7 @@ jobs: - run: name: Update version number command: | + sudo apt-get install bc OLD_VER=$(cat VERSION) && NEW_VER=$(echo $OLD_VER + .01 | bc) && echo $NEW_VER > VERSION echo $OLD_VER echo $NEW_VER @@ -47,4 +45,4 @@ jobs: - run: name: Push to GitHub command: | - echo "pushing to github..." + echo "pushing to github..." \ No newline at end of file diff --git a/VERSION b/VERSION index 1caa5ab..f55005a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36 \ No newline at end of file +1.36 From 750259fe7624089e2af092b6d1ba11b8491b8eb7 Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Tue, 14 Jan 2020 15:59:18 -0800 Subject: [PATCH 04/12] BNCASB: Adding update script to help update the version and publish package to PyPI --- .circleci/config.yml | 22 ----------------- setup.py | 2 +- update.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 23 deletions(-) create mode 100755 update.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index e67ec38..7bca975 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,10 +5,6 @@ workflows: jobs: - test-python-3-7 - test-python-2-7 - - bump-version: - requires: - - test-python-3-7 - - test-python-2-7 jobs: test-python-3-7: &test-template docker: @@ -28,21 +24,3 @@ jobs: <<: *test-template docker: - image: circleci/python:2.7.16 - bump-version: - docker: - - image: circleci/python:3.7.6 - steps: - - add_ssh_keys - - checkout - - run: - name: Update version number - command: | - sudo apt-get install bc - OLD_VER=$(cat VERSION) && NEW_VER=$(echo $OLD_VER + .01 | bc) && echo $NEW_VER > VERSION - echo $OLD_VER - echo $NEW_VER - cat VERSION - - run: - name: Push to GitHub - command: | - echo "pushing to github..." \ No newline at end of file diff --git a/setup.py b/setup.py index b9a848c..248ebc6 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ README = open(os.path.join(here, 'README.md')).read() setup( - name='django-task-sqs', + name='django-eb-sqs', version=VERSION, package_dir={'eb_sqs': 'eb_sqs'}, include_package_data=True, diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..f74d535 --- /dev/null +++ b/update.sh @@ -0,0 +1,59 @@ +echo "Usage: $0 [option] ... + -u or --update : update the version and commit to Github + -p or --publish : publish the package to PyPI + -h or --help : help +" + +for arg in "$@" + +do + if [ "$arg" == "--update" ] || [ "$arg" == "-u" ] + then + # bump the version + echo "Updating the package version..." + OLD_VER=$(cat VERSION) + NEW_VER=$(echo "$OLD_VER" + .01 | bc) + echo "$NEW_VER" > VERSION + echo "Version bumped to $NEW_VER" + + # push to git + echo "Pushing to GitHub..." + git commit -m "Bump the version to $NEW_VER" + git add VERSION + git commit -a -m "Bump the version to $NEW_VER" + git push + + # adding tag + echo "Adding Tag..." + TAG="v$NEW_VER" + echo "$TAG" + git tag -a "$TAG" -m "Bumped the version to $NEW_VER" + git push origin "$TAG" + + fi + + # publish to PyPI + if [ "$arg" == "--publish" ] || [ "$arg" == "-p" ] + then + echo "Pushing the package to PyPI... + Note: Please have setuptools, wheel and twine packages installed." + + # creating the distribution package + rm -rf dist/ + python setup.py sdist + python setup.py bdist_wheel + twine upload dist/* + + fi + + + # help + if [ "$arg" == "--help" ] || [ "$arg" == "-h" ] + then + echo "Usage: $0 [option] ... + -u or --update : update the version and commit to Github + -p or --publish : publish the package to PyPI + -h or --help : help" + fi +done + From ab6ffc8d96eff4187c3738593b28f6b672d59b63 Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Tue, 14 Jan 2020 16:30:25 -0800 Subject: [PATCH 05/12] BNCASB-2204: Update the ReadME.md file to include badges Inlcude badges --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bbd3c7e..505aff4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -## Django EB SQS - Background Tasks for Amazon SQS + +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + +[![CircleCI](https://img.shields.io/circleci/build/github/cuda-networks/django-eb-sqs/master)](https://circleci.com/gh/cuda-networks/django-eb-sqs/tree/master) + +# Django EB SQS - Background Tasks for Amazon SQS django-eb-sqs is a simple task manager for AWS SQS. It uses SQS and the [boto3](https://github.com/boto/boto3) library. From 5547ff12bfa26c08d00dff230fab63023a311acc Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Tue, 14 Jan 2020 16:34:51 -0800 Subject: [PATCH 06/12] BNCASB-2204: Remove an extra empty line causing line break in README markdown --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 505aff4..cb3b686 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) - [![CircleCI](https://img.shields.io/circleci/build/github/cuda-networks/django-eb-sqs/master)](https://circleci.com/gh/cuda-networks/django-eb-sqs/tree/master) # Django EB SQS - Background Tasks for Amazon SQS From 142501dadafaf4489cdc9a01dcc902ed112248d9 Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Wed, 15 Jan 2020 11:52:17 -0800 Subject: [PATCH 07/12] BNCASB-2204: Add the shebang to the script --- update.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/update.sh b/update.sh index f74d535..6b1c118 100755 --- a/update.sh +++ b/update.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + echo "Usage: $0 [option] ... -u or --update : update the version and commit to Github -p or --publish : publish the package to PyPI From 0016da27e2744290e97adce1a01bb5ec9c0e7451 Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Wed, 15 Jan 2020 15:50:17 -0800 Subject: [PATCH 08/12] BNCASB-2204: Updating the update.sh script to handle explicit versions --- update.sh | 125 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 47 deletions(-) diff --git a/update.sh b/update.sh index 6b1c118..b3f6ca3 100755 --- a/update.sh +++ b/update.sh @@ -1,61 +1,92 @@ -#!/usr/bin/env bash +#!/bin/bash -echo "Usage: $0 [option] ... - -u or --update : update the version and commit to Github - -p or --publish : publish the package to PyPI - -h or --help : help -" +function log() +{ + echo "$(date): $1" +} -for arg in "$@" +function usage() +{ + echo "Usage: $0 [option] ... + -u : Update the package version and commit to Github. Version is usually a semantic release eg 1.20, 1.1.7 + If you want to do an auto update use '-u AUTO'. + -p : Publish the package to PyPI. Specify the Github repo tag we want to use to create the distribution + package. eg: '-p v1.36' + -h : help + " + exit +} -do - if [ "$arg" == "--update" ] || [ "$arg" == "-u" ] +function update() +{ + # update codebase + git checkout master + git pull + + if [ "$VERSION_PARAM" = "AUTO" ] then - # bump the version - echo "Updating the package version..." OLD_VER=$(cat VERSION) NEW_VER=$(echo "$OLD_VER" + .01 | bc) - echo "$NEW_VER" > VERSION - echo "Version bumped to $NEW_VER" - - # push to git - echo "Pushing to GitHub..." - git commit -m "Bump the version to $NEW_VER" - git add VERSION - git commit -a -m "Bump the version to $NEW_VER" - git push - - # adding tag - echo "Adding Tag..." - TAG="v$NEW_VER" - echo "$TAG" - git tag -a "$TAG" -m "Bumped the version to $NEW_VER" - git push origin "$TAG" - + else + NEW_VER=$VERSION_PARAM fi - # publish to PyPI - if [ "$arg" == "--publish" ] || [ "$arg" == "-p" ] - then - echo "Pushing the package to PyPI... - Note: Please have setuptools, wheel and twine packages installed." + # bump the version + echo "$NEW_VER" > VERSION + log "Version bumped to $NEW_VER" - # creating the distribution package - rm -rf dist/ - python setup.py sdist - python setup.py bdist_wheel - twine upload dist/* + # push VERSION file and new TAG to git + log "Pushing to GitHub..." + git add VERSION + git commit -a -m "Bump the version to $NEW_VER" + git push - fi + # adding tag + log "Adding Tag..." + TAG="v$NEW_VER" + log "New tag : $TAG" + git tag -a "$TAG" -m "Bumped the version to $NEW_VER" + git push origin "$TAG" + exit +} - # help - if [ "$arg" == "--help" ] || [ "$arg" == "-h" ] - then - echo "Usage: $0 [option] ... - -u or --update : update the version and commit to Github - -p or --publish : publish the package to PyPI - -h or --help : help" - fi +function publish() +{ + log "Pushing the package to PyPI. (Note: Please have setuptools, wheel and twine packages installed.)" + log "Publishing package version/tag: $TAG_PARAM" + + # checkout specific tag version + git checkout tags/"$TAG_PARAM" + + # creating the distribution package + rm -rf dist/ + python setup.py sdist + python setup.py bdist_wheel + twine upload dist/* + + exit +} + +# Parse and handle command line options +while getopts ":u:p:" OPTION; do + case $OPTION in + u) + VERSION_PARAM=$OPTARG + update + ;; + p) + TAG_PARAM=$OPTARG + publish + ;; + *) + usage + ;; + esac done +# if no args specified +if [ "$#" -ne 1 ] +then + usage +fi \ No newline at end of file From d4908e6c10033915898d4eb51f61dd942b79f641 Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Wed, 15 Jan 2020 16:04:39 -0800 Subject: [PATCH 09/12] BNCASB-2204: Fix the indentation --- update.sh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/update.sh b/update.sh index b3f6ca3..05fe06e 100755 --- a/update.sh +++ b/update.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + function log() { echo "$(date): $1" @@ -70,19 +72,19 @@ function publish() # Parse and handle command line options while getopts ":u:p:" OPTION; do - case $OPTION in - u) - VERSION_PARAM=$OPTARG - update - ;; - p) - TAG_PARAM=$OPTARG - publish - ;; - *) - usage - ;; - esac + case $OPTION in + u) + VERSION_PARAM=$OPTARG + update + ;; + p) + TAG_PARAM=$OPTARG + publish + ;; + *) + usage + ;; + esac done # if no args specified From 1759c1f5c8769880e1eb1a2e42fbe6ed249ff7db Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Fri, 17 Jan 2020 11:54:24 -0800 Subject: [PATCH 10/12] BNCASB-2204: Adding the missing end of line --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 05fe06e..5e124f3 100755 --- a/update.sh +++ b/update.sh @@ -91,4 +91,4 @@ done if [ "$#" -ne 1 ] then usage -fi \ No newline at end of file +fi From e859b08ea6e5a0d1f2525631967bf1b234e4af0d Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Fri, 17 Jan 2020 16:12:00 -0800 Subject: [PATCH 11/12] BNCASB-2204: Split the update the script into two separate helper scripts. update-version script to update the package version publish-pypi script to update the publish the package to PyPI --- publish-pypi.sh | 57 +++++++++++++++++++++++++++++++++++ requirements-pypi.txt | 3 ++ update-version.sh | 69 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100755 publish-pypi.sh create mode 100644 requirements-pypi.txt create mode 100755 update-version.sh diff --git a/publish-pypi.sh b/publish-pypi.sh new file mode 100755 index 0000000..e1a69bd --- /dev/null +++ b/publish-pypi.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +set -e + +function log() +{ + echo "$(date): $1" +} + +function usage() +{ + echo "Helper to publish the package to PyPI. + Usage: $0 -p + -p : Github Tag value, semantic realease format eg: v1.36 or v2.0.7 + -h : help + " + exit +} + +function publish() +{ + + log "Installing required dependencies" + pip install -r requirements-pypi.txt + + # checkout specific tag version + git checkout tags/"$TAG_PARAM" + + # creating the distribution package + rm -rf dist/ + python setup.py sdist + python setup.py bdist_wheel + + log "Publishing package version/tag: $TAG_PARAM" + twine upload dist/* # add --repository-url https://test.pypi.org/legacy/ to push to TestPyPI + + exit +} + +# Parse and handle command line options +while getopts ":p:h" OPTION; do + case $OPTION in + p) + TAG_PARAM=$OPTARG + publish + ;; + *) + usage + ;; + esac +done + +# if no args specified +if [ "$#" -ne 1 ] +then + usage +fi diff --git a/requirements-pypi.txt b/requirements-pypi.txt new file mode 100644 index 0000000..1b5891b --- /dev/null +++ b/requirements-pypi.txt @@ -0,0 +1,3 @@ +setuptools>=44.0.0 +wheel>=0.33.6 +twine>=3.1.1 \ No newline at end of file diff --git a/update-version.sh b/update-version.sh new file mode 100755 index 0000000..fcfde3f --- /dev/null +++ b/update-version.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +set -e + +VERSION_PARAM=${1:-AUTO} + +function log() +{ + echo "$(date): $1" +} + +function usage() +{ + echo "Helper to update the package version and commit to GitHub. + Usage: $0 + : Version is usually a semantic release eg 1.20, 1.1.7. + VERSION value is optional, if not passed then an auto version update occurs. + -h : help + " + exit +} + +function update() +{ + # update codebase + git checkout master + git pull + + if [ "$VERSION_PARAM" = "AUTO" ] + then + OLD_VER=$(cat VERSION) + NEW_VER=$(echo "$OLD_VER" + .01 | bc) + else + NEW_VER=$VERSION_PARAM + fi + + # bump the version + echo "$NEW_VER" > VERSION + log "Version bumped to $NEW_VER" + + # push VERSION file and new TAG to git + log "Pushing to GitHub..." + git add VERSION + git commit -a -m "Bump the version to $NEW_VER" + git push + + # adding tag + log "Adding Tag..." + TAG="v$NEW_VER" + log "New tag : $TAG" + git tag -a "$TAG" -m "Bumped the version to $NEW_VER" + git push origin "$TAG" + + exit +} + +# Parse and handle command line options +while getopts ":h" OPTION; do + case $OPTION in + h) + usage + ;; + *) + usage + ;; + esac +done + +update From 7ebed70a75b451a388944dd3fdd5c0f8d5ebc2ec Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Fri, 17 Jan 2020 16:17:39 -0800 Subject: [PATCH 12/12] BNCASB-2204: Delete the obsolete update.sh --- update.sh | 94 ------------------------------------------------------- 1 file changed, 94 deletions(-) delete mode 100755 update.sh diff --git a/update.sh b/update.sh deleted file mode 100755 index 5e124f3..0000000 --- a/update.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -set -e - -function log() -{ - echo "$(date): $1" -} - -function usage() -{ - echo "Usage: $0 [option] ... - -u : Update the package version and commit to Github. Version is usually a semantic release eg 1.20, 1.1.7 - If you want to do an auto update use '-u AUTO'. - -p : Publish the package to PyPI. Specify the Github repo tag we want to use to create the distribution - package. eg: '-p v1.36' - -h : help - " - exit -} - -function update() -{ - # update codebase - git checkout master - git pull - - if [ "$VERSION_PARAM" = "AUTO" ] - then - OLD_VER=$(cat VERSION) - NEW_VER=$(echo "$OLD_VER" + .01 | bc) - else - NEW_VER=$VERSION_PARAM - fi - - # bump the version - echo "$NEW_VER" > VERSION - log "Version bumped to $NEW_VER" - - # push VERSION file and new TAG to git - log "Pushing to GitHub..." - git add VERSION - git commit -a -m "Bump the version to $NEW_VER" - git push - - # adding tag - log "Adding Tag..." - TAG="v$NEW_VER" - log "New tag : $TAG" - git tag -a "$TAG" -m "Bumped the version to $NEW_VER" - git push origin "$TAG" - - exit -} - -function publish() -{ - log "Pushing the package to PyPI. (Note: Please have setuptools, wheel and twine packages installed.)" - log "Publishing package version/tag: $TAG_PARAM" - - # checkout specific tag version - git checkout tags/"$TAG_PARAM" - - # creating the distribution package - rm -rf dist/ - python setup.py sdist - python setup.py bdist_wheel - twine upload dist/* - - exit -} - -# Parse and handle command line options -while getopts ":u:p:" OPTION; do - case $OPTION in - u) - VERSION_PARAM=$OPTARG - update - ;; - p) - TAG_PARAM=$OPTARG - publish - ;; - *) - usage - ;; - esac -done - -# if no args specified -if [ "$#" -ne 1 ] -then - usage -fi