-
Notifications
You must be signed in to change notification settings - Fork 4
177 lines (144 loc) · 4.75 KB
/
docs.yml
File metadata and controls
177 lines (144 loc) · 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Build and Deploy Documentation
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install basic dependencies for documentation
pip install sphinx sphinx-autodoc-typehints sphinx-rtd-theme
pip install numpy pandas matplotlib tqdm h5py
# Install torch and torch-geometric (CPU versions for docs)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip install torch-geometric
# Try to install project dependencies if they exist
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then pip install -e .; fi
- name: Setup Sphinx documentation
run: |
# Create docs directory if it doesn't exist
mkdir -p docs
cd docs
# Initialize Sphinx if not already done
if [ ! -f conf.py ]; then
sphinx-quickstart --quiet --sep --project "FoldTree2" \
--author "DessimozLab" --release "1.0" --language en \
--extensions sphinx.ext.autodoc,sphinx.ext.viewcode,sphinx.ext.napoleon \
--makefile --no-batchfile .
fi
- name: Configure Sphinx
run: |
cd docs
# Create or update conf.py with proper configuration
cat > conf.py << 'EOF'
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
project = 'FoldTree2'
copyright = '2025, DessimozLab'
author = 'DessimozLab'
release = '1.0'
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.githubpages',
]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
# Napoleon settings for Google/NumPy style docstrings
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = False
napoleon_include_private_with_doc = False
# Autodoc settings
autodoc_default_options = {
'members': True,
'undoc-members': True,
'show-inheritance': True,
}
EOF
- name: Generate API documentation
run: |
cd docs
# Create index.rst if it doesn't exist
cat > index.rst << 'EOF'
FoldTree2 Documentation
=======================
FoldTree2 is a toolkit for protein structure phylogenetic analysis using neural network encoders.
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
Overview
--------
FoldTree2 combines structural biology and phylogenetics by:
* Encoding protein structures using trained neural networks
* Generating structure-based substitution matrices
* Performing phylogenetic inference with structural information
API Reference
=============
.. toctree::
:maxdepth: 4
foldtree2
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
EOF
# Generate module documentation
sphinx-apidoc -f -o . ../foldtree2 --separate
- name: Build documentation
run: |
cd docs
make html
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: './docs/_build/html'
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2