Files
Dharniss G R 8e6093db04 Add tox and Zuul CI environments for Trixie
Add tox environments and Zuul check/gate jobs for unit testing,
coverage analysis, and security scanning for nfv and nova-api-proxy,
running on both Debian Bullseye and Trixie.

Trixie is the default target, so its tox environments and Zuul jobs
use the plain names (pep8, pylint, black, py313, coverage, bandit,
linters). Bullseye (py3.9) environments and jobs carry an explicit
-bullseye suffix; Bullseye tox environments override basepython/deps
via a [bullseye] section.

Requirements files:
- test-requirements.txt: Trixie test dependencies (default)
- test-requirements-bullseye.txt: Bullseye test dependencies
- .coveragerc: Coverage configuration for nova-api-proxy

Tox environments (nfv/tox.ini):
- Trixie (default, py3.13): pep8, pylint, black, py313, coverage,
  bandit
- Bullseye (py3.9): pep8-bullseye, pylint-bullseye, black-bullseye,
  py39-bullseye, coverage-bullseye, bandit-bullseye

Tox environments (nova-api-proxy/tox.ini):
- Trixie (default): pep8, pylint, black, coverage
- Bullseye: pep8-bullseye, pylint-bullseye, black-bullseye,
  coverage-bullseye

Root tox.ini:
- Default [testenv] targets Trixie (python3.13)
- Dummy envs for Zuul compatibility

Zuul jobs (.zuul.yaml):
- Voting (gate), Trixie: nfv-tox-linters, nfv-tox-pep8,
  nfv-tox-pylint, nfv-tox-black, nfv-tox-py313, nfv-tox-coverage,
  nfv-tox-bandit, nova-api-proxy-tox-pep8,
  nova-api-proxy-tox-pylint, nova-api-proxy-tox-black,
  nova-api-proxy-tox-coverage
- Non-voting (check only), Bullseye: the corresponding
  nfv-tox-*-bullseye and nova-api-proxy-tox-*-bullseye jobs

Playbooks:
- fetch-coverage.yaml: Collect nfv coverage artifacts from
  UTCoverage/ directory. Directory named UTCoverage/ to follow
  the naming convention used by other StarlingX repos.
- fetch-coverage-nova-api-proxy.yaml: Upload proxy coverage.

Test-Plan:
PASS: tox -e pep8,pylint,black,py313,coverage,bandit (nfv/)
PASS: tox -e pep8-bullseye,pylint-bullseye,black-bullseye (nfv/)
PASS: tox -e py39-bullseye,coverage-bullseye (nfv/)
PASS: tox -e pep8,pylint,black,coverage (nova-api-proxy/)
PASS: tox -e pep8-bullseye,coverage-bullseye (nova-api-proxy/)
PASS: tox -e linters, linters-bullseye
PASS: tox -e docs, releasenotes, api-ref

Story: 2011781
Task: 54324

Assisted-by: Amazon Q Developer (Kiro)
Change-Id: Iacf7eb6a6197e91a85b07633c68936c17210db65
Signed-off-by: Dharniss G R <dharniss.gr@windriver.com>
2026-09-16 12:29:47 +00:00

108 lines
3.3 KiB
INI

[tox]
envlist = linters
minversion = 2.9
skipsdist = True
[testenv]
basepython = python3
install_command = pip install \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/trixie/upper-constraints.txt} \
{opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
PYTHONDONTWRITEBYTECODE=True
commands = find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete
allowlist_externals =
find
[testenv:pep8-bullseye]
description = Dummy environment to allow pep8-bullseye to be run in subdir tox
[testenv:pylint-bullseye]
description = Dummy environment to allow pylint-bullseye to be run in subdir tox
[testenv:black-bullseye]
description = Dummy environment to allow black-bullseye to be run in subdir tox
[testenv:coverage-bullseye]
description = Dummy environment to allow coverage-bullseye to be run in subdir tox
[testenv:bandit-bullseye]
description = Dummy environment to allow bandit-bullseye to be run in subdir tox
[testenv:pep8]
description = Dummy environment to allow pep8 to be run in subdir tox
[testenv:pylint]
description = Dummy environment to allow pylint to be run in subdir tox
[testenv:black]
description = Dummy environment to allow black to be run in subdir tox
[testenv:py313]
basepython = python3.13
description = Dummy environment to allow py313 to be run in subdir tox
[testenv:bandit]
description = Dummy environment to allow bandit to be run in subdir tox
[testenv:coverage]
description = Dummy environment to allow coverage to be run in subdir tox
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
allowlist_externals = rm
[testenv:releasenotes]
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
allowlist_externals =
rm
reno
[testenv:newnote]
# Re-use the releasenotes venv
envdir = {toxworkdir}/releasenotes
deps = -r{toxinidir}/doc/requirements.txt
commands = reno --rel-notes-dir {toxinidir}/releasenotes new {posargs}
[testenv:api-ref]
deps =
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
allowlist_externals = rm
[testenv:linters-bullseye]
basepython = python3.9
install_command = pip install \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
allowlist_externals = bash
deps = yamllint
commands =
bash -c "find {toxinidir} \
-name .tox -prune \
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint -f parsable \
-c {toxinidir}/.yamllint"
[testenv:linters]
basepython = python3.13
allowlist_externals = bash
deps = yamllint
commands =
bash -c "find {toxinidir} \
-name .tox -prune \
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint -f parsable \
-c {toxinidir}/.yamllint"