From: Andrew Grimberg Date: Wed, 12 Apr 2023 16:58:24 +0000 (-0700) Subject: CI: Add tox build,clean environments X-Git-Tag: v0.37.4~11 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F43%2F71543%2F1;p=releng%2Flftools.git CI: Add tox build,clean environments * Add the tox build and clean environments * Add additional gitignore to deal with build artifacts Issue: RELENG-4563 Signed-off-by: Andrew Grimberg Change-Id: I26df479ac9f0a6177c345fd3a9bdd3dbb4bc9f49 --- diff --git a/.gitignore b/.gitignore index 3a982444..4a6931e2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,8 +30,15 @@ anonymous-cli-metrics.json __pycache__/ *.egg-info/ *.pyc -docs/_build/ -dist/ + +# Build and docs folder/files +build/* +dist/* +sdist/* +docs/api/* +docs/_rst/* +docs/_build/* +cover/* MANIFEST # PBR diff --git a/tox.ini b/tox.ini index 656311e5..79859352 100644 --- a/tox.ini +++ b/tox.ini @@ -21,6 +21,26 @@ deps = -r{toxinidir}/requirements-test.txt commands = pytest usedevelop = true + +[testenv:{build,clean}] +description = + build: Build the package in isolation according to PEP517, see https://github.com/pypa/build + clean: Remove old distribution files and temporary build artifacts (./build and ./dist) +# https://setuptools.pypa.io/en/stable/build_meta.html#how-to-use-it +skip_install = True +changedir = {toxinidir} +deps = + build: build[virtualenv] +passenv = + SETUPTOOLS_* +commands = + clean: python -c 'import shutil; [shutil.rmtree(p, True) for p in ("build", "dist", "docs/_build")]' + clean: python -c 'import pathlib, shutil; [shutil.rmtree(p, True) for p in pathlib.Path("src").glob("*.egg-info")]' + build: python -m build {posargs} +# By default, both `sdist` and `wheel` are built. If your sdist is too big or you don't want +# to make it available, consider running: `tox -e build -- --wheel` + + [testenv:docs] description = Build the documentation with sphinx basepython = python3