Skip to content

Commit 81ad0dc

Browse files
authored
Merge pull request #50 from potassco/sh/doc
Sh/doc
2 parents 5712fc4 + b6c22de commit 81ad0dc

6 files changed

Lines changed: 94 additions & 29 deletions

File tree

.github/workflows/doc.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy Documentation
2+
on:
3+
workflow_dispatch:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
14+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- name: Set up Python 3.11
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: 3.11
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install -e .[doc]
33+
- name: Build the documentation
34+
run: mkdocs build
35+
- name: Setup Pages
36+
id: pages
37+
uses: actions/configure-pages@v5
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v3
40+
with:
41+
path: "./site"
42+
deploy:
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: github-pages
46+
url: ${{steps.deployment.outputs.page_url}}
47+
needs: build
48+
steps:
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

DEPLOYMENT.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ two services. Please follow this packaging [guide] to setup your accounts
99
accordingly. We also recommend to setup a github [environment] to restrict
1010
which contributors can deploy packages.
1111

12+
## Automatic Documentation Deployment
13+
14+
You can automatically publish project documentation to GitHub Pages on every
15+
new tag. To enable this:
16+
17+
- Go to your repository on GitHub.
18+
- Navigate to **Settings** > **Pages**.
19+
- Under **Build and deployment**, set **Source** to **GitHub Actions**.
20+
21+
This setup ensures your documentation is updated and available online whenever
22+
you create a new release tag via Github workflows.
23+
1224
[environment]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment/
1325
[guide]: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
1426
[pypi]: https://pypi.org/

DEVELOPMENT.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Development
22

33
To improve code quality, we use [nox] to run linters, type checkers, unit
4-
tests, documentation and more. We recommend installing nox using [pipx] to have
5-
it available globally.
4+
tests, and more. We recommend installing nox using [pipx] to have it available
5+
globally.
66

77
```bash
88
# install
@@ -35,6 +35,22 @@ python -m pipx install pre-commit
3535
pre-commit install
3636
```
3737

38+
## Documentation
39+
40+
Make sure the documentation dependencies for the project are properly installed
41+
with
42+
43+
```bash
44+
pip install .[doc]
45+
```
46+
47+
To run the documentation locally use the following command and click the
48+
provided link to open it in the browser.
49+
50+
```bash
51+
mkdocs serve
52+
```
53+
3854
[editable]: https://setuptools.pypa.io/en/latest/userguide/development_mode.html
3955
[nox]: https://nox.thea.codes/en/stable/index.html
4056
[pipx]: https://pypa.github.io/pipx/

docs/reference/encodings/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@ icon: material/file-code
33
---
44

55
# Encodings
6+
7+
8+
<!-- ::: src/fillname/encodings/test.lp
9+
handler: asp
10+
options:
11+
glossary: true
12+
predicate_table: true
13+
dependency_graph: true
14+
encodings:
15+
git_link: true
16+
source: true
17+
start_level: 1 -->

noxfile.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import sys
32

43
import nox
54

@@ -12,31 +11,6 @@
1211
EDITABLE_TESTS = False
1312

1413

15-
@nox.session
16-
def doc(session):
17-
"""
18-
Build the documentation.
19-
20-
Accepts the following arguments:
21-
- serve: open documentation after build
22-
- further arguments are passed to mkbuild
23-
"""
24-
25-
options = session.posargs[:]
26-
open_doc = "serve" in options
27-
if open_doc:
28-
options.remove("serve")
29-
30-
session.install("-e", ".[doc]")
31-
32-
if open_doc:
33-
open_cmd = "xdg-open" if sys.platform == "linux" else "open"
34-
session.run(open_cmd, "http://localhost:8000/systems/fillname/")
35-
session.run("mkdocs", "serve", *options)
36-
else:
37-
session.run("mkdocs", "build", *options)
38-
39-
4014
@nox.session
4115
def dev(session):
4216
"""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ format = ["black", "isort", "autoflake"]
1919
lint_pylint = ["pylint"]
2020
typecheck = ["types-setuptools", "mypy"]
2121
test = ["coverage[toml]"]
22-
doc = ["mkdocs", "mkdocs-material", "mkdocstrings[python]"]
22+
doc = ["mkdocs", "mkdocs-material", "mkdocstrings[python]", "mkdoclingo"]
2323
dev = ["fillname[test,typecheck,lint_pylint]"]
2424

2525
[project.scripts]

0 commit comments

Comments
 (0)