Skip to content

Commit

Permalink
ci: update jobs and noxfile
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed May 10, 2024
1 parent e7d02ca commit 8f65ffe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 37 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Run PyLint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
pipx run nox[uv] -s pylint
cmake:
name: CMake 🐍 ${{ matrix.python-version }}
Expand All @@ -62,7 +62,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.9", "3.12", "pypy3.9"]
python-version: ["3.7", "3.9", "3.12", "3.13", "pypy3.9"]
include:
- python-version: "3.8"
cmake-extras: "-DCMAKE_CXX_STANDARD=17"
Expand Down Expand Up @@ -115,10 +115,6 @@ jobs:
submodules: true
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- uses: pypa/cibuildwheel@v2.17
env:
CIBW_BUILD: "${{ matrix.build }}"
Expand All @@ -129,12 +125,8 @@ jobs:
path: wheelhouse/*
name: test-wheels-${{ strategy.job-index }}

# Pipx is either missing or broken on macos-14 runners ATM
- name: Install twine
run: pip install twine

- name: Check wheels
run: twine check wheelhouse/*
run: pipx run twine check wheelhouse/*
shell: bash

pass:
Expand Down
41 changes: 15 additions & 26 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,41 +48,31 @@ def hist(session: nox.Session) -> None:
@nox.session(reuse_venv=True)
def docs(session: nox.Session) -> None:
"""
Build the docs. Pass "--serve" to serve. Pass "-b linkcheck" to check links.
Build the docs. Pass --non-interactive to avoid serving. Pass "-b linkcheck" to check links.
"""

parser = argparse.ArgumentParser()
parser.add_argument("--serve", action="store_true", help="Serve after building")
parser.add_argument(
"-b", dest="builder", default="html", help="Build target (default: html)"
)
args, posargs = parser.parse_known_args(session.posargs)
serve = args.builder == "html" and session.interactive

if args.builder != "html" and args.serve:
session.error("Must not specify non-HTML builder with --serve")

extra_installs = ["sphinx-autobuild"] if args.serve else []

session.chdir("docs")
session.install("-r", "requirements.txt", *extra_installs)

if args.builder == "linkcheck":
session.run(
"sphinx-build", "-b", "linkcheck", ".", "_build/linkcheck", *posargs
)
return
extra_installs = ["sphinx-autobuild"] if serve else []
session.install("-r", "docs/requirements.txt", *extra_installs)

shared_args = (
"-n", # nitpicky mode
"-T", # full tracebacks
f"-b={args.builder}",
".",
f"_build/{args.builder}",
*posargs,
"docs",
*(posargs or [f"docs/_build/{args.builder}"]),
)

if args.serve:
session.run("sphinx-autobuild", *shared_args)
if serve:
session.run(
"sphinx-autobuild", "--open-browser", "--ignore=docs/.build", *shared_args
)
else:
session.run("sphinx-build", "--keep-going", *shared_args)

Expand All @@ -94,22 +84,21 @@ def build_api_docs(session: nox.Session) -> None:
"""

session.install(".", "-r", "docs/requirements.txt")
session.chdir("docs")
session.run(
"sphinx-apidoc",
"-o",
"api/",
"docs/api/",
"--no-toc",
"--template",
"template/",
"docs/template/",
"--force",
"--module-first",
"../src/boost_histogram",
"src/boost_histogram",
)

# add API docs of boost_histogram._internal.hist.Histogram after
# the generation step
with Path("api/boost_histogram.rst").open("r+") as f:
with Path("docs/api/boost_histogram.rst").open("r+") as f:
lines = f.readlines()
for i in range(len(lines)):
if lines[i] == ".. automodule:: boost_histogram\n":
Expand Down Expand Up @@ -137,7 +126,7 @@ def pylint(session: nox.Session) -> None:
Run pylint.
"""

session.install("pylint==2.17.*")
session.install("pylint==3.1.*")
session.install(".")
session.run("pylint", "src", *session.posargs)

Expand Down

0 comments on commit 8f65ffe

Please sign in to comment.