mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-16 07:19:57 +00:00
refactor: rework few tests and build system
This commit includes the following changes * Bump github actions * Update tests github action to check documentation and streamline process * Update test cases to use temporary directories as roots * Simplify tox.ini
This commit is contained in:
40
tox.ini
40
tox.ini
@ -6,8 +6,14 @@ labels =
|
||||
dependencies = -e .[journald,pacman,reports,s3,shell,stats,unixsocket,validator,web,web_api-docs,web_auth,web_oauth2,web_metrics]
|
||||
project_name = ahriman
|
||||
|
||||
[mypy]
|
||||
flags = --implicit-reexport --strict --allow-untyped-decorators --allow-subclassing-any
|
||||
[flags]
|
||||
autopep8 = --max-line-length 120 -aa --in-place
|
||||
bandit = --configfile .bandit.yml
|
||||
manpage = --author "ahriman team" --author-email "" --description "ArcH linux ReposItory MANager" --manual-title "ArcH linux ReposItory MANager" --project-name ahriman --url https://github.com/arcan1s/ahriman
|
||||
mypy = --implicit-reexport --strict --allow-untyped-decorators --allow-subclassing-any
|
||||
pydeps = --no-config --cluster
|
||||
pylint = --rcfile .pylint.toml
|
||||
shtab = --prefix ahriman --prog ahriman ahriman.application.ahriman._parser
|
||||
|
||||
[pytest]
|
||||
addopts = --cov=ahriman --cov-report=term-missing:skip-covered --no-cov-on-fail --cov-fail-under=100 --spec
|
||||
@ -33,19 +39,17 @@ setenv =
|
||||
CFLAGS="-Wno-unterminated-string-initialization"
|
||||
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=.pylint.toml "src/{[tox]project_name}"
|
||||
bandit -c .bandit.yml -r "src/{[tox]project_name}"
|
||||
bandit -c .bandit-test.yml -r "tests/{[tox]project_name}"
|
||||
mypy {[mypy]flags} -p "{[tox]project_name}" --install-types --non-interactive
|
||||
autopep8 {[flags]autopep8} --exit-code --jobs 0 --recursive "src/{[tox]project_name}" "tests/{[tox]project_name}"
|
||||
pylint {[flags]pylint} "src/{[tox]project_name}"
|
||||
bandit {[flags]bandit} --recursive "src/{[tox]project_name}"
|
||||
bandit {[flags]bandit} --skip B101,B105,B106 --recursive "tests/{[tox]project_name}"
|
||||
mypy {[flags]mypy} --install-types --non-interactive --package "{[tox]project_name}"
|
||||
|
||||
[testenv:docs]
|
||||
description = Generate source files for documentation
|
||||
allowlist_externals =
|
||||
bash
|
||||
find
|
||||
mv
|
||||
changedir = src
|
||||
dependency_groups =
|
||||
docs
|
||||
depends =
|
||||
@ -55,18 +59,18 @@ deps =
|
||||
uv
|
||||
pip_pre = true
|
||||
setenv =
|
||||
PYTHONPATH=src
|
||||
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 --no-output --show-dot --dot-output architecture.dot --no-config --cluster
|
||||
mv architecture.dot ../docs/_static/architecture.dot
|
||||
bash -c 'shtab {[flags]shtab} --shell bash > package/share/bash-completion/completions/_ahriman'
|
||||
bash -c 'shtab {[flags]shtab} --shell zsh > package/share/zsh/site-functions/_ahriman'
|
||||
argparse-manpage {[flags]manpage} --module ahriman.application.ahriman --function _parser --output ../package/share/man/man1/ahriman.1
|
||||
pydeps {[flags]pydeps} --no-output --show-dot --dot-output {tox_root}{/}docs/_static/architecture.dot src/ahriman
|
||||
# remove autogenerated modules rst files
|
||||
find ../docs -type f -name "{[tox]project_name}*.rst" -delete
|
||||
sphinx-apidoc -o ../docs .
|
||||
find docs -type f -name "{[tox]project_name}*.rst" -delete
|
||||
sphinx-apidoc --output-dir docs src
|
||||
# compile list of dependencies for rtd.io
|
||||
uv pip compile --group ../pyproject.toml:docs --extra s3 --extra validator --extra web --output-file ../docs/requirements.txt --quiet ../pyproject.toml
|
||||
uv pip compile --group pyproject.toml:docs --extra s3 --extra validator --extra web --output-file docs/requirements.txt --quiet pyproject.toml
|
||||
|
||||
[testenv:html]
|
||||
description = Generate html documentation
|
||||
@ -77,7 +81,7 @@ deps =
|
||||
pip_pre = true
|
||||
recreate = true
|
||||
commands =
|
||||
sphinx-build -b html -a -j auto -W docs {envtmpdir}{/}html
|
||||
sphinx-build --builder html --write-all --jobs auto --fail-on-warning docs {envtmpdir}{/}html
|
||||
|
||||
[testenv:publish]
|
||||
description = Create and publish release to GitHub
|
||||
|
Reference in New Issue
Block a user