Skip to content

Commit

Permalink
ci: fix readthedocs
Browse files Browse the repository at this point in the history
* add devtools as rtd dependency
* use update_version fn directly in conf.py
* use myst-parser (and remove recommonmark)
* debug docs.yml, add explanatory comment
* update copyright year from 2020 to 2023
  • Loading branch information
wpbonelli committed Jan 17, 2023
1 parent f303120 commit 8d3241e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 37 deletions.
17 changes: 4 additions & 13 deletions .build_rtd_docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from subprocess import Popen, PIPE

sys.path.insert(0, os.path.abspath(os.path.join("..", "doc")))
sys.path.insert(0, os.path.abspath(os.path.join("..", "distribution")))

# -- determine if running on readthedocs ------------------------------------
on_rtd = os.environ.get("READTHEDOCS") == "True"
Expand All @@ -35,18 +36,8 @@

# -- Update the modflow 6 version -------------------------------------------
print("Update the modflow6 version")
pth = os.path.join("..", "distribution")
args = (
"python",
"update_version.py",
)
# run the command
proc = Popen(args, stdout=PIPE, stderr=PIPE, cwd=pth)
stdout, stderr = proc.communicate()
if stdout:
print(stdout.decode("utf-8"))
if stderr:
print("Errors:\n{}".format(stderr.decode("utf-8")))
from update_version import update_version
update_version()

# -- import version from doc/version.py -------------------------------------
from version import __version__
Expand Down Expand Up @@ -92,7 +83,7 @@
# -- Project information -----------------------------------------------------

project = "MODFLOW 6 Program Documentation"
copyright = "2020, MODFLOW Development Team"
copyright = "2023, MODFLOW Development Team"
author = "MODFLOW Development Team"

# -- Project version ---------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions .build_rtd_docs/requirements.rtd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ nbsphinx_link
ipython
ipykernel
rtds_action
myst_parser
myst-parser
sphinx_rtd_theme
pytest
filelock
filelock
modflow-devtools
6 changes: 3 additions & 3 deletions .doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# -- Project information -----------------------------------------------------

project = "MODFLOW 6 Program Documentation"
copyright = "2020, MODFLOW Development Team"
copyright = "2023, MODFLOW Development Team"
author = "MODFLOW Development Team"

# -- General configuration ---------------------------------------------------
Expand All @@ -70,7 +70,7 @@
"sphinx.ext.viewcode",
"IPython.sphinxext.ipython_console_highlighting", # lowercase didn't work
"sphinx.ext.autosectionlabel",
"recommonmark",
"myst_parser",
"sphinx_markdown_tables",
]

Expand All @@ -82,7 +82,7 @@
# Settings for GitHub actions integration
if on_rtd:
extensions.append("rtds_action")
rtds_action_github_repo = "MODFLOW-USGS/modflow6"
rtds_action_github_repo = "w-bonelli/modflow6"
rtds_action_path = "."
rtds_action_artifact_prefix = "rtd-files-for-"
rtds_action_github_token = os.environ.get("GITHUB_TOKEN", None)
Expand Down
2 changes: 1 addition & 1 deletion .doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ipython
ipykernel
rtds_action
sphinx_rtd_theme
recommonmark
myst-parser
29 changes: 11 additions & 18 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
shell: bash -l {0}
env:
GCC_V: 12
working-directory: .build_rtd_docs
distribution-directory: distribution

steps:
- name: Checkout modflow6
Expand Down Expand Up @@ -52,12 +50,10 @@ jobs:

- name: Install additional packages for Sphinx using pip
working-directory: modflow6/.build_rtd_docs
run: |
pip install -r requirements.rtd.txt
run: pip install -r requirements.rtd.txt

- name: Print python package versions
run: |
pip list
run: pip list

- name: Install TeX Live
run: |
Expand All @@ -66,13 +62,11 @@ jobs:
- name: Install USGS LaTeX style files and Univers font
working-directory: usgslatex/usgsLaTeX
run: |
sudo ./install.sh --all-users
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
run: pytest -v build_mfio_tex.py

- name: Setup GNU Fortran ${{ env.GCC_V }}
uses: awvwgk/setup-fortran@main
Expand Down Expand Up @@ -103,21 +97,19 @@ jobs:
- name: Run benchmarks
working-directory: modflow6/distribution
run: python benchmark.py
env:
GITHUB_TOKEN: ${{ github.token }}
run: python benchmark.py

- name: Run sphinx
working-directory: modflow6/.build_rtd_docs
run: |
make html
run: make html

- name: Show results
- name: Show benchmarks
working-directory: modflow6/distribution
run: |
cat run-time-comparison.md
run: cat run-time-comparison.md

- name: Upload comparison
- name: Upload benchmarks
uses: actions/upload-artifact@v3
with:
name: run-time-comparison
Expand All @@ -128,12 +120,13 @@ jobs:
with:
name: rtd-files-for-${{ github.sha }}
path: |
modflow6/.build_rtd_docs/
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
Expand Down

0 comments on commit 8d3241e

Please sign in to comment.