Skip to content

Commit 2ba3d68

Browse files
committed
enable docs preview in PRs (#43)
Relates to nRF24/RF24#1003 but Sphinx-related changes are not applicable here.
1 parent 255cbfd commit 2ba3d68

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed

Diff for: .github/doxygen.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""WARNING -- FOR CI ONLY
2+
3+
This script is meant to be execute in CI only.
4+
Running this locally will alter the Doxyfile.
5+
Such changes SHOULD NOT be pushed to the remote.
6+
"""
7+
8+
from pathlib import Path
9+
import subprocess
10+
11+
DOCS_DIR = Path(__file__).parent.parent / "docs"
12+
CONFIG = DOCS_DIR / "Doxyfile"
13+
TMP = DOCS_DIR / "doxygenAction"
14+
15+
16+
def overwrite_doxygen_value():
17+
result = subprocess.run(
18+
["git", "describe", "--tags"], check=True, capture_output=True
19+
)
20+
version = result.stdout.decode(encoding="utf-8").strip().lstrip("v")
21+
config = CONFIG.read_text(encoding="utf-8")
22+
TMP.write_text("PROJECT_NUMBER = {}\n".format(version), encoding="utf-8")
23+
config += f"\n@INCLUDE = {str(TMP)}\n"
24+
CONFIG.write_text(config, encoding="utf-8")
25+
26+
27+
if __name__ == "__main__":
28+
overwrite_doxygen_value()

Diff for: .github/workflows/doxygen.yml

+1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ jobs:
3030
uses: nRF24/.github/.github/workflows/build_docs.yaml@main
3131
with:
3232
deploy-gh-pages: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master') }}
33+
doxygen-version: '1.13.2'
3334
secrets: inherit

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# ignore docs folder
66
docs/html/
77
docs/xml/
8+
docs/doxygenAction
89

910
# ignore CMake stuff
1011
build/

Diff for: .readthedocs.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
build:
9+
os: "ubuntu-22.04"
10+
apt_packages:
11+
- libclang1-12
12+
- libclang-cpp12
13+
tools:
14+
python: "3"
15+
commands:
16+
# Install doxygen from source distributions (conda forge does not keep up-to-date doxygen releases)
17+
- >
18+
DOXYGEN_VERSION="1.13.2" &&
19+
mkdir .doxygen && cd .doxygen &&
20+
echo $(pwd) &&
21+
echo "https://sourceforge.net/projects/doxygen/files/rel-$DOXYGEN_VERSION/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz" &&
22+
curl -L https://sourceforge.net/projects/doxygen/files/rel-$DOXYGEN_VERSION/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz > doxygen.tar.gz &&
23+
gunzip doxygen.tar.gz &&
24+
tar xf doxygen.tar &&
25+
mv doxygen-$DOXYGEN_VERSION/bin/doxygen ./
26+
# get lib version & overwrite Doxyfile values
27+
- python3 .github/doxygen.py
28+
# run doxygen
29+
- cd docs && ../.doxygen/doxygen
30+
# copy output to RTD output path for HTML files
31+
- ls -R docs/html/
32+
- mkdir -p ${READTHEDOCS_OUTPUT}
33+
- mv docs/html/ "${READTHEDOCS_OUTPUT}"

Diff for: docs/Doxyfile

+6
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ SHOW_FILES = NO
156156

157157
SHOW_NAMESPACES = NO
158158

159+
# Don't display the ugly/complicated "tree view" side menu.
160+
# And, restore the top (simpler) navigation bar.
161+
# As of doxygen v1.13.0, these default values changed from NO to YES
162+
GENERATE_TREEVIEW = NO
163+
DISABLE_INDEX = NO
164+
159165
#---------------------------------------------------------------------------
160166
# Configuration options related to the input files
161167
#---------------------------------------------------------------------------

0 commit comments

Comments
 (0)