Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup github actions workflow #66

Merged
merged 3 commits into from Dec 10, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/python-package.yml
@@ -0,0 +1,54 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [main, feature/*]
pull_request:
branches: [main]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [ '3.8', '3.9' ]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[extras]
- name: Lint with flake8
run: |
python -m pip install flake8 flake8-bugbear flake8-commas flake8-import-order
flake8 .
- name: Test with pytest and generate coverage report
run: |
python -m pip install pytest pytest-cov
pytest --cov --cov-report=xml -vv
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
env_vars: OS,PYTHON
name: paxter-codecov
verbose: true
- name: Package sanity check
run: |
python -m pip install docutils check-manifest
python setup.py check --strict --metadata
check-manifest
31 changes: 31 additions & 0 deletions .github/workflows/python-publish.yml
@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

50 changes: 17 additions & 33 deletions Makefile
Expand Up @@ -45,7 +45,7 @@ ifndef VIRTUAL_ENV
endif
@which pip-sync >/dev/null 2>&1 || pip install pip-tools
pip-sync $(REQUIREMENTS_FILES)
pip install -e .[extras]
pip install -e .

.PHONY: lock_python_requirements
lock_python_requirements: $(REQUIREMENTS_FILES)
Expand All @@ -65,54 +65,38 @@ endif
######################

.PHONY: test
test: flake8 pytest tox_python tox_sanity
test: tox sanity
@# Run all code quality tools

.PHONY: pytest
pytest:
@# Run pyauthor unit tests (you may also specify ARGS='<pytest args>')
ifndef VIRTUAL_ENV
$(error must run target inside python virtualenv)
endif
python -m pytest -v $(ARGS)

.PHONY: pytest_cov
pytest_cov:
@# Run pyauthor unit tests with code coverage summary
ifndef VIRTUAL_ENV
$(error must run target inside python virtualenv)
endif
python -m pytest $(foreach pkg,$(PYTHON_PROJECT_PACKAGES),"--cov=$(pkg)") \
--cov-report=term-missing -v $(ARGS)

.PHONY: tox_python
tox_python:
@# Run pytest on various pyauthor versions
.PHONY: tox
tox:
@# Run both flake8 and pytest on multiple python version
ifndef VIRTUAL_ENV
$(error must run target inside python virtualenv)
endif
tox -e py38 -e py39

.PHONY: tox_sanity
tox_sanity:
@# Perform other package sanity checks
tox -e check

.PHONY: flake8
flake8:
@# Run flake8 pyauthor code linter tool
@# Run code linter tool on python source files
ifndef VIRTUAL_ENV
$(error must run target inside python virtualenv)
endif
flake8 src tests setup.py
flake8 .

.PHONY: mypy
mypy:
@# Run pyauthor type checker tool
.PHONY: pytest
pytest:
@# Run unit testing on python source files (may also specify ARGS='<pytest args>')
ifndef VIRTUAL_ENV
$(error must run target inside python virtualenv)
endif
mypy .
python -m pytest -vv $(ARGS)

.PHONY: sanity
sanity:
@# Perform other package sanity checks
python setup.py check --strict --metadata
check-manifest

.PHONY: test_clean
test_clean:
Expand Down
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -15,7 +15,6 @@
<a href="https://travis-ci.com/abhabongse/paxter"><img src="https://api.travis-ci.com/abhabongse/paxter.svg?branch=main" alt="Travis-CI Build Status" /></a>
<a href="https://requires.io/github/abhabongse/paxter/requirements/?branch=main"><img src="https://requires.io/github/abhabongse/paxter/requirements.svg?branch=main" alt="Requirements Status" /></a>
<a href="https://codecov.io/github/abhabongse/paxter"><img src="https://codecov.io/github/abhabongse/paxter/coverage.svg?branch=main" alt="Coverage Status" /></a>
<a href="https://www.codacy.com/app/abhabongse/paxter"><img src="https://img.shields.io/codacy/grade/0d0c904fe452419692107d3163fe49b5.svg" alt="Codacy Code Quality Status" /></a>
</div>
</td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions dev-requirements.in
@@ -1,4 +1,6 @@
-c docs/requirements.txt
check-manifest>=0.45
docutils>=0.16
flake8>=3.7.9
flake8-bugbear>=20.1.4
flake8-commas>=2.0.0
Expand Down
57 changes: 30 additions & 27 deletions dev-requirements.txt
Expand Up @@ -8,23 +8,25 @@ alabaster==0.7.12 # via -c docs/requirements.txt, sphinx
appdirs==1.4.4 # via virtualenv
argon2-cffi==20.1.0 # via notebook
async-generator==1.10 # via nbclient
attrs==20.2.0 # via -c docs/requirements.txt, flake8-bugbear, jsonschema, pytest
babel==2.8.0 # via -c docs/requirements.txt, sphinx
attrs==20.3.0 # via -c docs/requirements.txt, flake8-bugbear, jsonschema, pytest
babel==2.9.0 # via -c docs/requirements.txt, sphinx
backcall==0.2.0 # via ipython
bleach==3.2.1 # via nbconvert, readme-renderer
certifi==2020.6.20 # via -c docs/requirements.txt, requests
cffi==1.14.3 # via argon2-cffi, cryptography
build==0.1.0 # via check-manifest
certifi==2020.12.5 # via -c docs/requirements.txt, requests
cffi==1.14.4 # via argon2-cffi, cryptography
chardet==3.0.4 # via -c docs/requirements.txt, requests
check-manifest==0.45 # via -r dev-requirements.in
colorama==0.4.4 # via twine
coverage==5.3 # via pytest-cov
cryptography==3.2.1 # via secretstorage
cryptography==3.3.1 # via secretstorage
decorator==4.4.2 # via ipython
defusedxml==0.6.0 # via nbconvert
distlib==0.3.1 # via virtualenv
docutils==0.16 # via -c docs/requirements.txt, readme-renderer, sphinx
docutils==0.16 # via -c docs/requirements.txt, -r dev-requirements.in, readme-renderer, sphinx
entrypoints==0.3 # via nbconvert
filelock==3.0.12 # via tox, virtualenv
flake8-bugbear==20.1.4 # via -r dev-requirements.in
flake8-bugbear==20.11.1 # via -r dev-requirements.in
flake8-commas==2.0.0 # via -r dev-requirements.in
flake8-import-order==0.18.1 # via -r dev-requirements.in
flake8==3.8.4 # via -r dev-requirements.in, flake8-bugbear, flake8-commas
Expand All @@ -36,58 +38,59 @@ ipython-genutils==0.2.0 # via nbformat, notebook, qtconsole, traitlets
ipython==7.19.0 # via ipykernel, ipywidgets, jupyter-console
ipywidgets==7.5.1 # via jupyter
jedi==0.17.2 # via ipython
jeepney==0.4.3 # via keyring, secretstorage
jeepney==0.6.0 # via keyring, secretstorage
jinja2==2.11.2 # via -c docs/requirements.txt, nbconvert, notebook, sphinx
jsonschema==3.2.0 # via nbformat
jupyter-client==6.1.7 # via ipykernel, jupyter-console, nbclient, notebook, qtconsole
jupyter-console==6.2.0 # via jupyter
jupyter-core==4.6.3 # via jupyter-client, nbconvert, nbformat, notebook, qtconsole
jupyter-core==4.7.0 # via jupyter-client, nbconvert, nbformat, notebook, qtconsole
jupyter==1.0.0 # via -r dev-requirements.in
jupyterlab-pygments==0.1.2 # via nbconvert
keyring==21.4.0 # via twine
keyring==21.5.0 # via twine
livereload==2.6.3 # via sphinx-autobuild
markupsafe==1.1.1 # via -c docs/requirements.txt, jinja2
mccabe==0.6.1 # via flake8
mistune==0.8.4 # via nbconvert
nbclient==0.5.1 # via nbconvert
nbconvert==6.0.7 # via jupyter, notebook
nbformat==5.0.8 # via ipywidgets, nbclient, nbconvert, notebook
nest-asyncio==1.4.2 # via nbclient
notebook==6.1.4 # via jupyter, widgetsnbextension
packaging==20.4 # via -c docs/requirements.txt, bleach, pytest, sphinx, tox
nest-asyncio==1.4.3 # via nbclient
notebook==6.1.5 # via jupyter, widgetsnbextension
packaging==20.7 # via -c docs/requirements.txt, bleach, build, pytest, sphinx, tox
pandocfilters==1.4.3 # via nbconvert
parso==0.7.1 # via jedi
pep517==0.9.1 # via build
pexpect==4.8.0 # via ipython
pickleshare==0.7.5 # via ipython
pkginfo==1.6.1 # via twine
pluggy==0.13.1 # via pytest, tox
prometheus-client==0.8.0 # via notebook
prometheus-client==0.9.0 # via notebook
prompt-toolkit==3.0.8 # via ipython, jupyter-console
ptyprocess==0.6.0 # via pexpect, terminado
py==1.9.0 # via pytest, tox
pycodestyle==2.6.0 # via flake8, flake8-import-order
pycparser==2.20 # via cffi
pyflakes==2.2.0 # via flake8
pygments==2.7.2 # via -c docs/requirements.txt, ipython, jupyter-console, jupyterlab-pygments, nbconvert, qtconsole, readme-renderer, sphinx
pygments==2.7.3 # via -c docs/requirements.txt, ipython, jupyter-console, jupyterlab-pygments, nbconvert, qtconsole, readme-renderer, sphinx
pyparsing==2.4.7 # via -c docs/requirements.txt, packaging
pyrsistent==0.17.3 # via jsonschema
pytest-cov==2.10.1 # via -r dev-requirements.in
pytest==6.1.2 # via -r dev-requirements.in, pytest-cov
python-dateutil==2.8.1 # via jupyter-client
pytz==2020.1 # via -c docs/requirements.txt, babel
pyzmq==19.0.2 # via jupyter-client, notebook, qtconsole
qtconsole==4.7.7 # via jupyter
pytz==2020.4 # via -c docs/requirements.txt, babel
pyzmq==20.0.0 # via jupyter-client, notebook, qtconsole
qtconsole==5.0.1 # via jupyter
qtpy==1.9.0 # via qtconsole
readme-renderer==28.0 # via twine
requests-toolbelt==0.9.1 # via twine
requests==2.24.0 # via -c docs/requirements.txt, requests-toolbelt, sphinx, twine
requests==2.25.0 # via -c docs/requirements.txt, requests-toolbelt, sphinx, twine
rfc3986==1.4.0 # via twine
secretstorage==3.1.2 # via keyring
secretstorage==3.3.0 # via keyring
send2trash==1.5.0 # via notebook
six==1.15.0 # via -c docs/requirements.txt, argon2-cffi, bleach, cryptography, jsonschema, livereload, packaging, python-dateutil, readme-renderer, tox, virtualenv
six==1.15.0 # via argon2-cffi, bleach, cryptography, jsonschema, livereload, python-dateutil, readme-renderer, tox, virtualenv
snowballstemmer==2.0.0 # via -c docs/requirements.txt, sphinx
sphinx-autobuild==2020.9.1 # via -r dev-requirements.in
sphinx==3.2.1 # via -c docs/requirements.txt, sphinx-autobuild
sphinx==3.3.1 # via -c docs/requirements.txt, sphinx-autobuild
sphinxcontrib-applehelp==1.0.2 # via -c docs/requirements.txt, sphinx
sphinxcontrib-devhelp==1.0.2 # via -c docs/requirements.txt, sphinx
sphinxcontrib-htmlhelp==1.0.3 # via -c docs/requirements.txt, sphinx
Expand All @@ -96,17 +99,17 @@ sphinxcontrib-qthelp==1.0.3 # via -c docs/requirements.txt, sphinx
sphinxcontrib-serializinghtml==1.1.4 # via -c docs/requirements.txt, sphinx
terminado==0.9.1 # via notebook
testpath==0.4.4 # via nbconvert
toml==0.10.1 # via pytest, tox
toml==0.10.2 # via build, check-manifest, pep517, pytest, tox
tornado==6.1 # via ipykernel, jupyter-client, livereload, notebook, terminado
tox==3.20.1 # via -r dev-requirements.in
tqdm==4.51.0 # via twine
tqdm==4.54.1 # via twine
traitlets==5.0.5 # via ipykernel, ipython, ipywidgets, jupyter-client, jupyter-core, nbclient, nbconvert, nbformat, notebook, qtconsole
twine==3.2.0 # via -r dev-requirements.in
urllib3==1.25.11 # via -c docs/requirements.txt, requests
virtualenv==20.1.0 # via tox
urllib3==1.26.2 # via -c docs/requirements.txt, requests
virtualenv==20.2.2 # via tox
wcwidth==0.2.5 # via prompt-toolkit
webencodings==0.5.1 # via bleach
wheel==0.35.1 # via -r dev-requirements.in
wheel==0.36.1 # via -r dev-requirements.in
widgetsnbextension==3.5.1 # via ipywidgets

# The following packages are considered to be unsafe in a requirements file:
Expand Down