-
Notifications
You must be signed in to change notification settings - Fork 192
235 lines (229 loc) · 6.68 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: CI
on:
push:
branches: [master]
pull_request:
branches: '*'
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
PYTHONUNBUFFERED: 1
PYTHONIOENCODING: utf-8
CACHE_EPOCH: 0
defaults:
run:
shell: bash -l {0}
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Cache pip packages
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-build-${{ hashFiles('setup.py', 'pyproject.toml') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-build-
- name: Install installation dependencies
run: |
set -eux
python -m pip install -vv -U --user pip wheel setuptools
yarn --version || npm install -g yarn
- name: Install packaging dependencies
run: |
set -eux
python -m pip install -vv 'jupyterlab~=3.0'
- name: Pre-install node dependencies
run: |
set -eux
cd js
yarn --ignore-optional
- name: Build sdist
run: python setup.py sdist
- name: Build wheel
run: python setup.py bdist_wheel
- name: Collect and hash distributions
run: |
set -eux
cp js/lab-dist/jupyter-threejs-*.tgz dist
cd dist
sha256sum * | tee SHA256SUMS
- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist
docs:
name: docs
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Install apt dependencies
run: |
set -eux
sudo apt install pandoc
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install installation dependencies
run: |
set -eux
python -m pip install -vv -U --user pip wheel setuptools
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Install package and docs dependencies
run: |
set -eux
pip install -vv -U -e .[docs,examples,test] requests_cache
- name: Validate docs environment
run: |
set -eux
pip freeze
pip check
- name: Build docs
run: |
set -eux
cd docs
make html
- name: Upload docs
uses: actions/upload-artifact@v2
with:
name: docs ${{ github.run_number }}
path: ./docs/build
- name: Get current date
id: date
run: |
echo "::set-output name=year::$(date +'%Y')"
echo "::set-output name=week::$(date +'%U')"
- name: Cache links
uses: actions/cache@v1
with:
path: ./build/links
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-links-${{ steps.date.outputs.year }}-${{ steps.date.outputs.week }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-links-${{ steps.date.outputs.year }}-
${{ env.CACHE_EPOCH }}-${{ runner.os }}-links-
- name: Check links
run: |
set -eux
mkdir -p build/links/cache
pytest-check-links --check-links-cache --check-links-cache-name ./build/links/cache
test:
name: test ${{ matrix.os }}${{ matrix.python }} ${{ matrix.node }} ${{ matrix.lab }}
needs: [build]
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python: [3.7, 3.8, 3.9, 3.10]
include:
- python: 3.7
dist: 'pythreejs*.tar.gz'
node: 14
lab: 2
- python: 3.8
dist: 'pythreejs*.whl'
node: 14
lab: 2
- python: 3.9
node: 16
dist: 'pythreejs*.whl'
lab: 3
- python: 3.10
dist: 'pythreejs*.whl'
lab: 3
- os: windows
py_cmd: python
- os: macos
py_cmd: python3
- os: ubuntu
py_cmd: python
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.8
- if: ${{ matrix.node }}
name: Set up node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist
- name: Install installation dependencies
run: |
set -eux
${{ matrix.py_cmd }} -m pip install -vv --user -U pip wheel setuptools
- name: Install package
run: |
set -eux
cd dist
${{ matrix.py_cmd }} -m pip install -vv ${{ matrix.dist }}
- name: Validate environment
run: |
set -eux
${{ matrix.py_cmd }} -m pip freeze
${{ matrix.py_cmd }} -m pip check
- if: ${{ matrix.lab }}
name: Install JupyterLab
run: |
set -eux
${{ matrix.py_cmd }} -m pip install -vv 'jupyterlab==${{ matrix.lab }}.*'
- name: Install test dependencies
# explicit file installs don't support extras, skimage brings most along
run: |
set -eux
${{ matrix.py_cmd }} -m pip install -vv nbval scikit-image ipywebrtc pytest-cov codecov matplotlib
- name: Run python tests
# remove the source directory to avoid surprises
run: |
set -eux
rm -rf pythreejs
${{ matrix.py_cmd }} -m pytest -vv -l --nbval-lax --current-env . --cov pythreejs --cov-report term-missing:skip-covered --no-cov-on-fail
- name: Upload coverage
run: |
set -eux
codecov
- name: Check notebook extension
run: |
set -eux
jupyter nbextension list
jupyter nbextension list 2>&1 | grep -ie "jupyter-threejs/extension.*enabled" -
- if: ${{ matrix.node }}
name: Install lab extension
run: |
set -eux
jupyter labextension install --no-build --debug ./dist/*.tgz @jupyter-widgets/jupyterlab-manager
- if: ${{ matrix.node }}
name: Build lab
run: |
set -eux
jupyter lab build --debug
- if: ${{ matrix.lab }}
name: Check lab extension
run: |
set -eux
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter-threejs.*enabled.*ok" -