Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Github actions for tests and pypi publication
- Loading branch information
Showing
4 changed files
with
89 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |