Skip to content

Commit

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

* Add django version env var handling to tox config.

* Update badges.

* Add release workflow.

* Remove Travis.

* Fix typo.

* Fix more typos.

* Write coverage.xml.

* Remove the need for the VERSION file.

* Simplify demo setup.py.

* Remove VERSION file.

* Update demo/setup.py

* Update setup.py
  • Loading branch information
jezdez authored Dec 23, 2020
1 parent 384e7c5 commit 9f42e65
Show file tree
Hide file tree
Showing 14 changed files with 226 additions and 237 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-downloadview'
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-downloadview/upload
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test

on: [push, pull_request]

jobs:
build:
name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9']
django-version: ['2.2', '3.0', '3.1', 'master']

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- 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') }}
restore-keys: |
${{ matrix.python-version }}-v1-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: |
tox -v
env:
DJANGO: ${{ matrix.django-version }}

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

# Data files.
/var/
coverage.xml
.coverage/

# Python files.
*.pyc
Expand All @@ -14,6 +16,8 @@

# Tox files.
/.tox/
.eggs
*.egg-info

# Virtualenv files (created by tox).
/build/
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ force_grid_wrap=0
line_length=88
combine_as_imports=True

# List sections with django and
# List sections with django and
known_django=django
known_downloadview=django_downloadview

Expand Down
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ include CONTRIBUTING.rst
include INSTALL
include LICENSE
include README.rst
include VERSION
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ demo:
runserver: demo
demo runserver


#: release - Tag and push to PyPI.
.PHONY: release
release:
$(TOX) -e release

.PHONY: black
black:
$(BLACK) demo tests django_downloadview
Expand Down
27 changes: 15 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@ django-downloadview
###################

.. image:: https://jazzband.co/static/img/badge.svg
:target: https://jazzband.co/
:alt: Jazzband
:target: https://jazzband.co/
:alt: Jazzband

.. image:: https://img.shields.io/pypi/v/django-downloadview.svg
:target: https://pypi.python.org/pypi/django-downloadview
:target: https://pypi.python.org/pypi/django-downloadview

.. image:: https://img.shields.io/pypi/pyversions/django-downloadview.svg
:target: https://pypi.python.org/pypi/django-downloadview
:target: https://pypi.python.org/pypi/django-downloadview

.. image:: https://img.shields.io/pypi/dm/django-downloadview.svg
:target: https://pypi.python.org/pypi/django-downloadview
.. image:: https://travis-ci.org/jazzband/django-downloadview.svg?branch=master
:target: https://travis-ci.org/jazzband/django-downloadview
.. image:: https://coveralls.io/repos/github/jazzband/django-downloadview/badge.svg?branch=master
:target: https://coveralls.io/github/jazzband/django-downloadview?branch=master
:target: https://pypi.python.org/pypi/django-downloadview

.. image:: https://github.com/jazzband/django-downloadview/workflows/Test/badge.svg
:target: https://github.com/jazzband/django-downloadview/actions
:alt: GitHub Actions

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


`django-downloadview` makes it easy to serve files with `Django`_:

* you manage files with Django (permissions, filters, generation, ...);
Expand Down Expand Up @@ -60,8 +64,7 @@ Resources
* PyPI page: http://pypi.python.org/pypi/django-downloadview
* Code repository: https://github.com/jazzband/django-downloadview
* Bugtracker: https://github.com/jazzband/django-downloadview/issues
* Continuous integration: https://travis-ci.org/jazzband/django-downloadview
* Continuous integration: https://github.com/jazzband/django-downloadview/actions
* Roadmap: https://github.com/jazzband/django-downloadview/milestones


.. _`Django`: https://djangoproject.com
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

62 changes: 21 additions & 41 deletions demo/setup.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
"""Python packaging."""
import os

from setuptools import setup

here = os.path.abspath(os.path.dirname(__file__))
project_root = os.path.dirname(here)


NAME = "django-downloadview-demo"
DESCRIPTION = "Serve files with Django and reverse-proxies."
README = open(os.path.join(here, "README.rst")).read()
VERSION = open(os.path.join(project_root, "VERSION")).read().strip()
AUTHOR = "Benoît Bryon"
EMAIL = "benoit@marmelune.net"
URL = "https://django-downloadview.readthedocs.io/"
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 2.7",
"Framework :: Django",
]
KEYWORDS = []
PACKAGES = ["demoproject"]
REQUIREMENTS = ["django-downloadview", "django-nose"]
ENTRY_POINTS = {"console_scripts": ["demo = demoproject.manage:main"]}


if __name__ == "__main__": # Don't run setup() when we import this module.
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=README,
classifiers=CLASSIFIERS,
keywords=" ".join(KEYWORDS),
author=AUTHOR,
author_email=EMAIL,
url=URL,
license="BSD",
packages=PACKAGES,
include_package_data=True,
zip_safe=False,
install_requires=REQUIREMENTS,
entry_points=ENTRY_POINTS,
)
setup(
name="django-downloadview-demo",
version="1.0",
description="Serve files with Django and reverse-proxies.",
long_description=open(os.path.join(here, "README.rst")).read(),
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Framework :: Django",
],
author="Benoît Bryon",
author_email="benoit@marmelune.net",
url="https://django-downloadview.readthedocs.io/",
license="BSD",
packages=["demoproject"],
include_package_data=True,
zip_safe=False,
install_requires=["django-downloadview", "django-nose"],
entry_points={"console_scripts": ["demo = demoproject.manage:main"]},
)
8 changes: 3 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""django-downloadview documentation build configuration file."""
import os
import re
from pkg_resources import get_distribution

# Minimal Django settings. Required to use sphinx.ext.autodoc, because
# django-downloadview depends on Django...
Expand Down Expand Up @@ -45,14 +46,11 @@
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
configuration_dir = os.path.dirname(__file__)
documentation_dir = configuration_dir
version_file = os.path.normpath(os.path.join(documentation_dir, "../VERSION"))

# The full version, including alpha/beta/rc tags.
release = open(version_file).read().strip()
release = get_distribution("django-downloadview").version
# The short X.Y version.
version = ".".join(release.split(".")[0:1])
version = '.'.join(release.split('.')[:2])

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
Loading

0 comments on commit 9f42e65

Please sign in to comment.