diff --git a/pyproject.toml b/pyproject.toml index 28f53260..4cfbcc49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,9 @@ lint.ignore = [ "D417", # argument description in docstring (unreliable) "ISC001", # simplify implicit str concatenation (ruff-format recommended) ] -lint.per-file-ignores = {"*tests*" = [ +lint.per-file-ignores = {"*docs/conf.py" = [ + "INP001", +], "*tests*" = [ "INP001", "S101", ], "hooks*" = [ diff --git a/tests/test_package_gen.py b/tests/test_package_gen.py index f0862345..a975d0c0 100644 --- a/tests/test_package_gen.py +++ b/tests/test_package_gen.py @@ -56,6 +56,8 @@ def test_package_generation( "tests", pathlib.Path(".github"), pathlib.Path(".github") / "workflows", + pathlib.Path("docs") / "conf.py", + pathlib.Path("docs") / "index.md", ] for f in expected_files: full_path = test_project_dir / f diff --git a/{{cookiecutter.project_slug}}/.github/workflows/docs.yml b/{{cookiecutter.project_slug}}/.github/workflows/docs.yml new file mode 100644 index 00000000..73adaede --- /dev/null +++ b/{{cookiecutter.project_slug}}/.github/workflows/docs.yml @@ -0,0 +1,42 @@ +name: Documentation + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v4 + - name: Cache tox + uses: actions/cache@v4 + with: + path: .tox + key: tox-${{ '{{' }} hashFiles('pyproject.toml') {{ '}}' }} + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + cache: "pip" + cache-dependency-path: "pyproject.toml" + - name: Install tox + run: python -m pip install tox + - name: Build HTML documentation with tox + run: tox -e docs + # Uncomment lines below to set-up automatic deployment of documentation to a + # GitHub Pages website on pushing to main - you will need configure the repository + # to deploy from a branch gh-pages (https://tinyurl.com/gh-pages-from-branch), + # which will be created the first time this workflow step is run + # - name: Publish documentation on GitHub pages + # if: success() && github.event_name != 'pull_request' + # uses: peaceiris/actions-gh-pages@v3 + # with: + # github_token: ${{ '{{' }} secrets.GITHUB_TOKEN {{ '}}' }} + # publish_dir: docs/_build/html + # publish_branch: gh-pages + # user_name: "github-actions[bot]" + # user_email: "github-actions[bot]@users.noreply.github.com" diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index 6a566013..f6950181 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -71,6 +71,9 @@ instance/ # Sphinx documentation docs/_build/ +# sphinx-autodoc2 generated API documentation +docs/apidocs/ + # PyBuilder .pybuilder/ target/ diff --git a/{{cookiecutter.project_slug}}/README.md b/{{cookiecutter.project_slug}}/README.md index 847480f7..775d7c9b 100644 --- a/{{cookiecutter.project_slug}}/README.md +++ b/{{cookiecutter.project_slug}}/README.md @@ -3,6 +3,7 @@ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) [![Tests status][tests-badge]][tests-link] [![Linting status][linting-badge]][linting-link] +[![Documentation status][documentation-badge]][linting-link] [![License][license-badge]](./LICENSE.md)