1
1
# 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
3
3
#
4
4
name : Test
5
5
@@ -23,109 +23,145 @@ on:
23
23
- " pre-commit-ci-update-config"
24
24
workflow_dispatch :
25
25
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
+
26
32
jobs :
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
+
27
61
test :
62
+ name : ${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.pip-extras }}
63
+ needs : [build]
28
64
timeout-minutes : 30
65
+ runs-on : ${{ matrix.os }}
66
+ defaults :
67
+ run :
68
+ shell : bash # windows default isn't bash
69
+
29
70
strategy :
30
71
fail-fast : false
31
72
matrix :
73
+ os : [ubuntu-22.04, windows-2022]
32
74
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"]
45
76
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
53
85
54
86
steps :
55
- - uses : actions/checkout@v3
87
+ - uses : actions/checkout@v4
56
88
57
89
- uses : actions/setup-python@v4
58
90
with :
59
91
python-version : " ${{ matrix.python-version }}"
60
92
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
-
68
93
- name : Update root build packages
69
- run : |
70
- pip install --upgrade build pip
94
+ run : pip install --upgrade pip
71
95
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
75
101
76
102
- name : Install Python package
77
103
# NOTE: See CONTRIBUTING.md for a local development setup that differs
78
104
# slightly from this.
79
105
#
80
106
# Pytest options are set in `pyproject.toml`.
81
107
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 }}\]
83
109
84
110
- name : List Python packages
85
111
run : |
86
112
pip freeze
87
113
pip check
88
114
89
- - name : Run tests
115
+ - name : Check server extension for jupyter_server
90
116
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" -
102
119
103
- - name : Check the Notebook Server extension is installed
120
+ - name : Check server extension for notebook v6
121
+ if : contains(matrix.pip-extras, 'classic')
104
122
run : |
105
123
jupyter serverextension list
106
124
jupyter serverextension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
107
125
108
- - name : Check the Jupyter Server extension is installed
126
+ - name : Check frontend extension for notebook v6
127
+ if : contains(matrix.pip-extras, 'classic')
109
128
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"
113
131
114
- - name : Check the lab extension
132
+ - name : Check frontend extension for notebook v7+
133
+ if : ${{ !contains(matrix.pip-extras, 'classic') }}
115
134
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.*'
119
137
120
- - name : Run acceptance tests
138
+ - name : Check frontend extension for jupyterlab
121
139
run : |
122
- pytest -s -k "acceptance"
140
+ jupyter lab extension list
141
+ jupyter lab extension list 2>&1 | grep -iE 'jupyter_server_proxy.*OK.*'
123
142
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
125
154
if : always()
126
155
uses : actions/upload-artifact@v3
127
156
with :
128
157
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 }}
130
159
path : |
160
+ ./build/pytest
161
+ ./build/coverage
131
162
./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