Skip to content

Commit

Permalink
chore: refactor the whole setup similar to Mezzanine
Browse files Browse the repository at this point in the history
  • Loading branch information
henri-hulski committed Feb 18, 2022
1 parent 8eb3b54 commit a4d18d3
Show file tree
Hide file tree
Showing 13 changed files with 328 additions and 119 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,112 @@
name: Test and release

# Fires on all incoming commits
on:
pull_request:
push:

jobs:

# Test all supported Python & Django versions
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Django 2.2
- tox-env: "py36-dj22"
python-version: "3.6"
- tox-env: "py37-dj22"
python-version: "3.7"
- tox-env: "py38-dj22"
python-version: "3.8"
- tox-env: "py39-dj22"
python-version: "3.9"
# Django 3.0
- tox-env: "py36-dj30"
python-version: "3.6"
- tox-env: "py37-dj30"
python-version: "3.7"
- tox-env: "py38-dj30"
python-version: "3.8"
- tox-env: "py39-dj30"
python-version: "3.9"
# Django 3.1
- tox-env: "py36-dj31"
python-version: "3.6"
- tox-env: "py37-dj31"
python-version: "3.7"
- tox-env: "py38-dj31"
python-version: "3.8"
- tox-env: "py39-dj31"
python-version: "3.9"
# Django 3.2
- tox-env: "py36-dj32"
python-version: "3.6"
- tox-env: "py37-dj32"
python-version: "3.7"
- tox-env: "py38-dj32"
python-version: "3.8"
- tox-env: "py39-dj32"
python-version: "3.9"
- tox-env: "py310-dj32"
python-version: "3.10"
# Django 4.0
- tox-env: "py38-dj40"
python-version: "3.8"
- tox-env: "py39-dj40"
python-version: "3.9"
- tox-env: "py310-dj40"
python-version: "3.10"

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -U pip tox
- name: Run tests
run: tox -e ${{ matrix.tox-env }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
with:
report_paths: '**/junit/TEST-*.xml'

# Lint
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: pip install tox -U pip
- name: Lint
run: tox -e package -e lint -e pyupgrade

# Create a new semantic release
# Only runs on the original repo, not forks
release:
if: github.repository_owner == 'stephenmcd'
needs: [test, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/setup-node@v2
with:
node-version: '14' # https://github.com/cycjimmy/semantic-release-action/issues/79#issuecomment-955463633
- uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 18
extra_plugins: |
@semantic-release/exec@5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
23 changes: 21 additions & 2 deletions .gitignore
@@ -1,6 +1,25 @@
*.pyc
*.pyo
*.db
*.egg-info
.idea/
*.pot
*.doctree
*.swp
.vscode
.doctrees
.DS_Store
.coverage
.idea/
.pytest_cache
junit/
local_settings.py
.eggs/
.tox/
Mezzanine.egg-info/
build/
docs/build/
docs/_build/
dist/
htmlcov/
mezzanine/project_template/static/
/mezzanine/.project
/mezzanine/.pydevproject
14 changes: 10 additions & 4 deletions .hgignore
Expand Up @@ -2,11 +2,17 @@ syntax: glob
*.pyc
*.pyo
*.db
*.pot
*.doctree
.doctrees
.DS_Store
.coverage
.idea
local_settings.py
build/*
dist/*
*.egg-info/*
build
dist
*.egg-info
*.egg
project_template/static

.project
.pydevproject
2 changes: 2 additions & 0 deletions .isort.cfg
@@ -0,0 +1,2 @@
[settings]
profile = black
19 changes: 19 additions & 0 deletions .releaserc
@@ -0,0 +1,19 @@
{
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"stable",
{"name": "alpha", "prerelease": true},
{"name": "beta", "prerelease": true},
{"name": "rc", "prerelease": true}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
["@semantic-release/exec", {
"verifyConditionsCmd": "python -m pip install -U pip setuptools wheel twine",
"prepareCmd": "sed -i 's/9999dev0/${nextRelease.version}/' mezzanine/__init__.py",
"publishCmd": "python setup.py sdist bdist_wheel && twine upload dist/*"
}]
]
}
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .tx/config
@@ -1,9 +1,9 @@
[main]
host = https://www.transifex.com
lang_map = sr@latin:sr_Latn

[cartridge.default]
file_filter = cartridge/shop/locale/<lang>/LC_MESSAGES/django.po
source_file = cartridge/shop/locale/en/LC_MESSAGES/django.po
source_lang = en
trans.es = cartridge/shop/locale/es/LC_MESSAGES/django.po

type = PO
8 changes: 7 additions & 1 deletion MANIFEST.in
@@ -1,5 +1,11 @@
include CHANGELOG LICENSE README.rst
include AUTHORS CHANGELOG LICENSE *.rst
recursive-include docs *
recursive-exclude docs/build *
recursive-include cartridge *
recursive-exclude */project_template/static *

global-exclude __pycache__
global-exclude *.py[co]
prune .tx
prune tests
exclude .releaserc .isort.cfg tox.ini pytest.ini .coveragerc
13 changes: 13 additions & 0 deletions project.toml
@@ -0,0 +1,13 @@
[tool.black]
exclude = '''
(
/(
\.eggs
| \.git
| \.tox
| \.venv
| build
| dist
)/
)
'''
8 changes: 8 additions & 0 deletions pytest.ini
@@ -0,0 +1,8 @@
[pytest]
addopts =
--tb short
--cov=cartridge
--cov-report html
--cov-report term:skip-covered
# Original coverage was 54% (not great), but at least ensure we don't go below
--cov-fail-under 57
62 changes: 60 additions & 2 deletions setup.cfg
@@ -1,2 +1,60 @@
[wheel]
universal = 1
[metadata]
name = Cartridge
version = attr: cartridge.__version__
description = AA Django shopping cart application.
long_description = file: README.rst
long_description_content_type = text/x-rst
author = Stephen McDonald
author_email = stephen.mc@gmail.com
url = http://cartridge.jupo.org/
license = BSD
license_file = LICENSE
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Framework :: Django
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Framework :: Django
Framework :: Django :: 2.2
Framework :: Django :: 3.0
Framework :: Django :: 3.1
Framework :: Django :: 3.2
Framework :: Django :: 4.0
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content
Topic :: Internet :: WWW/HTTP :: WSGI
Topic :: Software Development :: Libraries :: Application Frameworks
Topic :: Software Development :: Libraries :: Python Modules

[options]
python_requires = >=3.6
packages = cartridge
include_package_data = true
install_requires =
mezzanine >= 5.1.1
xhtml2pdf

[options.extras_require]
stripe = stripe
testing =
pytest-django >= 4, <5
pytest-cov >= 2, < 3
codestyle =
flake8 >= 3, <4
black==20.8b1
isort >= 5, <6
pyupgrade >= 2, <3

# Building

[bdist_wheel]
universal = 1

0 comments on commit a4d18d3

Please sign in to comment.