mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
106 lines
3.3 KiB
INI
106 lines
3.3 KiB
INI
[tox]
|
|
envlist = check, tests
|
|
isolated_build = True
|
|
labels =
|
|
release = version, docs, publish
|
|
dependencies = -e .[journald,pacman,s3,stats,validator,web]
|
|
project_name = ahriman
|
|
|
|
[mypy]
|
|
flags = --implicit-reexport --strict --allow-untyped-decorators --allow-subclassing-any
|
|
|
|
[pytest]
|
|
addopts = --cov=ahriman --cov-report=term-missing:skip-covered --no-cov-on-fail --cov-fail-under=100 --spec
|
|
asyncio_default_fixture_loop_scope = function
|
|
asyncio_mode = auto
|
|
spec_test_format = {result} {docstring_summary}
|
|
|
|
[testenv:archive]
|
|
description = Create source files tarball
|
|
deps =
|
|
build
|
|
commands =
|
|
python -m build --sdist
|
|
|
|
[testenv:check]
|
|
description = Run common checks like linter, mypy, etc
|
|
deps =
|
|
{[tox]dependencies}
|
|
-e .[check]
|
|
allowlist_externals =
|
|
bash
|
|
setenv =
|
|
MYPYPATH=src
|
|
commands =
|
|
autopep8 --exit-code --max-line-length 120 -aa -i -j 0 -r "src/{[tox]project_name}" "tests/{[tox]project_name}"
|
|
pylint --rcfile=.pylintrc "src/{[tox]project_name}"
|
|
bandit -c .bandit.yml -r "src/{[tox]project_name}"
|
|
bandit -c .bandit-test.yml -r "tests/{[tox]project_name}"
|
|
bash -c 'mypy {[mypy]flags} -p "{[tox]project_name}" --install-types --non-interactive || mypy {[mypy]flags} -p "{[tox]project_name}"'
|
|
|
|
[testenv:docs]
|
|
description = Generate source files for documentation
|
|
depends =
|
|
version
|
|
deps =
|
|
{[tox]dependencies}
|
|
-e .[docs]
|
|
changedir = src
|
|
allowlist_externals =
|
|
bash
|
|
find
|
|
setenv =
|
|
SPHINX_APIDOC_OPTIONS=members,no-undoc-members,show-inheritance
|
|
commands =
|
|
bash -c 'shtab --shell bash --prefix ahriman --prog ahriman ahriman.application.ahriman._parser > ../package/share/bash-completion/completions/_ahriman'
|
|
bash -c 'shtab --shell zsh --prefix ahriman --prog ahriman ahriman.application.ahriman._parser > ../package/share/zsh/site-functions/_ahriman'
|
|
argparse-manpage --module ahriman.application.ahriman --function _parser --author "ahriman team" --project-name ahriman --author-email "" --url https://github.com/arcan1s/ahriman --output ../package/share/man/man1/ahriman.1
|
|
pydeps ahriman -o ../docs/ahriman-architecture.svg --no-config --no-show --cluster
|
|
# remove autogenerated modules rst files
|
|
find ../docs -type f -name "{[tox]project_name}*.rst" -delete
|
|
sphinx-apidoc -o ../docs .
|
|
|
|
[testenv:html]
|
|
description = Generate html documentation
|
|
deps =
|
|
{[tox]dependencies}
|
|
-e .[docs]
|
|
recreate = True
|
|
commands =
|
|
sphinx-build -b html -a -j auto -W docs {envtmpdir}{/}html
|
|
|
|
[testenv:publish]
|
|
description = Create and publish release to GitHub
|
|
depends =
|
|
docs
|
|
allowlist_externals =
|
|
git
|
|
passenv =
|
|
SSH_AUTH_SOCK
|
|
commands =
|
|
git add package/archlinux/PKGBUILD src/ahriman/__init__.py docs/ahriman-architecture.svg package/share/man/man1/ahriman.1 package/share/bash-completion/completions/_ahriman package/share/zsh/site-functions/_ahriman
|
|
git commit -m "Release {posargs}"
|
|
git tag "{posargs}"
|
|
git push
|
|
git push --tags
|
|
|
|
[testenv:tests]
|
|
description = Run tests
|
|
deps =
|
|
{[tox]dependencies}
|
|
-e .[tests]
|
|
commands =
|
|
pytest {posargs}
|
|
|
|
[testenv:version]
|
|
description = Bump package version
|
|
deps =
|
|
packaging
|
|
allowlist_externals =
|
|
sed
|
|
commands =
|
|
# check if version is set and validate it
|
|
{envpython} -c 'from packaging.version import Version; Version("{posargs}")'
|
|
sed -i 's/^__version__ = .*/__version__ = "{posargs}"/' src/ahriman/__init__.py
|
|
sed -i "s/pkgver=.*/pkgver={posargs}/" package/archlinux/PKGBUILD
|