From c625f9fc31fdfd73ebbb8cce779d757cd6c34c53 Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Wed, 12 Apr 2023 09:58:24 -0700 Subject: [PATCH] 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 --- .gitignore | 11 +++++++++-- tox.ini | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) 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 -- 2.16.6