Skip to content

Commit

Permalink
Introduce caching in docs wokflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannis-vm committed Sep 16, 2024
1 parent 12db8be commit 92c116e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,39 @@ jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: '3.10'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y pandoc
python -m pip install sphinx sphinx_design sphinx-rtd-theme sphinxcontrib-bibtex numpydoc
python -m pip install -r requirements.txt
- name: Compute cache key
id: compute-cache-key
run: |
cd doc/source/_extensions
key=$(python compute_global_hash.py)
cd ../../../
echo "key=$key" >> $GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache@v3
with:
path: doc/cache
key: ${{ steps.compute-cache-key.outputs.key }}

- name: Build docs
run: cd doc && make html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/build/html
publish_dir: doc/build/html
7 changes: 7 additions & 0 deletions doc/source/_extensions/compute_global_hash.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from generate_dl_doc import generate_md5, combine_md5_hashes
from pathlib import Path

resource_folder = Path('../../../')
dlmls = resource_folder.rglob('*.csv')
hashes = [generate_md5(dlml) for dlml in dlmls]
print(combine_md5_hashes(hashes))
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ sphinx_design
sphinx-rtd-theme
sphinxcontrib-bibtex
numpydoc
tqdm

0 comments on commit 92c116e

Please sign in to comment.