Skip to content

Commit 2674894

Browse files
committed
enable RTD builds for PRs
1 parent bfa7d02 commit 2674894

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

.github/doxygen.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
10+
DOCS_DIR = Path(__file__).parent.parent / "docs"
11+
PROPERTIES = DOCS_DIR.parent / "library.properties"
12+
CONFIG = DOCS_DIR / "Doxyfile"
13+
TMP = DOCS_DIR / "doxygenAction"
14+
15+
16+
def overwrite_doxygen_value():
17+
properties = PROPERTIES.read_text(encoding="utf-8").splitlines()
18+
for line in properties:
19+
if line.startswith("version="):
20+
_, value = line.split("=", 1)
21+
version = value.strip()
22+
break
23+
else:
24+
raise RuntimeError("version not found in library.properties")
25+
config = CONFIG.read_text(encoding="utf-8")
26+
TMP.write_text(f"PROJECT_NUMBER = {version}\n", encoding="utf-8")
27+
config += f"\n@INCLUDE = {str(TMP)}\n"
28+
CONFIG.write_text(config, encoding="utf-8")
29+
30+
31+
if __name__ == "__main__":
32+
overwrite_doxygen_value()

.readthedocs.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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-24.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.15.0" &&
19+
RELEASE_TITLE=$(echo ${DOXYGEN_VERSION} | tr '.' '_') &&
20+
mkdir .doxygen && cd .doxygen &&
21+
curl -L "https://github.com/doxygen/doxygen/releases/download/Release_${RELEASE_TITLE}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz" --output doxygen.tar.gz &&
22+
gunzip doxygen.tar.gz &&
23+
tar xf doxygen.tar &&
24+
mv doxygen-${DOXYGEN_VERSION}/bin/doxygen ./
25+
# get lib version & overwrite Doxyfile values
26+
- python3 .github/doxygen.py
27+
# run doxygen
28+
- cd docs && ../.doxygen/doxygen
29+
# copy output to RTD output path for HTML files
30+
- ls -R docs/html/
31+
- mkdir -p ${READTHEDOCS_OUTPUT}
32+
- mv docs/html/ "${READTHEDOCS_OUTPUT}"

0 commit comments

Comments
 (0)