@@ -10,11 +10,19 @@ on: # Trigger the workflow on push or pull request
1010
1111concurrency :
1212 group : ${{ github.workflow }}-${{ github.head_ref }}
13- cancel-in-progress : true
13+ cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
14+
15+ defaults :
16+ run :
17+ shell : bash
1418
1519jobs :
16- build -docs :
20+ make -docs :
1721 runs-on : ubuntu-latest
22+ strategy :
23+ fail-fast : false
24+ matrix :
25+ check : ["html", "linkcheck"]
1826 env :
1927 PUB_BRANCH : publication
2028 PATH_DATASETS : ${{ github.workspace }}/.datasets
@@ -35,16 +43,17 @@ jobs:
3543 key : pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('_requirements/docs.txt') }}
3644 restore-keys : pip-
3745
38- - name : Install dependencies
46+ - name : Install Texlive & tree
3947 run : |
4048 sudo apt-get update --fix-missing
41- sudo apt-get install -y tree
4249 # install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux
43- sudo apt-get install -y cmake pandoc texlive-latex-extra dvipng texlive-pictures
50+ sudo apt-get install -y cmake tree pandoc texlive-latex-extra dvipng texlive-pictures
51+
52+ - name : Install dependencies
53+ run : |
4454 pip --version
4555 pip install -q -r requirements.txt -r _requirements/docs.txt
4656 pip list
47- shell : bash
4857
4958 - name : Process folders
5059 run : |
@@ -54,21 +63,21 @@ jobs:
5463 python .actions/assistant.py group-folders master-diff.txt
5564 printf "Changed folders:\n"
5665 cat changed-folders.txt
57- shell : bash
5866
59- - name : " >> output"
60- id : changed
61- run : python -c "lines = open('changed-folders.txt').readlines(); print(f'::set-output name=nb_dirs::{len(lines)}')"
67+ - name : Count changed notebooks
68+ run : python -c "lines = open('changed-folders.txt').readlines(); print(f'NB_DIRS={len(lines)}')" >> $GITHUB_ENV
6269
6370 - uses : oleksiyrudenko/gha-git-credentials@v2.1
6471 with :
65- token : " ${{ secrets.GITHUB_TOKEN }}"
72+ token : ${{ secrets.GITHUB_TOKEN }}
6673 global : true
6774 - name : Sync to pub
6875 run : git merge -s resolve origin/$PUB_BRANCH
6976
7077 - name : Generate notebooks
71- if : steps.changed.outputs.nb_dirs != 0
78+ if : ${{ env.NB_DIRS != 0 }}
79+ env :
80+ DRY_RUN : 1
7281 run : |
7382 # second half with || [...] is needed for reading the last line
7483 while read -r line || [ -n "$line" ]; do
7786 cat .actions/_ipynb-render.sh
7887 bash .actions/_ipynb-render.sh
7988 done <<< $(cat changed-folders.txt)
80- env :
81- DRY_RUN : 1
82- shell : bash
8389
8490 - name : Copy notebooks
85- if : steps.changed.outputs.nb_dirs != 0
91+ if : ${{ env.NB_DIRS != 0 }}
8692 run : |
8793 # second half with || [...] is needed for reading the last line
8894 while read -r line || [ -n "$line" ]; do
@@ -91,22 +97,26 @@ jobs:
9197 cp .notebooks/${line}.ipynb changed-notebooks/${dir}/
9298 done <<< $(cat changed-folders.txt)
9399 tree changed-notebooks
94- shell : bash
95100
96101 - uses : actions/upload-artifact@v3
97- if : steps.changed.outputs.nb_dirs != 0
102+ if : ${{ matrix.check == 'html' && env.NB_DIRS != 0 }}
98103 with :
99104 name : notebooks-${{ github.sha }}
100105 path : changed-notebooks/
101106
107+ - name : Link check
108+ working-directory : ./_docs
109+ if : ${{ matrix.check == 'linkcheck' }}
110+ run : make linkcheck --jobs $(nproc) --debug SPHINXOPTS="--keep-going"
111+
102112 - name : Make Documentation
103113 working-directory : ./_docs
104- run : make html --jobs $(nproc) --debug SPHINXOPTS="-W --keep-going" linkcheck
114+ if : ${{ matrix.check == 'html' }}
115+ run : make html --jobs $(nproc) --debug SPHINXOPTS="-W --keep-going"
105116
106117 - name : Upload built docs
118+ if : ${{ matrix.check == 'html' }}
107119 uses : actions/upload-artifact@v3
108120 with :
109121 name : docs-html-${{ github.sha }}
110122 path : _docs/build/html/
111- # Use always() to always run this step to publish test results when there are test failures
112- if : success()
0 commit comments