-
Notifications
You must be signed in to change notification settings - Fork 18
287 lines (233 loc) · 8.17 KB
/
build.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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: CI
on:
push:
branches: [master, 2.x]
pull_request:
branches: [master, 2.x]
env:
CACHE_EPOCH: 1
jobs:
build:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu]
python-version: [3.9]
node-version: [14.x]
lab-version: [3]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Cache JS
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: |
${{ env.CACHE_EPOCH }}-node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock', '.yarnrc') }}
- name: Install Python Setup Dependencies
run: python -m pip install --upgrade pip wheel setuptools
- name: Get Python Cache
id: cache-pip
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache Python Dependencies
uses: actions/cache@v2
with:
path: ${{ steps.cache-pip.outputs.dir }}
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-build-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'setup.cfg') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-build-${{ matrix.python-version }}-
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-
- name: Install Python Packaging Dependencies
run: python -m pip install 'jupyterlab==${{ matrix.lab-version }}.*' twine
- name: Install JS Dependencies
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: jlpm --prefer-offline --frozen-lockfile
- name: Build JS Library
run: jlpm build:lib
- name: Build JupyterLab Extension
run: jlpm build:labextension
- name: Build PyPI Distributions
run: python setup.py sdist bdist_wheel
- name: Validate Python Distributions
run: twine check dist/*
- name: Collect JS Distribution
run: |
set -eux
cd dist && npm pack ..
- name: Hash Distributions
run: |
set -eux
cd dist
sha256sum * | tee SHA256SUMS
- name: Upload Distributions
uses: actions/upload-artifact@v2
with:
name: pull-requests dist ${{ github.run_number }}
path: ./dist
lint:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu]
python-version: [3.9]
node-version: [14.x]
lab-version: [3]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Cache JS
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: |
${{ env.CACHE_EPOCH }}-node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock', '.yarnrc') }}
- name: Install Python Setup Dependencies
run: python -m pip install --upgrade pip wheel setuptools
- name: Get Python Cache
id: cache-pip
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache Python Dependencies
uses: actions/cache@v2
with:
path: ${{ steps.cache-pip.outputs.dir }}
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-lint-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'setup.cfg') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-lint-${{ matrix.python-version }}-
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-
- name: Install Setup Dependencies
run: python -m pip install 'jupyterlab==${{ matrix.lab-version }}.*'
- name: Install JS Dependencies
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: jlpm --prefer-offline --frozen-lockfile
- name: Build JS
run: jlpm build
- name: Install Python Lint/Test Dependencies
run: python -m pip install -e '.[coverage]'
- name: Lint JS
run: jlpm eslint:check
- name: Unit Test Server Extension
run: |
set -eux
python -m pytest --pyargs jupyterlab_pullrequests --cov jupyterlab_pullrequests --cov-report term-missing:skip-covered --no-cov-on-fail
- name: Unit Test JS
run: jlpm test
- name: Upload Coverage
run: codecov
install:
runs-on: ${{ matrix.os }}-latest
needs: [build]
strategy:
# TODO: possibly put back
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: [3.6, 3.9, pypy3]
lab-version: [3]
include:
# cover artifacts
- python-version: 3.6
dist: jupyterlab_pullrequests*.tar.gz
- python-version: 3.9
dist: jupyterlab_pullrequests*.whl
- python-version: pypy3
dist: jupyterlab_pullrequests*.tar.gz
# platform-specific pythons
- os: windows
py-cmd: python
shell: cmd
- os: macos
py-cmd: python3
shell: bash
- os: ubuntu
py-cmd: python
shell: bash
exclude:
# pyzmq fails to install
- os: macos
python-version: pypy3
# not supported
- os: windows
python-version: pypy3
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install Setup Dependencies
run: ${{ matrix.py-cmd }} -m pip install --upgrade pip wheel setuptools
- name: Download Distributions
uses: actions/download-artifact@v2
with:
name: pull-requests dist ${{ github.run_number }}
path: ./dist
- name: Get Python Cache Location and Distribution
id: cache-pip
shell: bash -l {0}
run: |
set -eux
echo "::set-output name=dir::$(${{ matrix.py-cmd }} -m pip cache dir)"
echo "::set-output name=pydist::$(ls ./dist/${{ matrix.dist }})"
- name: Cache Python Dependencies
uses: actions/cache@v2
with:
path: ${{ steps.cache-pip.outputs.dir }}
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-install-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'setup.cfg') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-install-${{ matrix.python-version }}-
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-
- name: Install Package
run: ${{ matrix.py-cmd }} -m pip install ${{ steps.cache-pip.outputs.pydist }}
- name: List Python Environment
run: ${{ matrix.py-cmd }} -m pip freeze
- name: Validate Python Environment
run: ${{ matrix.py-cmd }} -m pip check
- name: List Server Extensions
run: |
jupyter serverextension list > serverextensions.txt 2>&1
jupyter server extension list > server_extensions.txt 2>&1
- name: Validate Server Extension
shell: bash -l {0}
run: |
cat serverextensions.txt
cat serverextensions.txt | grep -ie "jupyterlab_pullrequests.*enabled"
cat server_extensions.txt
cat server_extensions.txt | grep -ie "jupyterlab_pullrequests.*enabled"
- name: Install Python Test Dependencies
run: ${{ matrix.py-cmd }} -m pip install flaky "mock>=4.0.0" pytest-asyncio pytest-tornasync diff-match-patch
- name: Unit Test Server Extension
run: ${{ matrix.py-cmd }} -m pytest --pyargs jupyterlab_pullrequests -vv
- name: List JupyterLab Extensions
run: ${{ matrix.py-cmd }} -m jupyter labextension list > labextensions.txt 2>&1
- name: Validate JupyterLab Build
shell: bash -l {0}
run: |
cat labextensions.txt
cat labextensions.txt | grep -ie "jupyterlab/pullrequests.*enabled.*OK"
cat labextensions.txt | grep -v "jupyterlab/pullrequests needs to be included in build"