Repository navigation
148 lines (127 loc) · 5.33 KB
/
Copy pathdocs.yml
File metadata and controls
148 lines (127 loc) · 5.33 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
name: Deploy Documentation
on:
push:
branches:
- main
workflow_dispatch:
# Sets permissions for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build and deploy documentation
build-and-deploy:
name: Build and deploy docs
runs-on: ubuntu-latest
container:
image: firedrakeproject/firedrake-vanilla-default:dev-main
steps:
- name: Install system dependencies
run: |
apt-get update
apt-get install -y python3-venv libgeos-dev libproj-dev proj-data
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up virtual environment
run: |
python3 -m venv --system-site-packages .venv
. .venv/bin/activate
pip install --upgrade pip
- name: Install gadopt
run: |
. .venv/bin/activate
pip install git+https://github.com/g-adopt/g-adopt.git
- name: Install gdrift and docs dependencies
run: |
. .venv/bin/activate
pip install -e ".[docs,examples]"
# The container already has jupytext in the system site-packages,
# so the line above does not install it into the venv, and the
# `jupytext` on the PATH then runs with /usr/bin/python3, which
# cannot see the kernel installed into .venv below. Install it
# into the venv so that `jupytext --execute` uses the venv Python.
pip install --ignore-installed --no-deps jupytext
- name: Install Jupyter kernel
run: |
. .venv/bin/activate
python -m ipykernel install --prefix .venv --name python3
- name: Prepare demo data and notebooks
working-directory: examples
run: |
. $GITHUB_WORKSPACE/.venv/bin/activate
make all
env:
MPLBACKEND: Agg
- name: Generate thumbnails
run: |
. .venv/bin/activate
python scripts/generate_thumbnails.py
env:
MPLBACKEND: Agg
- name: Copy notebooks to docs
run: |
for demo in mantle_solidus anelasticity_corrections geodynamic_adiabat linearisation tomography_models tomography_cross_section temperature_to_vs gadopt_loading_field; do
if [ -f "examples/${demo}/demo.ipynb" ]; then
mkdir -p "docs/examples/${demo}"
cp "examples/${demo}/demo.ipynb" "docs/examples/${demo}/demo.ipynb"
echo "Copied ${demo}/demo.ipynb"
fi
done
- name: Generate Data Catalog
run: |
. .venv/bin/activate
python scripts/generate_data_catalog.py
- name: Generate Tomography Gallery
run: |
. .venv/bin/activate
python scripts/generate_tomography_gallery.py
env:
MPLBACKEND: Agg
timeout-minutes: 30
- name: Generate Thermodynamic Gallery
run: |
. .venv/bin/activate
python scripts/generate_thermodynamic_gallery.py
env:
MPLBACKEND: Agg
timeout-minutes: 30
- name: Verify generated files
run: |
test -f docs/data-catalog-generated.md || { echo "FAIL: data-catalog-generated.md not found"; exit 1; }
test -f docs/data-catalog-incomplete.md || { echo "FAIL: data-catalog-incomplete.md not found"; exit 1; }
test -f docs/tomography-gallery-generated.md || { echo "FAIL: tomography-gallery-generated.md not found"; exit 1; }
test -d docs/assets/images/tomography || { echo "FAIL: tomography image directory not found"; exit 1; }
test -f docs/assets/images/tomography/reference_cross_section.png || { echo "FAIL: reference map not found"; exit 1; }
test -f docs/thermodynamic-gallery-generated.md || { echo "FAIL: thermodynamic-gallery-generated.md not found"; exit 1; }
test -d docs/assets/images/thermodynamic || { echo "FAIL: thermodynamic image directory not found"; exit 1; }
test -f docs/assets/images/thermodynamic/SLB_24_pyroliteCFMASNaCr.png || { echo "FAIL: featured SLB_24 figure not found"; exit 1; }
for demo in mantle_solidus anelasticity_corrections geodynamic_adiabat linearisation tomography_models temperature_to_vs; do
test -f "docs/assets/images/thumbnails/${demo}.png" || { echo "FAIL: thumbnail ${demo}.png not found"; exit 1; }
done
for demo in mantle_solidus anelasticity_corrections geodynamic_adiabat linearisation tomography_models tomography_cross_section temperature_to_vs gadopt_loading_field; do
test -f "docs/examples/${demo}/demo.ipynb" || { echo "FAIL: notebook ${demo}/demo.ipynb not found"; exit 1; }
done
echo "OK: All generated files present"
- name: Build documentation
run: |
. .venv/bin/activate
mkdocs build --strict
env:
MPLBACKEND: Agg
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4