Skip to content

Commit f77faf9

Browse files
authored
ci: Extend tests to django CMS up to 3.11 and Django 4.0 (#55)
* Fix: Add version-dependent tests Add: Github actions Update: Readme * Fix: remove djlint, add wheel as requirement * Fix: action commands, readme * Update long_description_content_type * Update: pypi actions * Update pypi actions Pt 2 * Update pypi actions Pt 3
1 parent 63ad808 commit f77faf9

23 files changed

+353
-64
lines changed

.github/workflows/codecov.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CodeCov
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
coverage:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: [ 3.7, 3.8, 3.9, "3.10",] # latest release minus two
16+
requirements-file: [
17+
dj22_cms38.txt,
18+
dj32_cms38.txt,
19+
dj32_cms39.txt,
20+
dj32_cms310.txt,
21+
dj32_cms311.txt,
22+
dj40_cms311.txt,
23+
]
24+
os: [
25+
ubuntu-20.04,
26+
]
27+
exclude:
28+
- python-version: 3.7
29+
requirements-file: dj40_cms311.txt
30+
steps:
31+
- uses: actions/checkout@v2
32+
with:
33+
fetch-depth: '2'
34+
35+
- name: Setup Python
36+
uses: actions/setup-python@master
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
- name: Generate Report
40+
run: |
41+
pip install -r tests/requirements/${{ matrix.requirements-file }}
42+
coverage run setup.py test
43+
- name: Upload Coverage to Codecov
44+
uses: codecov/codecov-action@v1

.github/workflows/codeql.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "master" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "master" ]
20+
schedule:
21+
- cron: '34 0 * * 1'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript', 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2
73+
with:
74+
category: "/language:${{matrix.language}}"

.github/workflows/lint-pr.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Lint PR"
2+
3+
# Validates PR titles against the conventional commit spec
4+
# https://github.com/commitizen/conventional-commit-types
5+
6+
on:
7+
pull_request_target:
8+
types:
9+
- opened
10+
- edited
11+
- synchronize
12+
13+
jobs:
14+
main:
15+
name: Validate PR title
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v4
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
flake8:
11+
name: flake8
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Set up Python
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: 3.9
20+
- name: Install flate8
21+
run: pip install --upgrade flake8
22+
- name: Run flake8
23+
uses: liskin/gh-problem-matcher-wrap@v1
24+
with:
25+
linters: flake8
26+
run: flake8
27+
28+
isort:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
- name: Set up Python
34+
uses: actions/setup-python@v3
35+
with:
36+
python-version: 3.9
37+
- run: python -m pip install isort
38+
- name: isort
39+
uses: liskin/gh-problem-matcher-wrap@v1
40+
with:
41+
linters: isort
42+
run: isort -c --df djangocms_file
43+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish Python 🐍 distributions 📦 to pypi
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build-n-publish:
10+
name: Build and publish Python 🐍 distributions 📦 to pypi
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python 3.10
15+
uses: actions/setup-python@v3
16+
with:
17+
python-version: '3.10'
18+
19+
- name: Install pypa/build
20+
run: >-
21+
python -m
22+
pip install
23+
build
24+
--user
25+
- name: Build a binary wheel and a source tarball
26+
run: >-
27+
python -m
28+
build
29+
--sdist
30+
--wheel
31+
--outdir dist/
32+
.
33+
34+
- name: Publish distribution 📦 to PyPI
35+
if: startsWith(github.ref, 'refs/tags')
36+
uses: pypa/gh-action-pypi-publish@release/v1
37+
with:
38+
user: __token__
39+
password: ${{ secrets.PYPI_API_TOKEN }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish Python 🐍 distributions 📦 to TestPyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-n-publish:
10+
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python 3.10
15+
uses: actions/setup-python@v3
16+
with:
17+
python-version: '3.10'
18+
19+
- name: Install pypa/build
20+
run: >-
21+
python -m
22+
pip install
23+
build
24+
--user
25+
- name: Build a binary wheel and a source tarball
26+
run: >-
27+
python -m
28+
build
29+
--sdist
30+
--wheel
31+
--outdir dist/
32+
.
33+
34+
- name: Publish distribution 📦 to Test PyPI
35+
uses: pypa/gh-action-pypi-publish@release/v1
36+
with:
37+
user: __token__
38+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
39+
repository_url: https://test.pypi.org/legacy/
40+
skip_existing: true

.travis.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Changelog
33
=========
44

5+
* Added support for Django 3.2, Django 4.0
6+
* Added github actions
57

68
3.0.0 (2020-09-02)
79
==================

README.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
django CMS File
33
===============
44

5-
|pypi| |build| |coverage|
5+
|pypi| |build| |coverage| |python| |django| |djangocms|
66

77
**django CMS File** is a set of plugins for `django CMS <http://django-cms.org>`_
88
that allow you to add files to your site You can either choose a single file or
99
an entire folder.
1010

1111
It uses files managed by `Django Filer <https://github.com/divio/django-filer>`_.
1212

13-
This addon is compatible with `Divio Cloud <http://divio.com>`_ and is also available on the
14-
`django CMS Marketplace <https://marketplace.django-cms.org/en/addons/browse/djangocms-file/>`_
13+
This addon is compatible with `Divio Cloud <http://divio.com>`_
1514
for easy installation.
1615

1716
.. image:: preview.gif
@@ -39,8 +38,6 @@ Documentation
3938
See ``REQUIREMENTS`` in the `setup.py <https://github.com/divio/djangocms-file/blob/master/setup.py>`_
4039
file for additional dependencies:
4140

42-
|python| |django| |djangocms|
43-
4441
* Django Filer 1.7 or higher
4542

4643
Make sure `django-filer <http://django-filer.readthedocs.io/en/latest/installation.html>`_
@@ -71,7 +68,7 @@ setting::
7168
('feature', _('Featured Version')),
7269
]
7370

74-
You'll need to create the `feature` folder inside ``templates/djangocms_file/``
71+
You'll need to create the ``feature`` folder inside ``templates/djangocms_file/``
7572
otherwise you will get a *template does not exist* error. You can do this by
7673
copying the ``default`` folder inside that directory and renaming it to
7774
``feature``.
@@ -90,14 +87,14 @@ You can run tests by executing::
9087

9188
.. |pypi| image:: https://badge.fury.io/py/djangocms-file.svg
9289
:target: http://badge.fury.io/py/djangocms-file
93-
.. |build| image:: https://travis-ci.org/divio/djangocms-file.svg?branch=master
90+
.. |build| image:: https://travis-ci.org/django-cms/djangocms-file.svg?branch=master
9491
:target: https://travis-ci.org/divio/djangocms-file
95-
.. |coverage| image:: https://codecov.io/gh/divio/djangocms-file/branch/master/graph/badge.svg
92+
.. |coverage| image:: https://codecov.io/gh/django-cms/djangocms-file/branch/master/graph/badge.svg
9693
:target: https://codecov.io/gh/divio/djangocms-file
9794

9895
.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg
9996
:target: https://pypi.org/project/djangocms-file/
100-
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
97+
.. |django| image:: https://img.shields.io/badge/django-2.2--4.0-blue.svg
10198
:target: https://www.djangoproject.com/
10299
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.7%2B-blue.svg
103100
:target: https://www.django-cms.org/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated by Django 4.0.8 on 2022-10-13 19:36
2+
3+
import django.db.models.deletion
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('cms', '0022_auto_20180620_1551'),
11+
('djangocms_file', '0011_auto_20181211_0357'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='file',
17+
name='cmsplugin_ptr',
18+
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin'),
19+
),
20+
migrations.AlterField(
21+
model_name='folder',
22+
name='cmsplugin_ptr',
23+
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin'),
24+
),
25+
]

0 commit comments

Comments
 (0)