Skip to content

Commit

Permalink
Merge pull request #64 from peopledoc/django3_migration
Browse files Browse the repository at this point in the history
Django3 migration
  • Loading branch information
robincherbonnier authored Feb 7, 2022
2 parents 32151e9 + bb38fc6 commit 9efae92
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 20 deletions.
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Closes #<ticket number>

### Checklist:
<!-- In case of doubt, we're here to help. CONTRIBUTING.rst might help too -->
- [ ] Tests
- [ ] (not applicable?)
- [ ] Documentation
- [ ] (not applicable?)

<!-- We hope your contributing experience was great so far. If you would like to
provide some feedback, please feel free to do so! -->
8 changes: 8 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name-template: '$NEXT_MINOR_VERSION'
tag-template: '$NEXT_MINOR_VERSION'
template: |
$CHANGES
## Kudos:
$CONTRIBUTORS
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI

on:
pull_request:
push:
branches:
- 'master'
tags:
- '*'

jobs:
build:

strategy:
matrix:
include:

- name: Python 3.6 / Django 1.10
python_version: "3.6"
tox_env: py36-django110

- name: Python 3.7 / Django 1.10
python_version: "3.7"
tox_env: py37-django110

- name: Python 3.7 / Django 2.2
python_version: "3.7"
tox_env: py37-django22

- name: Python 3.9 / Django 2.2
python_version: "3.9"
tox_env: py39-django22

- name: Python 3.9 / Django 3.0
python_version: "3.9"
tox_env: py39-django30

- name: Python 3.9 / Django 3.1
python_version: "3.9"
tox_env: py39-django31

- name: Python 3.7 / Django 3.2
python_version: "3.7"
tox_env: py37-django32

- name: Python 3.8 / Django 3.2
python_version: "3.8"
tox_env: py38-django32

- name: Python 3.9 / Django 3.2
python_version: "3.9"
tox_env: py39-django32

- name: Python 3.9 / Django 4.0
python_version: "3.9"
tox_env: py39-django40

- name: Flake8
python_version: "3"
tox_env: flake8

name: "${{ matrix.name }}"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

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

- name: Pip cache
uses: actions/cache@v2
with:
path: |
~/.cache/
key: ${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('setup.cfg') }}

- name: Install Tox
run: pip install tox

- name: Run ${{ matrix.name }}
run: tox
env:
TOXENV: "${{ matrix.tox_env }}"

report-status:
name: success
runs-on: ubuntu-latest
needs: build
steps:

- name: Report success
run: echo 'Success !'
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy

on:
push:
tags:
- '*'

jobs:
deploy:
name: Publish package to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

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

- name: Install
run: pip install build

- name: Build package
run: python -m build

- name: Wait for tests to succeed
uses: fountainhead/[email protected]
id: wait-for-ci
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: success

- name: Exit if CI did not succeed
if: steps.wait-for-ci.outputs.conclusion != 'success'
run: exit 1

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: "${{ secrets.PYPI_TOKEN }}"
15 changes: 15 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release Drafter

on:
push:
branches:
- master

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts the next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 7 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ Changelog
2.3.0 (unreleased)
------------------

- Nothing changed yet.

- Remove CI test because Nose is unmaintained and no longer works with Python 3.10.
- Update CI tox envs
- Add github actions
- Rename tox.ini envs
- Django 3 compatibility
- Update tox.ini
- Fix doc filename

2.2.1 (2020-07-15)
------------------
Expand Down
27 changes: 15 additions & 12 deletions demo/demoproject/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import django
from django.conf.urls import url
from django.views.generic import TemplateView
try:
from django.urls import re_path
except ImportError:
from django.conf.urls import url as re_path

from pkg_resources import parse_version

Expand All @@ -13,38 +16,38 @@
home = TemplateView.as_view(template_name="home.html")

patterns_list = [
url(r"^$", home, name="home"),
url(r"^colors/$", views.colors, name="colors"),
re_path(r"^$", home, name="home"),
re_path(r"^colors/$", views.colors, name="colors"),
# Column
url(
re_path(
r"^column_highchart/json/$",
views.column_highchart_json,
name="column_highchart_json",
),
# Line chart
url(r"^line_chart/$", views.line_chart, name="line_chart"),
url(r"^line_chart/json/$", views.line_chart_json, name="line_chart_json"),
url(
re_path(r"^line_chart/$", views.line_chart, name="line_chart"),
re_path(r"^line_chart/json/$", views.line_chart_json, name="line_chart_json"),
re_path(
r"^line_chart/discontinuous/json/$",
views.discontinuous_dates_chart_json,
name="discontinuous_line_chart_json",
),
url(
re_path(
r"^line_chart/options/$",
views.line_chart_with_options,
name="line_chart_with_options",
),
url(
re_path(
r"^line_highchart/json/$", views.line_highchart_json, name="line_highchart_json"
),
url(
re_path(
r"^line_highchart/discontinuous/json/$",
views.discontinuous_dates_highchart_json,
name="discontinuous_line_highchart_json",
),
# Pie
url(r"^pie_highchart/json/$", views.pie_highchart_json, name="pie_highchart_json"),
url(
re_path(r"^pie_highchart/json/$", views.pie_highchart_json, name="pie_highchart_json"),
re_path(
r"^donut_highchart/json/$",
views.donut_highchart_json,
name="donut_highchart_json",
Expand Down
2 changes: 1 addition & 1 deletion demo/demoproject/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from itertools import islice
from random import randint, shuffle

from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView

from chartjs.colors import COLORS, next_color
Expand Down
2 changes: 1 addition & 1 deletion demo/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def read_relative_file(filename):


NAME = "django-chartjs-demo"
README = read_relative_file("README")
README = read_relative_file("README.rst")
VERSION = "0.1"
PACKAGES = ["demoproject"]
REQUIRES = ["django-chartjs", "Django", "django_nose"]
Expand Down
15 changes: 11 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
[tox]
envlist = django{110,22,30}-py{36,37},django{22,30}-py{38},flake8
envlist =
py{36,37}-django110
py{37,38,39}-django{22,30,31,32}
py{38,39,310}-django40
flake8

[testenv]
deps =
django110: Django>=1.10,<1.11
django22: Django>=2.2,<2.3
django30: Django>=3.0,<3.1
django110: Django==1.10.*
django22: Django==2.2.*
django30: Django==3.0.*
django31: Django==3.1.*
django32: Django==3.2.*
django40: Django==4.0.*
commands =
pip install -r test-requirements.pip
pip install -e ./
Expand Down

0 comments on commit 9efae92

Please sign in to comment.