-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import nox | ||
|
||
|
||
nox.options.sessions = ["lint", "tests", "tests_packaging"] | ||
|
||
|
||
@nox.session(reuse_venv=True) | ||
def lint(session: nox.Session) -> None: | ||
""" | ||
Lint the codebase (except for clang-format/tidy). | ||
""" | ||
session.install("pre-commit") | ||
session.run("pre-commit", "run", "-a") | ||
|
||
|
||
@nox.session | ||
def tests(session: nox.Session) -> None: | ||
""" | ||
Run the tests (requires a compiler). | ||
""" | ||
tmpdir = session.create_tmp() | ||
session.install("pytest", "cmake") | ||
session.run( | ||
"cmake", | ||
"-S", | ||
".", | ||
"-B", | ||
tmpdir, | ||
"-DPYBIND11_WERROR=ON", | ||
"-DDOWNLOAD_CATCH=ON", | ||
"-DDOWNLOAD_EIGEN=ON", | ||
*session.posargs | ||
) | ||
session.run("cmake", "--build", tmpdir) | ||
session.run("cmake", "--build", tmpdir, "--config=Release", "--target", "check") | ||
|
||
|
||
@nox.session | ||
def tests_packaging(session: nox.Session) -> None: | ||
""" | ||
Run the packaging tests. | ||
""" | ||
|
||
session.install("-r", "tests/requirements.txt", "--prefer-binary") | ||
session.run("pytest", "tests/extra_python_package") | ||
|
||
|
||
@nox.session(reuse_venv=True) | ||
def docs(session: nox.Session) -> None: | ||
""" | ||
Build the docs. Pass "serve" to serve. | ||
""" | ||
|
||
session.install("-r", "docs/requirements.txt") | ||
session.chdir("docs") | ||
session.run("sphinx-build", "-M", "html", ".", "_build") | ||
|
||
if session.posargs: | ||
if "serve" in session.posargs: | ||
print("Launching docs at http://localhost:8000/ - use Ctrl-C to quit") | ||
session.run("python", "-m", "http.server", "8000", "-d", "_build/html") | ||
else: | ||
print("Unsupported argument to docs") | ||
|
||
|
||
@nox.session(reuse_venv=True) | ||
def make_changelog(session: nox.Session) -> None: | ||
""" | ||
Inspect the closed issues and make entries for a changelog. | ||
""" | ||
session.install("ghapi", "rich") | ||
session.run("python", "tools/make_changelog.py") | ||
|
||
|
||
@nox.session(reuse_venv=True) | ||
def build(session: nox.Session) -> None: | ||
""" | ||
Build SDists and wheels. | ||
""" | ||
|
||
session.install("build") | ||
session.run("python", "-m", "build") | ||
session.run("python", "-m", "build", env={"PYBIND11_GLOBAL_SDIST": "1"}) |