11# This is a GitHub workflow defining a set of jobs with a set of steps.
2- # ref: https://docs.github.com/en/actions/learn-github-actions /workflow-syntax-for-github-actions
2+ # ref: https://docs.github.com/en/actions/using-workflows /workflow-syntax-for-github-actions
33#
44name : Test
55
@@ -23,109 +23,145 @@ on:
2323 - " pre-commit-ci-update-config"
2424 workflow_dispatch :
2525
26+ env :
27+ # avoid warnings about config paths
28+ JUPYTER_PLATFORM_DIRS : " 1"
29+ # avoid looking at every version of pip ever released
30+ PIP_DISABLE_PIP_VERSION_CHECK : " 1"
31+
2632jobs :
33+ build :
34+ runs-on : ubuntu-22.04
35+ steps :
36+ - uses : actions/checkout@v4
37+
38+ - uses : actions/setup-python@v4
39+ with :
40+ python-version : " 3.11"
41+
42+ - uses : actions/setup-node@v3
43+ with :
44+ cache : yarn
45+ node-version : 20.x
46+ registry-url : https://registry.npmjs.org
47+ cache-dependency-path : labextension/yarn.lock
48+
49+ - name : Update root build packages
50+ run : pip install --upgrade build
51+
52+ - name : Build Python package
53+ run : pyproject-build
54+
55+ - name : Upload built artifacts
56+ uses : actions/upload-artifact@v3
57+ with :
58+ name : dist-${{ github.run_number }}
59+ path : ./dist
60+
2761 test :
62+ name : ${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.pip-extras }}
63+ needs : [build]
2864 timeout-minutes : 30
65+ runs-on : ${{ matrix.os }}
66+ defaults :
67+ run :
68+ shell : bash # windows default isn't bash
69+
2970 strategy :
3071 fail-fast : false
3172 matrix :
73+ os : [ubuntu-22.04, windows-2022]
3274 python-version : ["3.8", "3.11"]
33- jupyter_server-version : ["1", "2"]
34- jupyterlab-version : ["3", "4"]
35- os : [ubuntu-22.04]
36- include :
37- - python-version : " 3.11"
38- jupyter_server-version : " 2"
39- jupyterlab-version : " 3"
40- os : windows-2022
41- - python-version : " 3.11"
42- jupyter_server-version : " 2"
43- jupyterlab-version : " 4"
44- os : windows-2022
75+ pip-extras : ["lab", "classic"]
4576 exclude :
46- - jupyter_server-version : " 1"
47- jupyterlab-version : " 4"
48-
49- runs-on : ${{ matrix.os }}
50- defaults :
51- run :
52- shell : bash
77+ # windows should work for all test variations, but a limited selection
78+ # is run to avoid doubling the amount of test runs
79+ - os : windows-2022
80+ python-version : " 3.11"
81+ pip-extras : classic
82+ - os : windows-2022
83+ python-version : " 3.8"
84+ pip-extras : lab
5385
5486 steps :
55- - uses : actions/checkout@v3
87+ - uses : actions/checkout@v4
5688
5789 - uses : actions/setup-python@v4
5890 with :
5991 python-version : " ${{ matrix.python-version }}"
6092
61- - uses : actions/setup-node@v3
62- with :
63- cache : yarn
64- node-version : 18.x
65- registry-url : https://registry.npmjs.org
66- cache-dependency-path : labextension/yarn.lock
67-
6893 - name : Update root build packages
69- run : |
70- pip install --upgrade build pip
94+ run : pip install --upgrade pip
7195
72- - name : Build Python package
73- run : |
74- pyproject-build
96+ - name : Download built artifacts
97+ uses : actions/download-artifact@v3
98+ with :
99+ name : dist-${{ github.run_number }}
100+ path : ./dist
75101
76102 - name : Install Python package
77103 # NOTE: See CONTRIBUTING.md for a local development setup that differs
78104 # slightly from this.
79105 #
80106 # Pytest options are set in `pyproject.toml`.
81107 run : |
82- pip install -vv $(ls ./dist/jupyter_server_proxy- *.whl)\[acceptance\] 'jupyterlab~= ${{ matrix.jupyterlab-version }}.0' 'jupyter_server~=${{ matrix.jupyter_server-version }}.0'
108+ pip install -vv $(ls ./dist/*.whl)\[acceptance, ${{ matrix.pip-extras }}\]
83109
84110 - name : List Python packages
85111 run : |
86112 pip freeze
87113 pip check
88114
89- - name : Run tests
115+ - name : Check server extension for jupyter_server
90116 run : |
91- pytest -k "not acceptance" -vv
92-
93- - name : Upload pytest and coverage reports
94- if : always()
95- uses : actions/upload-artifact@v3
96- with :
97- name : |-
98- unit-tests-${{ matrix.python-version }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
99- path : |
100- ./build/pytest
101- ./build/coverage
117+ jupyter server extension list
118+ jupyter server extension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
102119
103- - name : Check the Notebook Server extension is installed
120+ - name : Check server extension for notebook v6
121+ if : contains(matrix.pip-extras, 'classic')
104122 run : |
105123 jupyter serverextension list
106124 jupyter serverextension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
107125
108- - name : Check the Jupyter Server extension is installed
126+ - name : Check frontend extension for notebook v6
127+ if : contains(matrix.pip-extras, 'classic')
109128 run : |
110- pip install jupyter-server
111- jupyter server extension list
112- jupyter server extension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
129+ jupyter nbextension list
130+ PYTHONUNBUFFERED=1 jupyter nbextension list 2>&1 | grep -A1 -iE '.*jupyter_server_proxy.*enabled' | grep -B1 -iE "Validating.*OK"
113131
114- - name : Check the lab extension
132+ - name : Check frontend extension for notebook v7+
133+ if : ${{ !contains(matrix.pip-extras, 'classic') }}
115134 run : |
116- jupyter labextension list
117- jupyter labextension list 2>&1 | grep -iE '@jupyterhub/jupyter-server-proxy.*OK.*'
118- python -m jupyterlab.browser_check
135+ jupyter notebook extension list
136+ jupyter notebook extension list 2>&1 | grep -iE 'jupyter_server_proxy.*OK.*'
119137
120- - name : Run acceptance tests
138+ - name : Check frontend extension for jupyterlab
121139 run : |
122- pytest -s -k "acceptance"
140+ jupyter lab extension list
141+ jupyter lab extension list 2>&1 | grep -iE 'jupyter_server_proxy.*OK.*'
123142
124- - name : Upload acceptance test reports
143+ # we have installed a pre-built wheel and configured code coverage to
144+ # inspect "jupyter_server_proxy", by re-locating to another directory,
145+ # there is no confusion about "jupyter_server_proxy" referring to our
146+ # installed package rather than the local directory
147+ - name : Run tests
148+ run : |
149+ mkdir build
150+ cd build
151+ pytest -c ../pyproject.toml ../tests
152+
153+ - name : Upload test reports
125154 if : always()
126155 uses : actions/upload-artifact@v3
127156 with :
128157 name : |-
129- acceptance- tests-${{ matrix.python-version }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
158+ tests-${{ matrix.os }}-${{ matrix. python-version }}-${{ matrix.pip-extras }}-${{ github.run_number }}
130159 path : |
160+ ./build/pytest
161+ ./build/coverage
131162 ./build/robot
163+
164+ # GitHub action reference: https://github.com/codecov/codecov-action
165+ - uses : codecov/codecov-action@v3
166+ with :
167+ directory : build/.coverage
0 commit comments