Skip to content

Commit 0867e88

Browse files
committed
Attempt to create documentation
1 parent e952a40 commit 0867e88

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

.github/workflows/docs.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Build opm-simulators Doxygen Docs and push to gh-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request_target:
8+
types: closed
9+
branches: aritorto
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Install system dependencies
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y doxygen graphviz
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: '3.x'
28+
29+
- name: Install Python packages
30+
run: |
31+
pip install sphinx==7.2.6 breathe==4.35.0 furo
32+
33+
- name: Generate Doxyfile
34+
run: |
35+
doxygen -g Doxyfile
36+
37+
- name: Delete the FILE_PATTERNS block entirely
38+
run: |
39+
sed -i '/^FILE_PATTERNS/,/[^\\]$/d' Doxyfile
40+
41+
- name: Add new FILE_PATTERNS line at the end
42+
run: |
43+
echo 'FILE_PATTERNS = *.cpp *.hpp' >> Doxyfile
44+
45+
- name: Rewrite some of the defaulted values in Doxyfile
46+
run: |
47+
sed -i \
48+
-e 's/^PROJECT_NAME.*/PROJECT_NAME = "opm-simulators"/' \
49+
-e 's|^OUTPUT_DIRECTORY.*|OUTPUT_DIRECTORY = docs/doxygen|' \
50+
-e 's/^GENERATE_XML.*/GENERATE_XML = YES/' \
51+
-e 's/^RECURSIVE.*/RECURSIVE = YES/' \
52+
-e 's|^INPUT.*|INPUT = opm/simulators opm/models|' \
53+
-e 's/^EXTRACT_ALL.*/EXTRACT_ALL = YES/' \
54+
Doxyfile
55+
56+
- name: Quickstart Sphinx
57+
run: |
58+
rm -rf docs/sphinx/*
59+
sphinx-quickstart -q -p "opm-simulators" -a "opm-dev" --sep docs/sphinx
60+
61+
- name: Overwrite conf.py with custom config
62+
run: |
63+
echo "import os" > docs/sphinx/source/conf.py
64+
echo "import sys" >> docs/sphinx/source/conf.py
65+
echo "sys.path.insert(0, os.path.abspath('.'))" >> docs/sphinx/source/conf.py
66+
echo "" >> docs/sphinx/source/conf.py
67+
echo "extensions = ['breathe']" >> docs/sphinx/source/conf.py
68+
echo "breathe_projects = {" >> docs/sphinx/source/conf.py
69+
echo " 'OPM': '../../doxygen/xml'" >> docs/sphinx/source/conf.py
70+
echo "}" >> docs/sphinx/source/conf.py
71+
echo "breathe_default_project = 'OPM'" >> docs/sphinx/source/conf.py
72+
echo "" >> docs/sphinx/source/conf.py
73+
echo "html_theme = 'furo'" >> docs/sphinx/source/conf.py
74+
75+
- name: Create index.rst with Breathe directives
76+
run: |
77+
echo "opm-simulators documentation" > docs/sphinx/source/index.rst
78+
echo "============================" >> docs/sphinx/source/index.rst
79+
echo "" >> docs/sphinx/source/index.rst
80+
echo ".. toctree::" >> docs/sphinx/source/index.rst
81+
echo " :maxdepth: 2" >> docs/sphinx/source/index.rst
82+
echo " :caption: Contents:" >> docs/sphinx/source/index.rst
83+
echo "" >> docs/sphinx/source/index.rst
84+
echo "" >> docs/sphinx/source/index.rst
85+
echo "API Reference" >> docs/sphinx/source/index.rst
86+
echo "=============" >> docs/sphinx/source/index.rst
87+
echo "" >> docs/sphinx/source/index.rst
88+
echo ".. doxygenindex::" >> docs/sphinx/source/index.rst
89+
echo " :project: OPM" >> docs/sphinx/source/index.rst
90+
91+
- name: Build Doxygen documentation
92+
run: |
93+
ls
94+
doxygen Doxyfile
95+
96+
- name: Build Sphinx documentation
97+
run: |
98+
sphinx-build -b html docs/sphinx/source docs/sphinx/build/html
99+
make html
100+
101+
- name: Copy documentation to gh-pages
102+
run: |
103+
mkdir docs/sphinx/gh-pages
104+
cp -r docs/sphinx/build/* docs/sphinx/gh-pages
105+
- name: Deploy documentation
106+
uses: OPM/github-pages-deploy-action@releases/v4
107+
with:
108+
branch: gh-pages
109+
folder: docs/sphinx/gh-pages

0 commit comments

Comments
 (0)