@@ -2,13 +2,13 @@ name: build
22on :
33 workflow_dispatch :
44 schedule :
5- - cron : " 0 0 * * 0" # weekly
5+ - cron : 0 0 * * 0 # weekly
66 pull_request :
77 branches :
8- - main
8+ - main
99 push :
1010 branches :
11- - main
11+ - main
1212
1313jobs :
1414 # based on https://slashgear.github.io/how-to-split-test-by-folder-with-github-action/
@@ -17,10 +17,11 @@ jobs:
1717 outputs :
1818 notebook : ${{ steps.get-notebooks.outputs.nb }}
1919 steps :
20- - uses : actions/checkout@v3
21- - id : get-notebooks
20+ - uses : actions/checkout@v3
21+ - id : get-notebooks
2222 # it's weird to me, but the quotes around \n should *not* be escaped or it breaks
23- run : echo "::set-output name=nb::$(ls TUTORIALS/*ipynb | jq -R -s -c 'split("\n")[:-1]')"
23+ run : " echo \" nb=$(ls TUTORIALS/*ipynb | jq -R -s -c 'split(\"\\ n\" )[:-1]')\" \
24+ \ >> $GITHUB_OUTPUT\n "
2425 notebooks :
2526 runs-on : ubuntu-latest
2627 needs : [get_notebooks]
@@ -31,22 +32,22 @@ jobs:
3132 fail-fast : false
3233 name : Execute notebooks
3334 steps :
34- - uses : actions/checkout@v2
35- - uses : actions/setup-python@v2
36- with :
37- python-version : ${{ matrix.python-version }}
38- cache : pip
39- cache-dependency-path : setup.py
40- - name : Setup FFmpeg
41- uses : FedericoCarboni/setup-ffmpeg@v1
42- - name : Install dependencies
35+ - uses : actions/checkout@v3
36+ - uses : actions/setup-python@v4
37+ with :
38+ python-version : ${{ matrix.python-version }}
39+ cache : pip
40+ cache-dependency-path : setup.py
41+ - name : Setup FFmpeg
42+ uses : FedericoCarboni/setup-ffmpeg@v2
43+ - name : Install dependencies
4344 # nbclient 0.5.5 is the first version that includes jupyter execute
44- run : |
45- pip install --upgrade --upgrade-strategy eager .
46- pip install jupyter ipywidgets
47- pip install "nbclient>=0.5.5"
48- - name : Run notebooks
49- run : " jupyter execute ${{ matrix.notebook }}.ipynb --kernel_name=python3"
45+ run : |
46+ pip install --upgrade --upgrade-strategy eager .
47+ pip install jupyter ipywidgets
48+ pip install "nbclient>=0.5.5"
49+ - name : Run notebooks
50+ run : jupyter execute ${{ matrix.notebook }}.ipynb --kernel_name=python3
5051 tests :
5152 runs-on : ubuntu-latest
5253 strategy :
@@ -55,24 +56,30 @@ jobs:
5556 fail-fast : false
5657 name : Run tests
5758 steps :
58- - uses : actions/checkout@v2
59- - name : Install Python 3
60- uses : actions/setup-python@v2
61- with :
62- python-version : ${{ matrix.python-version }}
63- cache : pip
64- cache-dependency-path : setup.py
65- - name : Install dependencies
66- run : |
67- # using the --upgrade and --upgrade-strategy eager flags ensures that
68- # pip will always install the latest allowed version of all
69- # dependencies, to make sure the cache doesn't go stale
70- pip install --upgrade --upgrade-strategy eager .
71- pip install coverage
72- - name : Run tests
73- run : ' coverage run TESTS/unitTests.py'
74- - name : Upload to codecov
75- run : ' bash <(curl -s https://codecov.io/bash)'
59+ - uses : actions/checkout@v3
60+ - name : Install Python 3
61+ uses : actions/setup-python@v4
62+ with :
63+ python-version : ${{ matrix.python-version }}
64+ cache : pip
65+ cache-dependency-path : setup.py
66+ - name : Install dependencies
67+ run : |
68+ # using the --upgrade and --upgrade-strategy eager flags ensures that
69+ # pip will always install the latest allowed version of all
70+ # dependencies, to make sure the cache doesn't go stale
71+ pip install --upgrade --upgrade-strategy eager .
72+ pip install coverage
73+ - name : Run tests
74+ run : |
75+ # for some reason, need to run this in the TESTS dir in order to get
76+ # coverage to work (I couldn't get an analogous .coveragerc working in
77+ # the root directory)
78+ cd TESTS && coverage run unitTests.py
79+ # generate the xml file and move it to root dir for codecov
80+ coverage xml -o ../coverage.xml
81+ - name : Upload coverage to Codecov
82+ uses : codecov/codecov-action@858dd794fbb81941b6d60b0dca860878cba60fa9 # v3.1.1
7683 all_tutorials_in_docs :
7784 runs-on : ubuntu-latest
7885 name : Check that all tutorial notebooks are included in docs
@@ -81,30 +88,31 @@ jobs:
8188 matrix :
8289 notebook : ${{fromJson(needs.get_notebooks.outputs.notebook)}}
8390 steps :
84- - uses : actions/checkout@v2
85- - name : Check for file
86- shell : bash
87- run : if [[ -z "$(grep ${{ matrix.notebook }} docs/tutorials/*nblink)" ]] ; then exit 1; fi
91+ - uses : actions/checkout@v3
92+ - name : Check for file
93+ shell : bash
94+ run : if [[ -z "$(grep ${{ matrix.notebook }} docs/tutorials/*nblink)" ]] ; then
95+ exit 1; fi
8896 no_extra_nblinks :
8997 runs-on : ubuntu-latest
9098 name : Check that we don't have any extra nblink files
9199 steps :
92- - uses : actions/checkout@v2
93- - name : Check same number of nblink and notebooks
94- shell : bash
95- run : |
96- n_nblink=0; for file in docs/tutorials/*nblink; do let "n_nblink+=1"; done;
97- n_ipynb=0; for file in TUTORIALS/*ipynb; do let "n_ipynb+=1"; done;
98- if [[ $n_nblink != $n_ipynb ]]; then exit 1; fi;
100+ - uses : actions/checkout@v3
101+ - name : Check same number of nblink and notebooks
102+ shell : bash
103+ run : |
104+ n_nblink=0; for file in docs/tutorials/*nblink; do let "n_nblink+=1"; done;
105+ n_ipynb=0; for file in TUTORIALS/*ipynb; do let "n_ipynb+=1"; done;
106+ if [[ $n_nblink != $n_ipynb ]]; then exit 1; fi;
99107
100108 check :
101109 if : always()
102110 needs :
103- - notebooks
104- - tests
111+ - notebooks
112+ - tests
105113 runs-on : ubuntu-latest
106114 steps :
107- - name : Decide whether all tests and notebooks succeeded
108- uses : re-actors/alls-green@release/v1
109- with :
110- jobs : ${{ toJSON(needs) }}
115+ - name : Decide whether all tests and notebooks succeeded
116+ uses : re-actors/alls-green@afee1c1eac2a506084c274e9c02c8e0687b48d9e # v1.2.2
117+ with :
118+ jobs : ${{ toJSON(needs) }}
0 commit comments