mirror of
https://github.com/jazzband/django-dbtemplates.git
synced 2026-03-16 22:20:28 +00:00
Migrate to GitHub Actions. (#112)
* Add GitHub Actions test workflow. * Update version map. * Fix flake8 * Write coverage file. * Fix typo. * Add release workflow. * Removed Travis cruft and updated other files. * Update trove classifiers. * Black setup. * Remove unneeded twine check. * Extend changelog. * Fix six issue. * Update tox.ini Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> * Add 3.9. * Add base python Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
parent
68ac54a72b
commit
012fe061a8
12 changed files with 158 additions and 108 deletions
40
.github/workflows/release.yml
vendored
Normal file
40
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'jazzband/django-dbtemplates'
|
||||
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-dbtemplates/upload
|
||||
48
.github/workflows/test.yml
vendored
Normal file
48
.github/workflows/test.yml
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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: 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 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
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -8,3 +8,4 @@ docs/_build
|
|||
.tox/
|
||||
*.egg/
|
||||
.coverage
|
||||
coverage.xml
|
||||
|
|
|
|||
30
.travis.yml
30
.travis.yml
|
|
@ -1,30 +0,0 @@
|
|||
language: python
|
||||
python:
|
||||
- '2.7'
|
||||
- '3.5'
|
||||
- '3.6'
|
||||
# Enable 3.7 without globally enabling sudo and dist: xenial for other build jobs
|
||||
# See https://github.com/travis-ci/travis-ci/issues/9815
|
||||
matrix:
|
||||
include:
|
||||
- python: 3.7
|
||||
dist: xenial
|
||||
sudo: true
|
||||
sudo: false
|
||||
cache: pip
|
||||
install:
|
||||
- pip install tox-travis
|
||||
script: tox -v
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
deploy:
|
||||
provider: pypi
|
||||
user: jazzband
|
||||
server: https://jazzband.co/projects/django-dbtemplates/upload
|
||||
distributions: sdist bdist_wheel
|
||||
password:
|
||||
secure: xDkRgaRI29FIVfQ5WEj6zSIlbBdFK/BE2RYQpSggVeTpUaZucS2RtE7it2hCMMYU5patHbcGJtw/DKGMtAhhZcm9tYCpn7cyW6vyF7tT385mbk5yggdjz5MoIHjQJD9NW1fqFRwLIJPICy6U6apxvQ1SpVtF13Dfu5AaCMv4cvk=
|
||||
on:
|
||||
tags: true
|
||||
repo: jazzband/django-dbtemplates
|
||||
python: 3.7
|
||||
|
|
@ -5,9 +5,9 @@ django-dbtemplates
|
|||
:alt: Jazzband
|
||||
:target: https://jazzband.co/
|
||||
|
||||
.. image:: https://travis-ci.org/jazzband/django-dbtemplates.svg?branch=master
|
||||
:alt: Build Status
|
||||
:target: http://travis-ci.org/jazzband/django-dbtemplates
|
||||
.. image:: https://github.com/jazzband/django-dbtemplates/workflows/Test/badge.svg
|
||||
:target: https://github.com/jazzband/django-dbtemplates/actions
|
||||
:alt: GitHub Actions
|
||||
|
||||
.. image:: https://codecov.io/github/jazzband/django-dbtemplates/coverage.svg?branch=master
|
||||
:alt: Codecov
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
__version__ = "3.0"
|
||||
from pkg_resources import get_distribution, DistributionNotFound
|
||||
|
||||
try:
|
||||
__version__ = get_distribution("django-dbtemplates").version
|
||||
except DistributionNotFound:
|
||||
# package is not installed
|
||||
__version__ = None
|
||||
|
||||
|
||||
default_app_config = 'dbtemplates.apps.DBTemplatesConfig'
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import posixpath
|
|||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.conf import settings
|
||||
from six import string_types
|
||||
|
||||
from appconf import AppConf
|
||||
|
||||
|
|
@ -33,7 +32,7 @@ class DbTemplatesConf(AppConf):
|
|||
return "dbtemplates"
|
||||
else:
|
||||
return "default"
|
||||
if isinstance(value, string_types) and value.startswith("dbtemplates."):
|
||||
if isinstance(value, str) and value.startswith("dbtemplates."):
|
||||
raise ImproperlyConfigured("Please upgrade to one of the "
|
||||
"supported backends as defined "
|
||||
"in the Django docs.")
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
import io
|
||||
import os
|
||||
import sys
|
||||
from django.contrib.sites.models import Site
|
||||
from django.core.management.base import CommandError, BaseCommand
|
||||
from django.template.utils import get_app_template_dirs
|
||||
from django.template.loader import _engine_list
|
||||
try:
|
||||
from six import input
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from dbtemplates.models import Template
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,10 @@ from django.contrib.sites.models import Site
|
|||
from django.db import models
|
||||
from django.db.models import signals
|
||||
from django.template import TemplateDoesNotExist
|
||||
from six import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.timezone import now
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Template(models.Model):
|
||||
"""
|
||||
Defines a template model for use with the database template loader.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
v4.0 (unreleased)
|
||||
-----------------
|
||||
|
||||
.. warning::
|
||||
|
||||
This is a backwards-incompatible release!
|
||||
|
||||
* Dropped support for Python 2.7.
|
||||
|
||||
* Added support for Python 3.8.
|
||||
|
||||
* Moved test runner to GitHub Actions:
|
||||
|
||||
http://github.com/jazzband/django-dbtemplates/actions
|
||||
|
||||
v3.0 (2019-01-27)
|
||||
-----------------
|
||||
|
||||
|
|
|
|||
69
setup.py
69
setup.py
|
|
@ -1,62 +1,45 @@
|
|||
import ast
|
||||
import os
|
||||
import io
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
class VersionFinder(ast.NodeVisitor):
|
||||
def __init__(self):
|
||||
self.version = None
|
||||
|
||||
def visit_Assign(self, node):
|
||||
if node.targets[0].id == '__version__':
|
||||
self.version = node.value.s
|
||||
|
||||
|
||||
def read(*parts):
|
||||
filename = os.path.join(os.path.dirname(__file__), *parts)
|
||||
with io.open(filename, encoding='utf-8') as fp:
|
||||
with io.open(filename, encoding="utf-8") as fp:
|
||||
return fp.read()
|
||||
|
||||
|
||||
def find_version(*parts):
|
||||
finder = VersionFinder()
|
||||
finder.visit(ast.parse(read(*parts)))
|
||||
return finder.version
|
||||
|
||||
|
||||
setup(
|
||||
name='django-dbtemplates',
|
||||
version=find_version('dbtemplates', '__init__.py'),
|
||||
description='Template loader for templates stored in the database',
|
||||
long_description=read('README.rst'),
|
||||
author='Jannis Leidel',
|
||||
author_email='jannis@leidel.info',
|
||||
url='https://django-dbtemplates.readthedocs.io/',
|
||||
name="django-dbtemplates",
|
||||
use_scm_version={"version_scheme": "post-release"},
|
||||
setup_requires=["setuptools_scm"],
|
||||
description="Template loader for templates stored in the database",
|
||||
long_description=read("README.rst"),
|
||||
author="Jannis Leidel",
|
||||
author_email="jannis@leidel.info",
|
||||
url="https://django-dbtemplates.readthedocs.io/",
|
||||
packages=find_packages(),
|
||||
zip_safe=False,
|
||||
package_data={
|
||||
'dbtemplates': [
|
||||
'locale/*/LC_MESSAGES/*',
|
||||
'static/dbtemplates/css/*.css',
|
||||
'static/dbtemplates/js/*.js',
|
||||
"dbtemplates": [
|
||||
"locale/*/LC_MESSAGES/*",
|
||||
"static/dbtemplates/css/*.css",
|
||||
"static/dbtemplates/js/*.js",
|
||||
],
|
||||
},
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Environment :: Web Environment',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: BSD License',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Framework :: Django',
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Web Environment",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Framework :: Django",
|
||||
],
|
||||
install_requires=['django-appconf >= 0.4', 'six'],
|
||||
install_requires=["django-appconf >= 0.4"],
|
||||
)
|
||||
|
|
|
|||
38
tox.ini
38
tox.ini
|
|
@ -3,18 +3,26 @@ skipsdist = True
|
|||
usedevelop = True
|
||||
minversion = 1.8
|
||||
envlist =
|
||||
flake8-py{27,37},
|
||||
twine-check-py{27,37},
|
||||
py{27,35,36}-dj111
|
||||
flake8
|
||||
py{35,36}-dj111
|
||||
py{35,36,37}-dj21
|
||||
py{35,36,37}-dj22
|
||||
py{35,36,37,38,39}-dj22
|
||||
|
||||
[gh-actions]
|
||||
python =
|
||||
3.5: py36
|
||||
3.6: py36
|
||||
3.7: py37
|
||||
3.8: py38, flake8
|
||||
3.9: py39
|
||||
|
||||
[testenv]
|
||||
basepython =
|
||||
py27: python2.7
|
||||
py35: python3.5
|
||||
py36: python3.6
|
||||
py37: python3.7
|
||||
py38: python3.8
|
||||
py39: python3.9
|
||||
usedevelop = true
|
||||
setenv =
|
||||
DJANGO_SETTINGS_MODULE = dbtemplates.test_settings
|
||||
|
|
@ -30,24 +38,10 @@ commands =
|
|||
python --version
|
||||
coverage run {envbindir}/django-admin.py test -v2 {posargs:dbtemplates}
|
||||
coverage report
|
||||
coverage xml
|
||||
|
||||
[testenv:twine-check-py27]
|
||||
commands =
|
||||
python setup.py sdist bdist_wheel
|
||||
twine check dist/*
|
||||
deps = twine
|
||||
|
||||
[testenv:twine-check-py37]
|
||||
commands =
|
||||
python setup.py sdist bdist_wheel
|
||||
twine check dist/*
|
||||
deps = twine
|
||||
|
||||
[testenv:flake8-py27]
|
||||
commands = flake8 dbtemplates
|
||||
deps = flake8
|
||||
|
||||
[testenv:flake8-py37]
|
||||
[testenv:flake8]
|
||||
basepython = python3.8
|
||||
commands = flake8 dbtemplates
|
||||
deps = flake8
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue