Skip to content

Commit

Permalink
feat: Add Github actions for tests and pypi publication
Browse files Browse the repository at this point in the history
  • Loading branch information
MRigal committed Apr 9, 2020
1 parent b578e89 commit 30a78e4
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 19 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pythonpublish.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@v1
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: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
39 changes: 39 additions & 0 deletions .github/workflows/test_and_coverage.yml
@@ -0,0 +1,39 @@
name: Python tox + coverage CI

# You may need to add pull_request for the coverall action
#on: ["push", "pull_request"]
on: "push"

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install -r example/requirements.txt
- name: Run Tox
run: tox
- name: Report to coverall # by the package as the action is broken, but won't work on external forks!
if: matrix.python-version == 3.7
run: |
pip install coveralls
COVERALLS_REPO_TOKEN= ${{ secrets.COVERALLS_REPO_TOKEN }} coveralls
# The official action is broken as only supports LCOV format, not supported by python coverage
# Think about moving to codecov or another provider?
# - name: Coveralls
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -2,9 +2,9 @@ language: python
cache: pip
python:
- 3.5
- 3.6
- 3.7
- 3.8
# - 3.6
# - 3.7
# - 3.8
install:
- pip install -U pip
- pip install -U tox
Expand Down
32 changes: 16 additions & 16 deletions tox.ini
@@ -1,29 +1,29 @@
# Tox (http://tox.testrun.org/) is a tool for running tests in multiple virtualenvs.
# Install it via: pip install tox
# Then call "tox" from this directory to run the test suite for all configurations.
# You don't need all versions locally, if at least one passes, let it run on CI.

[tox]
envlist = django22, django30
envlist =
py{35,36,37,38}-django22
py{36,37,38}-django30

[base]
deps =
pillow==6.2.2
-r{toxinidir}/example/requirements.txt
[gh-actions]
python =
3.5: py35
3.6: py36
3.7: py37
3.8: py38

[testenv]
commands =
py.test example --create-db --cache-clear --cov-append
coverage report
pytest example --create-db --cache-clear --cov-append
; coverage report
setenv =
DJANGO_SETTINGS_MODULE=example.settings
PYTHONPATH={toxinidir}

[testenv:django22]
deps =
Django>=2.2,<3.0
{[base]deps}

[testenv:django30]
deps =
Django>=3.0,<3.1
{[base]deps}
pillow==6.2.2
-r{toxinidir}/example/requirements.txt
django22: Django>=2.2,<3.0
django30: Django>=3.0,<3.1

0 comments on commit 30a78e4

Please sign in to comment.