-
Notifications
You must be signed in to change notification settings - Fork 56
60 lines (48 loc) · 1.72 KB
/
test-pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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