doc enhancements #492
Workflow file for this run
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: Build and Test code in notebooks | |
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
dir_names_max_depth: 0 | |
files: | | |
docs/source/*.rst | |
docs/source/**/*.rst | |
!docs/source/**/_templates | |
- uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: '3.1.2' | |
# - uses: actions/setup-python@v4 | |
# with: | |
# python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
- name: Installing Dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade pandocfilters jupyter | |
python3 -m pip install --upgrade -r requirements.txt | |
- name: Generating notebooks | |
run: | | |
pushd docs/source | |
./generate_ipynb.sh | |
popd | |
- name: Execute all notebooks generated from modified files | |
run: | | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
jupyter nbconvert --to notebook --inplace --execute ${file%.rst}.ipynb || (echo "${file%.rst}" >> failed_nbs.txt) | |
done | |
if [ -f "failed_nbs.txt" ]; then | |
echo "Some notebooks failed to run. Please check logs." | |
cat failed_nbs.txt | |
exit 1 | |
fi |