Merge pull request #202 from threeML/cosmology #542
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docs | |
on: [push, release] | |
jobs: | |
notebooks: | |
name: "Build the notebooks for the docs" | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Init Environment | |
#shell: bash -l {0} | |
run: | | |
brew update | |
brew install --cask basictex | |
eval "$(/usr/libexec/path_helper)" | |
- name: Setup base pkgs | |
#shell: bash -l {0} | |
run: | | |
python -m pip install --upgrade pip wheel | |
python -m pip install numpy numba tempita jupytext jupyterthemes jupyter_latex_envs papermill matplotlib astropy pandas tables healpy | |
python -m pip install ebltable black | |
- name: Install the package | |
#shell: bash -l {0} | |
run: | | |
python setup.py install | |
- name: Execute the notebooks | |
#shell: bash -l {0} | |
run: | | |
# Download an example file | |
wget https://www.astropy.org/astropy-data/photometry/spitzer_example_image.fits | |
mv spitzer_example_image.fits docs/md/ | |
jupytext --to ipynb --execute docs/md/*.md | |
mv docs/md/*.ipynb docs/notebooks/ | |
ls docs/notebooks | |
env: | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
- name: Create function gallery | |
#shell: bash -l {0} | |
run: | | |
# move to the scripts directory | |
cd scripts | |
# now generate the function docs | |
python generate_func_docs.py | |
cd .. | |
ls docs/notebooks | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: notebooks-for-${{ github.sha }} | |
path: docs/notebooks | |
- name: Sleep for 5 min | |
uses: juliangruber/sleep-action@v1 | |
with: | |
time: 5m | |
- name: Trigger RTDs build | |
uses: dfm/rtds-action@main | |
with: | |
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }} | |
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }} | |
commit_ref: ${{ github.ref }} | |
api_doc: | |
name: "Create the API stubs" | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Build the API doc | |
run: | | |
brew install c-blosc | |
brew install hdf5 | |
pip3 install tempita | |
pip3 install cython | |
pip3 install numpy scipy numba astropy | |
python setup.py develop | |
brew install sphinx-doc pandoc | |
pip3 install wheel | |
pip3 install mock recommonmark | |
pip3 install sphinx-rtd-dark-mode | |
pip3 install -U sphinx | |
sphinx-apidoc -f -o docs/api/ astromodels | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: api-stubs-for-${{ github.sha }} | |
path: docs/api | |
build_docs: | |
name: "Build the Documentation" | |
runs-on: macos-latest | |
needs: [notebooks, api_doc] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install package | |
run: | | |
brew install c-blosc | |
brew install hdf5 | |
pip3 install tempita | |
pip3 install numpy scipy numba astropy | |
brew install sphinx-doc pandoc | |
pip3 install wheel | |
pip3 install mock recommonmark | |
pip3 install sphinx-rtd-dark-mode sphinx-math-dollar | |
pip3 install -r docs/requirements.txt | |
python3 setup.py develop | |
rm -rf docs/md/* | |
- uses: actions/download-artifact@master | |
with: | |
name: notebooks-for-${{ github.sha }} | |
path: docs/notebooks | |
- uses: actions/download-artifact@master | |
with: | |
name: api-stubs-for-${{ github.sha }} | |
path: docs/notebooks/api | |
- name: Build and Commit | |
uses: sphinx-notes/pages@v2 | |
with: | |
documentation_path: docs | |
sphinx_version: 5.1.1 | |
requirements_path: docs/requirements.txt | |
- name: Push changes | |
if: github.event_name == 'push' #&& startsWith(github.event.ref, 'refs/tags') | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |