Skip to content

Commit 0ac3663

Browse files
mborlandwchilders-nvidia
authored andcommitted
Add GitHub workflow support for updating a version of the documention based on the latest development activity []
1 parent ca5890b commit 0ac3663

11 files changed

Lines changed: 160 additions & 5 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM
2+
# Exceptions.
3+
# See https://edgcpp.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
# Build the Sphinx documentation in doc/ with warnings treated as errors, so
7+
# documentation changes stay publishable.
8+
#
9+
# The build runs in the edgcpp/sphinx-env image, which the site workflow
10+
# described below also builds the published documentation with. That image
11+
# installs the packages pinned in doc/requirements.txt, so after changing
12+
# them, rebuild it with build-edg-env sphinx-env and push it to Docker Hub.
13+
#
14+
# The documentation is published by the edgcpp/edgcpp.github.io site
15+
# workflow, not from here: it builds the release tag into
16+
# https://edgcpp.org/doc/ and main into https://edgcpp.org/dev/doc/. After a
17+
# push to main passes the build, this asks that workflow to run so the
18+
# development documentation is updated. That needs the SITE_DISPATCH_TOKEN
19+
# secret: a fine-grained token for edgcpp/edgcpp.github.io only, with
20+
# "Actions: Read and write" permission.
21+
22+
name: Documentation
23+
24+
on:
25+
push:
26+
branches:
27+
- main
28+
paths:
29+
- 'doc/**'
30+
- '.github/workflows/documentation.yml'
31+
pull_request:
32+
paths:
33+
- 'doc/**'
34+
- '.github/workflows/documentation.yml'
35+
workflow_dispatch:
36+
37+
permissions:
38+
contents: read
39+
40+
concurrency:
41+
group: documentation-${{ github.ref }}
42+
cancel-in-progress: true
43+
44+
jobs:
45+
build:
46+
name: Build HTML documentation
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 15
49+
container:
50+
image: docker.io/edgcpp/sphinx-env:latest
51+
steps:
52+
- name: Check out repository
53+
uses: actions/checkout@v7
54+
55+
# The published site uses the dirhtml builder, so check that one.
56+
- name: Build HTML
57+
run: make -C doc dirhtml SPHINXOPTS="-W"
58+
59+
publish-dev:
60+
name: Publish development documentation
61+
needs: build
62+
if: >
63+
github.repository == 'edgcpp/compiler' &&
64+
github.event_name != 'pull_request' &&
65+
github.ref == 'refs/heads/main'
66+
runs-on: ubuntu-latest
67+
timeout-minutes: 5
68+
steps:
69+
- name: Trigger the edgcpp.org site build
70+
env:
71+
GH_TOKEN: ${{ secrets.SITE_DISPATCH_TOKEN }}
72+
run: |
73+
if [ -z "$GH_TOKEN" ]; then
74+
echo "::warning::SITE_DISPATCH_TOKEN is not set, so" \
75+
"https://edgcpp.org/dev/doc/ was not updated."
76+
exit 0
77+
fi
78+
gh workflow run build_and_deploy.yml \
79+
--repo edgcpp/edgcpp.github.io --ref develop

‎.gitignore‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ bin
5353
CMakeFiles/
5454
CMakeCache.txt
5555
compile_commands.json
56+
cmake/macro-conf/*.cmakedef
5657

5758
# clangd cache files
5859
.cache/
5960

6061
# VS-created items to ignore:
6162
.vs/
63+
64+
# CLion-created items to ignore:
65+
.idea/
66+
67+
# AI tooling items to ignore:
68+
CLAUDE.md

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ development tools.
2222

2323
## Documentation
2424

25-
See the documentation on: https://edgcpp.org/doc/.
25+
See the documentation on: https://edgcpp.org/doc/. Documentation for the
26+
current development branch (`main`) is on: https://edgcpp.org/dev/doc/.
2627

2728
> [!NOTE]
2829
>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requirements.txt

‎dev_tools/docker/sphinx-env/Dockerfile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ RUN mkdir /edg && \
1515
mkdir /edg/user-script/pip-packages/
1616
COPY setup-scripts/* /edg/setup-scripts/
1717

18+
# Copy in doc/requirements.txt (see prebuild.py) for the pip packages.
19+
COPY requirements.txt /edg/setup-scripts/requirements.txt
20+
1821
# Execute root based setup scripts.
1922
RUN /edg/setup-scripts/run-all.sh
2023

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM
2+
# Exceptions.
3+
# See https://edgcpp.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
# This script is executed by build-edg-env before creation of the Docker image
7+
# to copy in the documentation's requirements.txt file.
8+
9+
import os
10+
import shutil
11+
12+
import edgtools
13+
14+
from pathlib import Path
15+
16+
def copy_requirements_file() -> None:
17+
'''Copy doc/requirements.txt for use by the Dockerfile.'''
18+
doc_dir = edgtools.get_tools_dir().parent / 'doc'
19+
shutil.copy(doc_dir / 'requirements.txt', Path(os.getcwd()))
20+
21+
def main() -> None:
22+
copy_requirements_file()
23+
24+
main()

‎dev_tools/docker/sphinx-env/setup-scripts/install-pip-packages.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
# See https://edgcpp.org/LICENSE.txt for license information.
66
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77

8-
# Install Sphinx using pip
9-
pip install -U Sphinx shibuya
8+
# Install the documentation's pinned packages (doc/requirements.txt) using pip
9+
pip install -r /edg/setup-scripts/requirements.txt

‎dev_tools/docker/sphinx-env/setup-scripts/install-software.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ packages+=(
2020
"texlive-collection-latexextra"
2121
)
2222

23+
# Add required packages for checkout to function (in CI, see
24+
# .github/workflows/documentation.yml)
25+
packages+=("git" "nodejs")
26+
2327
# Add useful linux commands
2428
packages+=("util-linux") # kill, runuser
2529

‎doc/README.md‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,49 @@ If `pip3` is not an alias for Python 3's PIP, use:
1515
pip install -U Sphinx shibuya
1616
```
1717

18+
To use the exact versions that CI checks the documentation with (requires
19+
Python 3.12 or newer):
20+
21+
```
22+
pip3 install -r doc/requirements.txt
23+
```
24+
1825
## Make HTML
1926

2027
To make an HTML version of the documentation, after Sphinx is installed:
2128

2229
```
23-
cd doc-sphinx
30+
cd doc
2431
make html
2532
```
2633

2734
These files can then be viewed in the browser by opening
2835
`build/html/index.html`.
2936

37+
To check for warnings the same way CI does, which fails on any warning:
38+
39+
```
40+
make html SPHINXOPTS="-W"
41+
```
42+
43+
## Publishing
44+
45+
The [website repository](https://github.com/edgcpp/edgcpp.github.io) builds
46+
this documentation with `make dirhtml` and publishes two copies of it:
47+
48+
- https://edgcpp.org/doc/ is the release documentation, built from the tag
49+
named by `COMPILER_DOC_REF` in the website's
50+
`.github/workflows/build_and_deploy.yml`. Bump that to publish a newer
51+
release's documentation.
52+
- https://edgcpp.org/dev/doc/ is the development documentation, built from
53+
`main`.
54+
55+
In this repository, the
56+
[Documentation workflow](../.github/workflows/documentation.yml) checks that
57+
the documentation builds without warnings on every pull request and push to
58+
`main` that touches `doc/`. When such a push to `main` passes, it triggers
59+
the website's workflow, which updates https://edgcpp.org/dev/doc/.
60+
3061
## Useful Links:
3162

3263
- [reStructuredText Basics](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html)

‎doc/requirements.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Python packages needed to build the documentation. These are the exact
2+
# versions the documentation check (.github/workflows/documentation.yml)
3+
# builds with. Sphinx 9.1 requires Python 3.12 or newer.
4+
Sphinx==9.1.0
5+
shibuya==2026.7.12

0 commit comments

Comments
 (0)