Skip to content

Commit

Permalink
Migrate to GitHub Actions. (#226)
Browse files Browse the repository at this point in the history
* Add initial GitHub Actions test workflow.

* Install GIS deps better?

* Removed Travis cruft.

* Add 3.9.
  • Loading branch information
jezdez authored Dec 21, 2020
1 parent fa8d170 commit be03760
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 69 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
tags:
- '*'

jobs:
build:
if: github.repository == 'jazzband/django-floppyforms'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools twine wheel
- name: Build package
run: |
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
twine check dist/*
- name: Upload packages to Jazzband
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: jazzband
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}
repository_url: https://jazzband.co/projects/django-floppyforms/upload
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9']

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 GIS dependencies
run: |
sudo apt-get -q -y update
sudo apt-get -q -y install binutils gdal-bin libproj-dev libgeos-c1v5
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }}
restore-keys: |
${{ matrix.python-version }}-v1-
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: |
tox -v
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ __pycache__
.mypy_cache
# PyCharm IDE files
.idea/
coverage.xml
10 changes: 7 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ django-floppyforms
:target: https://jazzband.co/
:alt: Jazzband

.. image:: https://api.travis-ci.org/jazzband/django-floppyforms.png
:alt: Build Status
:target: https://travis-ci.org/jazzband/django-floppyforms
.. image:: https://github.com/jazzband/django-floppyforms/workflows/Test/badge.svg
:target: https://github.com/jazzband/django-floppyforms/actions
:alt: GitHub Actions

.. image:: https://codecov.io/gh/jazzband/django-floppyforms/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jazzband/django-floppyforms
:alt: Coverage

Full control of form rendering in the templates.

Expand Down
56 changes: 0 additions & 56 deletions runtests.py

This file was deleted.

4 changes: 2 additions & 2 deletions requirements/tests.txt → tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
argparse
coverage<6.0
coverage
flake8
django-discover-runner
Pillow
pip <= 21
pip
26 changes: 18 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
[tox]
minversion = 1.8
envlist =
docs,
flake8,
py36-{22, 30},
py37-{22, 30},
docs
checks
py36-{22, 30}
py37-{22, 30}
py38-{22, 30}
py39-{22, 30}

[gh-actions]
python =
3.6: py36
3.7: py37, docs, checks
3.8: py38
3.9: py39

[testenv]
deps =
111: Django >= 1.11, < 2.0
22: Django >= 2.2, < 3.0
30: Django >= 3.0, < 4.0
-r{toxinidir}/requirements/tests.txt
commands = python runtests.py
-r{toxinidir}/tests/requirements.txt
commands =
coverage run --source=floppyforms --branch {envbindir}/django-admin test --pythonpath=./ --settings=tests.settings
coverage report -m
coverage xml

[testenv:docs]
changedir = docs
Expand All @@ -28,4 +38,4 @@ deps =
readme_renderer
commands =
flake8 floppyforms
python setup.py check -r -s
python setup.py check -r -s

0 comments on commit be03760

Please sign in to comment.