apprise/tox.ini

227 lines
5.6 KiB
INI

[global]
alwayscopy = True
[gh]
use_discover = False
[tox]
envlist =
clean
validate
i18n
compile
minimal
release
minversion = 4.0
requires = virtualenv>=20.0.0
isolated_build = True
[testenv]
skip_install = false
usedevelop = true
changedir = {toxinidir}
allowlist_externals = *
ensurepip = true
setenv =
COVERAGE_RCFILE = {toxinidir}/pyproject.toml
[testenv:build-src-rpm]
description = Build source RPM and place .src.rpm in dist/
skip_install = true
allowlist_externals =
bash
cp
mkdir
find
rpmbuild
setenv =
HOME = {envtmpdir}
RPMTOP = {envtmpdir}/rpmbuild
commands_pre =
mkdir -p {envtmpdir}/rpmbuild/SOURCES
mkdir -p {envtmpdir}/rpmbuild/SPECS
mkdir -p dist/rpm
cp packaging/man/apprise.1 {envtmpdir}/rpmbuild/SOURCES/
cp packaging/redhat/python-apprise.spec {envtmpdir}/rpmbuild/SPECS/
find packaging/redhat/ -iname '*.patch' -exec cp {} {envtmpdir}/rpmbuild/SOURCES/ \;
bash -c 'cp dist/*.tar.gz {envtmpdir}/rpmbuild/SOURCES/'
bash -c 'echo "%_topdir {envtmpdir}/rpmbuild" > {envtmpdir}/.rpmmacros'
commands =
rpmbuild --nodeps -bs {envtmpdir}/rpmbuild/SPECS/python-apprise.spec
find {envtmpdir}/rpmbuild/SRPMS -name '*.src.rpm' -exec mv {} dist/rpm \;
[testenv:build-el9-rpm]
description = Run RPM packaging for EPEL9 via Docker
skip_install = true
allowlist_externals =
docker
commands =
docker compose run --rm rpmbuild.el9 bash /usr/bin/build-rpm.sh
[testenv:build-f42-rpm]
description = Run RPM packaging for Fedora 42 via Docker
skip_install = true
allowlist_externals =
docker
commands =
docker compose run --rm rpmbuild.f42 bash /usr/bin/build-rpm.sh
[testenv:build-rawhide-rpm]
description = Run RPM packaging for Fedora Rawhide via Docker
skip_install = true
allowlist_externals =
docker
commands =
docker compose run --rm rpmbuild.rawhide bash /usr/bin/build-rpm.sh
[testenv:lint]
description = Run static analysis using Ruff
deps = ruff
commands = ruff check . {posargs}
[testenv:format]
description = Auto-format code using Ruff
deps = ruff
commands = ruff check . --fix {posargs}
# - This defines a CLI script entry point for packaging.
# - It ensures that pip install . or python -m build includes
# a working apprise command.
# - This is required for proper packaging and end-user usage
[project.scripts]
apprise = "apprise.cli:main"
[testenv:apprise]
description = Run Apprise CLI with args
commands =
apprise {posargs}
[testenv:cli]
description = Sanity-check Apprise CLI invocation
commands =
apprise --version
[testenv:checkdone]
description = Lint + full test run to ensure PR readiness
extras = dev,all-plugins
commands =
pip install --no-cache-dir -e ".[dev,all-plugins]"
ruff check .
coverage run --source=apprise -m pytest tests {posargs}
coverage report
[testenv:qa]
description = Full tests with all plugins + code coverage
extras = dev,all-plugins
commands =
pip install --no-cache-dir -e ".[dev,all-plugins]"
coverage erase
coverage run --source=apprise -m pytest tests {posargs}
coverage report -m
coverage xml -o coverage.xml
[testenv:minimal]
description = Minimal dependencies + code coverage
extras = dev
commands =
pip install --no-cache-dir -e ".[dev]"
coverage erase
coverage run --source=apprise -m pytest tests {posargs}
coverage report -m
coverage xml -o coverage.xml
[testenv:test]
description = Run simplified tests without coverage
extras = dev,all-plugins
commands =
pip install --no-cache-dir -e ".[dev,all-plugins]"
pytest --tb=short -q {posargs}
[testenv:clean]
description = Remove build artifacts and cache files
skip_install = true
allowlist_externals =
find
rm
commands =
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.orig" -delete
find . -type f -name "*.orig" -delete
find ./apprise/i18n -type f -name "*.mo" -delete
rm -rf BUILD SOURCES SRPMS BUILDROOT .cache .ruff_cache .coverage-reports .coverage coverage.xml dist build apprise.egg-info .mypy_cache .pytest_cache "__pycache__"
find . -type d -name "__pycache__" -delete
[testenv:i18n]
description = Extract and update .pot/.po files for translation
extras = dev
deps = Babel
ensurepip = true
commands =
mkdir -p apprise/i18n
pybabel extract -F babel.cfg -o apprise/i18n/apprise.pot apprise
pybabel update --domain=apprise -i apprise/i18n/apprise.pot -d apprise/i18n
[testenv:compile]
description = Compile .mo files
deps = Babel
commands =
pybabel compile --domain=apprise -d apprise/i18n
[testenv:build]
description = Build sdist and wheel (assumes translations compiled)
deps =
build
commands =
python -m build
[testenv:build-sdist]
deps = build
commands = python -m build --sdist
[testenv:build-wheel]
deps = build
commands = python -m build --wheel
[testenv:validate]
description = Validate pyproject.toml against PEP 621/508
deps =
rpmlint
validate-pyproject
packaging
commands =
validate-pyproject pyproject.toml
rpmlint packaging/redhat/python-apprise.spec
[testenv:twine-check]
description = Run twine check on dist artifacts
deps =
twine
commands =
twine check dist/*
[testenv:man]
description = Rebuild the Apprise man page
allowlist_externals = docker
commands =
docker compose run --rm rpmbuild.el9 ronn \
--organization="Chris Caron <lead2gold@gmail.com>" \
packaging/man/apprise.md
[testenv:release]
description = Prepare translations, compile, and build all artifacts
deps =
validate-pyproject
packaging
Babel
build
twine
commands =
tox -e clean
tox -e validate
tox -e i18n
tox -e compile
tox -e build
tox -e twine-check