Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions autorelease-travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AUTORELEASE v0.1.1
# AUTORELEASE v0.1.2
# for nonrelease, use @master
# for release, use v${VERSION}, e.g., v1.0.0
import:
- dwhswenson/autorelease:travis_stages/deploy_testpypi.yml@v0.1.1
- dwhswenson/autorelease:travis_stages/cut_release.yml@v0.1.1
- dwhswenson/autorelease:travis_stages/deploy_pypi.yml@v0.1.1
- dwhswenson/autorelease:travis_stages/test_testpypi.yml@v0.1.1
- dwhswenson/autorelease:travis_stages/deploy_testpypi.yml@v0.1.2
- dwhswenson/autorelease:travis_stages/cut_release.yml@v0.1.2
- dwhswenson/autorelease:travis_stages/deploy_pypi.yml@v0.1.2
- dwhswenson/autorelease:travis_stages/test_testpypi.yml@v0.1.2
10 changes: 9 additions & 1 deletion autorelease/scripts/bump_dev_version.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
import argparse
import time

try:
from configparser import ConfigParser, NoSectionError, NoOptionError
except ImportError:
# py2
from ConfigParser import ConfigParser, NoSectionError, NoOptionError


from json import JSONDecodeError

from packaging.version import Version
import requests

def get_latest_pypi(package, index="https://test.pypi.org/pypi"):
url = "/".join([index, package, 'json'])
req = requests.get(url)
version = max([Version(v) for v in req.json()['releases'].keys()])
try:
version = max([Version(v) for v in req.json()['releases'].keys()])
except JSONDecodeError:
# couldn't find a version, so we're okay
version = "0.0.0.dev0"
return str(version)

def _strip_dev(version_str):
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: autorelease
# add ".dev0" for unreleased versions
version: "0.1.1"
version: "0.1.2"

source:
path: ../../
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = autorelease
version = 0.1.1
version = 0.1.2
# version should end in .dev0 if this isn't to be released
short_description = Tools to keep the release process clean.
description = Tools to keep the release process clean.
Expand Down
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ def __init__(self, import_name):

def visit_ImportFrom(self, node):
if node.module == self.import_name:
replacement = ast.Raise(exc=ast.Call(
func=ast.Name(id='ImportError', ctx=ast.Load()),
args=[],
keywords=[],
), cause=None)
replacement = ast.parse("raise ImportError()").body[0]
return ast.copy_location(replacement, node)
else:
return node
Expand Down
5 changes: 5 additions & 0 deletions travis_stages/cut_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ jobs:
# release based on the current stable branch and the release notes
# from the last PR merged into stable.
if: "(branch = stable) and (not type in (pull_request, cron))"
before_install: skip
install:
- pip install autorelease
before_script: skip
script:
- VERSION=`python setup.py --version`
- PROJECT=`python setup.py --name`
- autorelease-release --project $PROJECT --version $VERSION --token $AUTORELEASE_TOKEN
after_success: skip
after_failure: skip
after_script: skip
6 changes: 6 additions & 0 deletions travis_stages/deploy_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ jobs:
# This stage runs when a version-labelled tag is made. It deploys the
# package to PyPI.
if: tag =~ ^v[0-9]+\.
before_install: skip
install: skip
before_script: skip
before_cache: skip
script: skip
after_success: 'true'
# before_deploy is allowed
deploy:
provider: pypi
distributions: sdist bdist_wheel
Expand All @@ -14,3 +19,4 @@ jobs:
on:
tags: true
password: $TWINE_PASSWORD
after_script: skip
9 changes: 9 additions & 0 deletions travis_stages/deploy_testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ jobs:
# This stage runs when you make a PR to stable. It tests that the
# deployment to testpypi works.
if: "(branch = stable) and (type = pull_request)"
before_install: skip
install:
- pip install twine
- pip install autorelease
#- pip install git+https://github.com/dwhswenson/autorelease@ops_fixes
# this is for debugging anything in autorelease used here (change
# the branch tag to whatever is needed)
#- pip install git+https://github.com/dwhswenson/autorelease.git@release-0.0.18#egg=autorelease
- hash -r
before_script:
- if [ -z "$TWINE_USERNAME" ] ; then echo "Missing TWINE_USERNAME"; fi
- if [ -z "$TWINE_PASSWORD" ] ; then echo "Missing TWINE_PASSWORD"; fi
script:
- bump-dev-version # comes from autorelease
- python setup.py --version
- python setup.py sdist bdist_wheel
- twine check dist/*
- twine upload --repository-url https://test.pypi.org/legacy/ dist/*
after_success: skip
after_failure: skip
# deploy stuff won't be run on PR; don't need to override
after_script: skip
6 changes: 6 additions & 0 deletions travis_stages/test_testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ jobs:
# been deployed to testpypi. It checks that the deployed package
# works.
if: "(branch = stable) and (type = pull_request)"
before_install: skip
install:
- pip install autorelease
#- pip install git+https://github.com/dwhswenson/autorelease@ops_fixes
# this is for debugging anything in autorelease used here (change
# the branch tag to whatever is needed)
#- pip install git+https://github.com/dwhswenson/autorelease.git@release-0.0.18#egg=autorelease
Expand All @@ -16,6 +18,7 @@ jobs:
- export VERSION=`pypi-max-version $PROJECT`
- echo "Installing ${PROJECT}==${VERSION} (allowing pre-releases)"
- pip install --pre --force-reinstall --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple ${PROJECT}==${VERSION}
before_script: skip
script: |
if [ -n "$AUTORELEASE_TEST_TESTPYPI" ]; then
eval $AUTORELEASE_TEST_TESTPYPI
Expand All @@ -24,3 +27,6 @@ jobs:
python -c "import $PROJECT"
py.test --pyargs $PROJECT
fi
after_failure: skip
after_success: skip
after_script: skip