Skip to content

Commit

Permalink
chore: configure automatic deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
user2589 committed Feb 26, 2019
1 parent 840e6f2 commit 01218fb
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 24 deletions.
51 changes: 51 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
sudo: required
language: python
python:
- 2.7
- 3.5

cache:
- pip
- packages

install:
- make install
- pip install requests typing

script:
- make test

# jobs instead of deploy to deploy only once (for Python3 build)
jobs:
fast_finish: true
include:
- stage: upload to PYPI, build docs and create a release
# python-semantic-release fails with Travis Python3.5
python: 2.7
install: make install_dev
script: make html

deploy:
- provider: script
skip_cleanup: true
on:
branch: master
script: make publish

- provider: releases
skip-cleanup: true
api_key: $GH_TOKEN
on:
tags: true
file: dist/*

- provider: pages
skip-cleanup: true
github-token: $GH_TOKEN
keep-history: true
on:
branch: master
local-dir: docs/build/html

after_failure:
- pip freeze
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ TESTROOT = stscraper
.PHONY: test
test:
python -m unittest test
python3 -m unittest test

.PHONY: publish
publish:
$(MAKE) clean
$(MAKE) test
python setup.py sdist bdist_wheel
twine upload dist/*
$(MAKE) clean
test $$(git config user.name) || git config user.name "semantic-release (via TravisCI)"
test $$(git config user.email) || git config user.email "semantic-release@travis"
semantic-release publish

.PHONY: clean
clean:
Expand All @@ -26,7 +23,13 @@ clean:
html:
sphinx-build -M html "docs" "docs/build"

.PHONY: install
install:
pip install -r requirements.txt

.PHONY: install_dev
install_dev:
pip install --user --upgrade -r requirements.txt
pip install --user --upgrade sphinx sphinx-autobuild
$(MAKE) install
pip install requests
pip install typing requests sphinx sphinx-autobuild
pip install python-semantic-release==3.11.2
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

requests
strudel.utils
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
license_file = LICENSE

[bdist_wheel]
universal=1
universal=1

[semantic_release]
version_variable = stscraper/__init__.py:__version__
30 changes: 16 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#!/usr/bin/env python

import os
import re
from setuptools import setup

# get author, version and license from package files
# since it has some not yet installed dependencies, parsing the file:
package = 'stscraper'
head = open(os.path.join(package, '__init__.py')).read(2048)
pattern = r"""__%s__\s*=\s*['"]([^'"]*)['"]"""
kwargs = {keyword: re.search(pattern % keyword, head).group(1)
for keyword in ('version', 'author', 'license')}

requirements = [
line.strip()
for line in open('requirements.txt')
Expand All @@ -10,13 +20,7 @@
# options reference: https://docs.python.org/2/distutils/
# see also: https://packaging.python.org/tutorials/distributing-packages/
setup(
# whenever you're updating the next three lines
# please also update oscar.py
name="strudel.scraper",
version="0.2.6", # make sure to update __init__.py.__version__
author='Marat (@cmu.edu)',
author_email='[email protected]',

description="Python interfaces to Github, Bitbucket and Gitlab APIs",
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand All @@ -27,18 +31,16 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: POSIX :: Linux',
'Topic :: Scientific/Engineering'
],
platforms=["Linux", "Solaris", "Mac OS-X", "Unix", "Windows"],
python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4',
scripts=['scripts/check_gh_limits.py'],
# entry_points={'console_scripts': [
# 'console_scripts = stscraper.github:print_limits',
# ]},
packages=['stscraper'],
license="GPL v3.0",
python_requires='>2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',
scripts=[os.path.join('scripts', 'check_gh_limits.py')],
packages=[package],
url='https://github.com/cmustrudel/strudel.scraper',
install_requires=requirements
install_requires=requirements,
**kwargs
)

0 comments on commit 01218fb

Please sign in to comment.