Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding extra docs requirements and tweak conf #181

Closed
wants to merge 10 commits into from
39 changes: 39 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Documentation Build

on:
push:
paths:
- "doc/**"
- "**/doc.yml"
- "requirements-docs.txt"
pull_request:
paths:
- "doc/**"
- "**/doc.yml"
- "requirements-docs.txt"

jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r "requirements-docs.txt"
python -m pip install -e "."
- name: Build documentation
run: make --directory=doc html
28 changes: 25 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,45 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import contextlib
import os
import sys
from pkg_resources import DistributionNotFound, get_distribution

sys.path.insert(0, os.path.abspath("../.."))
sys.path.insert(0, os.path.abspath("../sphinxext"))
import datetime

import icepyx
import recommonmark


# -- Project information -----------------------------------------------------

project = "icepyx"
year = datetime.date.today().year
copyright = "2019-{}, The icepyx Developers".format(year)

@contextlib.contextmanager
def chdir(directory):
curdir = os.curdir
try:
os.chdir(directory)
yield
finally:
os.chdir(curdir)


try:
dist = get_distribution(project)
except DistributionNotFound:
# The project is not installed in readthedocs environment (requires LDAP
# bindings). Read the version with setuptools_scm.
import setuptools_scm

with chdir("../.."):
release = setuptools_scm.get_version()
else:
release = dist.version
version = ".".join(release.split(".")[:2])

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
Expand Down
3 changes: 3 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ python:
install:
- requirements: requirements-docs.txt
- requirements: requirements.txt
- method: pip
path: .
system_packages: true
4 changes: 4 additions & 0 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
gitpython
nbsphinx
numpydoc
pandoc
pybtex
pygithub
sphinxcontrib-bibtex
setuptools_scm
recommonmark
sphinx_rtd_theme