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

GitHub actions #862

Merged
merged 11 commits into from
Mar 20, 2021
71 changes: 71 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Python package

on: [push]

jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mysql:
image: mysql
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: root
options: >-
--health-cmd "mysqladmin -uroot -proot ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
env:
PYTHONDEVMODE: 1
DJANGO_DATABASE_HOST_POSTGRES: localhost
DJANGO_DATABASE_USER_POSTGRES: postgres
DJANGO_DATABASE_NAME_POSTGRES: postgres
DJANGO_DATABASE_PASSWORD_POSTGRES: postgres
DJANGO_DATABASE_HOST_MYSQL: 127.0.0.1
DJANGO_DATABASE_USER_MYSQL: root
DJANGO_DATABASE_NAME_MYSQL: root
DJANGO_DATABASE_PASSWORD_MYSQL: root
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
django-version:
- '>=3.1,<3.2'
- '>=3.0,<3.1'
- '>=2.2,<3.0'
- '>=2.1,<2.2'
- '>=2.0,<2.1'
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 (Django ${{ matrix.django-version }})
run: |
python -m pip install --upgrade pip
python -m pip install --pre django'${{ matrix.django-version }}'
python -m pip install flake8 coverage sphinx sphinx_rtd_theme psycopg2 mysqlclient -e .
- name: Lint with flake8
run: |
flake8
- name: Test with unittest
run: |
coverage run tests/manage.py test tests
coverage report
- name: Build docs
run: |
(cd docs && sphinx-build -n -W . _build)
26 changes: 26 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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/*
53 changes: 0 additions & 53 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
django-reversion
================

|PyPI latest| |PyPI Version| |PyPI License| |TravisCI| |Docs|
|PyPI latest| |PyPI Version| |PyPI License| |Github actions| |Docs|


**django-reversion** is an extension to the Django web framework that provides
Expand Down Expand Up @@ -77,5 +77,5 @@ to by `many other people <https://github.com/etianen/django-reversion/graphs/con
:target: https://github.com/rhenter/django-reversion/blob/master/LICENSE
.. |PyPI latest| image:: https://img.shields.io/pypi/v/django-reversion.svg?maxAge=120
:target: https://pypi.python.org/pypi/django-reversion
.. |TravisCI| image:: https://travis-ci.org/etianen/django-reversion.svg?branch=master
:target: https://travis-ci.org/etianen/django-reversion
.. |Github actions| image:: https://github.com/etianen/django-reversion/workflows/Python%20package/badge.svg
:target: https://github.com/etianen/django-reversion
27 changes: 13 additions & 14 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import os
from reversion import __version__

# -- General configuration ------------------------------------------------
Expand All @@ -32,7 +33,11 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx"]

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = []
Expand Down Expand Up @@ -113,25 +118,19 @@
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False

suppress_warnings = ["image.nonlocal_uri"]

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# Use RTD theme locally.
if not os.environ.get('READTHEDOCS', None) == 'True':
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@
},
"postgres": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"HOST": os.environ.get("DJANGO_DATABASE_HOST_POSTGRES", ""),
"NAME": os.environ.get("DJANGO_DATABASE_NAME_POSTGRES", "test_project"),
"USER": os.environ.get("DJANGO_DATABASE_USER_POSTGRES", getpass.getuser()),
"PASSWORD": os.environ.get("DJANGO_DATABASE_PASSWORD_POSTGRES", ""),
},
"mysql": {
"ENGINE": "django.db.backends.mysql",
"HOST": os.environ.get("DJANGO_DATABASE_HOST_MYSQL", ""),
"NAME": os.environ.get("DJANGO_DATABASE_NAME_MYSQL", "test_project"),
"USER": os.environ.get("DJANGO_DATABASE_USER_MYSQL", getpass.getuser()),
"PASSWORD": os.environ.get("DJANGO_DATABASE_PASSWORD_MYSQL", ""),
Expand Down