@@ -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@v3
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@v2
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@102916131ac71e9c7ad6fa9d98fed2c9d86722e6 # v1.1.0
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,30 +56,30 @@ jobs:
5556 fail-fast : false
5657 name : Run tests
5758 steps :
58- - uses : actions/checkout@v3
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 : |
74- # for some reason, need to run this in the TESTS dir in order to get
75- # coverage to work (I couldn't get an analogous .coveragerc working in
76- # the root directory)
77- cd TESTS && coverage run unitTests.py
78- # generate the xml file and move it to root dir for codecov
79- coverage xml -o ../coverage.xml
80- - name : Upload coverage to Codecov
81- uses : codecov/codecov-action@v3
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
8283 all_tutorials_in_docs :
8384 runs-on : ubuntu-latest
8485 name : Check that all tutorial notebooks are included in docs
@@ -87,30 +88,31 @@ jobs:
8788 matrix :
8889 notebook : ${{fromJson(needs.get_notebooks.outputs.notebook)}}
8990 steps :
90- - uses : actions/checkout@v3
91- - name : Check for file
92- shell : bash
93- 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
9496 no_extra_nblinks :
9597 runs-on : ubuntu-latest
9698 name : Check that we don't have any extra nblink files
9799 steps :
98- - uses : actions/checkout@v3
99- - name : Check same number of nblink and notebooks
100- shell : bash
101- run : |
102- n_nblink=0; for file in docs/tutorials/*nblink; do let "n_nblink+=1"; done;
103- n_ipynb=0; for file in TUTORIALS/*ipynb; do let "n_ipynb+=1"; done;
104- 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;
105107
106108 check :
107109 if : always()
108110 needs :
109- - notebooks
110- - tests
111+ - notebooks
112+ - tests
111113 runs-on : ubuntu-latest
112114 steps :
113- - name : Decide whether all tests and notebooks succeeded
114- uses : re-actors/alls-green@release/v1
115- with :
116- 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