|
1 |
| -name: Build and Test code in notebooks |
2 |
| - |
3 |
| -on: |
4 |
| - pull_request: |
5 |
| - branches: |
6 |
| - - master |
7 |
| - |
8 |
| -jobs: |
9 |
| - |
10 |
| - build-test: |
11 |
| - runs-on: ubuntu-latest |
12 |
| - |
13 |
| - steps: |
14 |
| - - uses: actions/checkout@v3 |
15 |
| - |
16 |
| - - uses: actions/setup-python@v4 |
17 |
| - with: |
18 |
| - python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax |
19 |
| - |
20 |
| - - name: Get changed files |
21 |
| - id: changed-files |
22 |
| - uses: tj-actions/changed-files@v41 |
23 |
| - with: |
24 |
| - dir_names_max_depth: 0 |
25 |
| - files: | |
26 |
| - docs/source/*.rst |
27 |
| - docs/source/**/*.rst |
28 |
| - !docs/source/**/_templates |
29 |
| - |
30 |
| - - uses: r-lib/actions/setup-pandoc@v2 |
31 |
| - with: |
32 |
| - pandoc-version: '3.1.2' |
33 |
| - |
34 |
| -# - uses: actions/setup-python@v4 |
35 |
| -# with: |
36 |
| -# python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax |
37 |
| - |
38 |
| - - name: Installing Dependencies |
39 |
| - run: | |
40 |
| - python3 -m pip install --upgrade pip |
41 |
| - python3 -m pip install --upgrade pandocfilters jupyter |
42 |
| - python3 -m pip install --upgrade -r requirements.txt |
43 |
| -
|
44 |
| - |
45 |
| - - name: Generating notebooks |
46 |
| - run: | |
47 |
| - pushd docs/source |
48 |
| - ./generate_ipynb.sh |
49 |
| - popd |
50 |
| -
|
51 |
| - - name: Execute all notebooks generated from modified files |
52 |
| - run: | |
53 |
| - for file in ${{ steps.changed-files.outputs.all_modified_files }}; do |
54 |
| - jupyter nbconvert --to notebook --inplace --execute ${file%.rst}.ipynb || (echo "${file%.rst}" >> failed_nbs.txt) |
55 |
| - done |
56 |
| - if [ -f "failed_nbs.txt" ]; then |
57 |
| - echo "Some notebooks failed to run. Please check logs." |
58 |
| - cat failed_nbs.txt |
59 |
| - exit 1 |
60 |
| - fi |
| 1 | +name: Build and Test code in notebooks |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + |
| 10 | + build-test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v3 |
| 15 | + |
| 16 | + - uses: actions/setup-python@v4 |
| 17 | + with: |
| 18 | + python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax |
| 19 | + |
| 20 | + - name: Get changed files |
| 21 | + id: changed-files |
| 22 | + uses: tj-actions/changed-files@v45 |
| 23 | + with: |
| 24 | + dir_names_max_depth: 0 |
| 25 | + files: | |
| 26 | + docs/source/*.rst |
| 27 | + docs/source/**/*.rst |
| 28 | + !docs/source/**/_templates |
| 29 | + |
| 30 | + - uses: r-lib/actions/setup-pandoc@v2 |
| 31 | + with: |
| 32 | + pandoc-version: '3.1.2' |
| 33 | + |
| 34 | +# - uses: actions/setup-python@v4 |
| 35 | +# with: |
| 36 | +# python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax |
| 37 | + |
| 38 | + - name: Installing Dependencies |
| 39 | + run: | |
| 40 | + python3 -m pip install --upgrade pip |
| 41 | + python3 -m pip install --upgrade pandocfilters jupyter |
| 42 | + python3 -m pip install --upgrade -r requirements.txt |
| 43 | +
|
| 44 | + |
| 45 | + - name: Generating notebooks |
| 46 | + run: | |
| 47 | + pushd docs/source |
| 48 | + ./generate_ipynb.sh |
| 49 | + popd |
| 50 | +
|
| 51 | + - name: Execute all notebooks generated from modified files |
| 52 | + run: | |
| 53 | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do |
| 54 | + jupyter nbconvert --to notebook --inplace --execute ${file%.rst}.ipynb || (echo "${file%.rst}" >> failed_nbs.txt) |
| 55 | + done |
| 56 | + if [ -f "failed_nbs.txt" ]; then |
| 57 | + echo "Some notebooks failed to run. Please check logs." |
| 58 | + cat failed_nbs.txt |
| 59 | + exit 1 |
| 60 | + fi |
0 commit comments