-
Notifications
You must be signed in to change notification settings - Fork 117
240 lines (205 loc) · 7.01 KB
/
docs.yml
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: MODFLOW 6 documentation
on:
push:
paths-ignore:
- '.github/workflows/release.yml'
- '.hpc/**'
pull_request:
branches:
- master
- develop
paths-ignore:
- '.github/workflows/release.yml'
- '.hpc/**'
jobs:
rtd_build:
name: Build ReadTheDocs
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
env:
FC: gfortran
FC_V: 12
steps:
- name: Checkout modflow6
uses: actions/checkout@v4
with:
path: modflow6
- name: Checkout modflow6-examples
uses: actions/checkout@v4
with:
repository: MODFLOW-USGS/modflow6-examples
path: modflow6-examples
- name: Checkout usgslatex
uses: actions/checkout@v4
with:
repository: MODFLOW-USGS/usgslatex
path: usgslatex
- name: Install Conda environment from environment.yml
uses: mamba-org/setup-micromamba@v1
with:
environment-file: modflow6/environment.yml
cache-environment: true
cache-downloads: true
- name: Install additional packages for Sphinx using pip
working-directory: modflow6/.build_rtd_docs
run: pip install -r requirements.rtd.txt
- name: Print python package versions
run: pip list
- name: Install TeX Live
run: |
sudo apt-get update
sudo apt install texlive-latex-extra texlive-science texlive-font-utils
- name: Install USGS LaTeX style files and Univers font
working-directory: usgslatex/usgsLaTeX
run: sudo ./install.sh --all-users
- name: Test building files from dfn's for LaTeX
working-directory: modflow6/autotest
run: pytest -v build_mfio_tex.py
- name: Setup ${{ env.FC }} ${{ env.FC_V }}
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: ${{ env.FC_V }}
- name: Cache modflow6 examples
id: cache-examples
uses: actions/cache@v4
with:
path: modflow6-examples/examples
key: modflow6-examples-${{ hashFiles('modflow6-examples/scripts/**') }}
- name: Install extra Python packages
if: steps.cache-examples.outputs.cache-hit != 'true'
working-directory: modflow6-examples/etc
run: |
pip install -r requirements.pip.txt
pip install -r requirements.usgs.txt
- name: Update FloPy
if: steps.cache-examples.outputs.cache-hit != 'true'
working-directory: modflow6/autotest
run: python update_flopy.py
- name: Build example models
if: steps.cache-examples.outputs.cache-hit != 'true'
working-directory: modflow6-examples/autotest
run: |
pytest -v -n auto test_scripts.py --init
ls -lh ../examples/
- name: Run benchmarks
working-directory: modflow6/distribution
run: python benchmark.py
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Show benchmarks
working-directory: modflow6/distribution
run: cat run-time-comparison.md
- name: Upload benchmarks
uses: actions/upload-artifact@v3
with:
name: run-time-comparison
path: modflow6/distribution/run-time-comparison.md
- name: Collect deprecations
working-directory: modflow6/doc/mf6io/mf6ivar
run: python deprecations.py
- name: Show deprecations
working-directory: modflow6/doc/mf6io/mf6ivar/md
run: cat deprecations.md
- name: Upload deprecations
uses: actions/upload-artifact@v3
with:
name: deprecations
path: modflow6/doc/mf6io/mf6ivar/md/deprecations.md
- name: Run sphinx
working-directory: modflow6/.build_rtd_docs
run: make html
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: rtd-files-for-${{ github.sha }}
path: |
modflow6/.build_rtd_docs/index.rst
modflow6/.build_rtd_docs/mf6io.rst
# run-time-comparison is moved to _mf6run by conf.py
modflow6/.build_rtd_docs/_mf6run/
modflow6/.build_rtd_docs/_mf6io/
modflow6/.build_rtd_docs/_static/
rtd_trigger:
name: rtd-trigger
needs: rtd_build
runs-on: ubuntu-22.04
if: github.repository_owner == 'MODFLOW-USGS' && github.event_name == 'push'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Trigger RTDs build on push to repo branches
uses: dfm/rtds-action@v1
with:
webhook_url: ${{ secrets.MF6_RTDS_WEBHOOK_URL }}
webhook_token: ${{ secrets.MF6_RTDS_WEBHOOK_TOKEN }}
commit_ref: ${{ github.ref }}
doxygen_build:
runs-on: ubuntu-22.04
env:
working-directory: .build_rtd_docs
distribution-directory: distribution
common-directory: .github/common
branch-name: ${GITHUB_REF##*/}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Print branch name
run: echo ${{env.branch-name}}
- name: Install doxygen and graphviz
run: |
sudo apt-get update
sudo apt-get install doxygen graphviz
- name: Install Conda environment from environment.yml
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment: true
cache-downloads: true
- name: Print python package versions
run: pip list
- name: update MODFLOW 6 version
run: python update_version.py
working-directory: ${{env.distribution-directory}}
- name: update MODFLOW 6 version in Doxyfile
run: |
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join("..", "doc")))
from version import __version__
print("Update the Doxyfile with the latest version number")
with open("Doxyfile", "r") as fp:
lines = fp.readlines()
tag = "PROJECT_NUMBER"
with open("Doxyfile", "w") as fp:
for line in lines:
if tag in line:
line = '{} = "version {}"\n'.format(tag, __version__)
fp.write(line)
shell: python
working-directory: ${{env.working-directory}}
- name: run doxygen
run: doxygen
working-directory: ${{env.working-directory}}
- name: upload pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: ${{env.working-directory}}/html
pages_deploy:
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
needs: doxygen_build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3