forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
427 lines (367 loc) · 16.2 KB
/
pr.yml
File metadata and controls
427 lines (367 loc) · 16.2 KB
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
name: Pull Request
on:
pull_request:
branches:
- main
- ci
check_run:
types: [rerequested, requested_action]
env:
NODE_VERSION: 12.15.0
PYTHON_VERSION: 3.8
MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). Also enables a reporter which exits the process running the tests if it haven't already.
CACHE_NPM_DEPS: cache-npm
CACHE_OUT_DIRECTORY: cache-out-directory
CACHE_PIP_DEPS: cache-pip
# Key for the cache created at the end of the the 'Cache ./pythonFiles/lib/python' step.
CACHE_PYTHONFILES: cache-pvsc-pythonFiles
ARTIFACT_NAME_VSIX: ms-ai-tools-jupyter-insiders-vsix
VSIX_NAME: ms-ai-tools-jupyter-insiders.vsix
COVERAGE_REPORTS: tests-coverage-reports
CI_PYTHON_PATH: python
TEST_RESULTS_DIRECTORY: .
jobs:
build-vsix:
name: Build VSIX
runs-on: ubuntu-latest
if: github.repository == 'microsoft/vscode-jupyter'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node ${{env.NODE_VERSION}}
uses: actions/setup-node@v2.1.1
with:
node-version: ${{env.NODE_VERSION}}
# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm)
- name: Cache npm on linux/mac
uses: actions/cache@v2
if: matrix.os != 'windows-latest'
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Get npm cache directory
if: matrix.os == 'windows-latest'
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm on windows
uses: actions/cache@v2
if: matrix.os == 'windows-latest'
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build VSIX
uses: ./.github/actions/build-vsix
id: build-vsix
- name: Rename VSIX
if: steps.build-vsix.outputs.path != env.VSIX_NAME
run: mv ${{ steps.build-vsix.outputs.path }} ${{ env.VSIX_NAME }}
- uses: actions/upload-artifact@v2
with:
name: ${{env.ARTIFACT_NAME_VSIX}}
path: ${{env.VSIX_NAME}}
lint:
name: Lint
runs-on: ubuntu-latest
if: github.repository == 'microsoft/vscode-jupyter'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache pip files
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{runner.os}}-${{env.CACHE_PIP_DEPS}}-${{env.PYTHON_VERSION}}
- name: Cache npm files
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
- name: Install dependencies (npm ci)
run: npm ci --prefer-offline
- name: Run linting on TypeScript code
run: npx tslint --project tsconfig.json
- name: Run prettier on TypeScript code
run: npx prettier 'src/**/*.ts*' --check
- name: Run prettier on JavaScript code
run: npx prettier 'build/**/*.js' --check
- name: Use Python ${{env.PYTHON_VERSION}}
uses: actions/setup-python@v2
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Run Black on Python code
run: |
python -m pip install -U black
python -m black . --check
working-directory: pythonFiles
- name: Run gulp prePublishNonBundle
run: npx gulp prePublishNonBundle
- name: Cache the out/ directory
uses: actions/cache@v2
with:
path: ./out
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}}
- name: Check dependencies
run: npm run checkDependencies
ts_tests:
name: Type Script Tests
runs-on: ${{ matrix.os }}
if: github.repository == 'microsoft/vscode-jupyter'
strategy:
fail-fast: false
matrix:
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the UNIX case.
os: [ubuntu-latest, windows-latest]
test-suite: [ts-unit]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node ${{env.NODE_VERSION}}
uses: actions/setup-node@v2.1.1
with:
node-version: ${{env.NODE_VERSION}}
# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm)
- name: Cache npm on linux/mac
uses: actions/cache@v2
if: matrix.os != 'windows-latest'
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Get npm cache directory
if: matrix.os == 'windows-latest'
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm on windows
uses: actions/cache@v2
if: matrix.os == 'windows-latest'
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache compiled TS files
# Use an id for this step so that its cache-hit output can be accessed and checked in the next step.
id: out-cache
uses: actions/cache@v2
with:
path: ./out
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}}
- name: Install dependencies (npm ci)
run: npm ci --prefer-offline
- name: Compile if not cached
run: npx gulp prePublishNonBundle
if: steps.out-cache.outputs.cache-hit == false
- name: Run TypeScript unit tests
run: npm run test:unittests:cover
tests:
name: Tests (with Python)
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
runs-on: ${{ matrix.os }}
# if: github.repository == 'microsoft/vscode-jupyter'
strategy:
fail-fast: false
matrix:
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the UNIX case.
os: [ubuntu-latest]
python: [3.8] # Use flaky tests to run against more versions of Python.
# python-unit: Python tests
# functional: Tests with mocked VS Code, & mocked Python)
# functional-with-jupyter: Tests with mocked VS Code & real jupyter
# single-workspace: Tests with VS Code
# integration: Tests with VS Code, Python extension & real Jupyter
test-suite: [python-unit, functional, test-based-on-pr-body]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Python ${{matrix.python}}
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python}}
- name: Upgrade pip
run: python -m pip install -U pip
- name: Use Node ${{env.NODE_VERSION}}
uses: actions/setup-node@v2.1.1
with:
node-version: ${{env.NODE_VERSION}}
# Start caching
# Cache Python Dependencies.
# Caching (https://github.com/actions/cache/blob/main/examples.md#python---pip
- name: Cache pip on linux
uses: actions/cache@v2
# if: startsWith(runner.os, 'Linux')
if: startsWith(matrix.test-suite, 'functional') && matrix.os == 'ubuntu-latest'
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}}
restore-keys: |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-
- name: Cache pip on mac
uses: actions/cache@v2
if: startsWith(matrix.test-suite, 'functional') && matrix.os == 'macos-latest'
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}}
restore-keys: |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-
- name: Cache pip on windows
uses: actions/cache@v2
# if: startsWith(runner.os, 'Windows')
if: startsWith(matrix.test-suite, 'functional') && matrix.os == 'windows-latest'
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-${{ hashFiles('requirements.txt') }}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('test-requirements.txt')}}-${{hashFiles('ipython-test-requirements.txt')}}-${{hashFiles('functional-test-requirements.txt')}}-${{hashFiles('conda-functional-requirements.txt')}}
restore-keys: |
${{ runner.os }}-pip-${{env.PYTHON_VERSION}}-
# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm)
- name: Cache npm on linux/mac
uses: actions/cache@v2
if: matrix.os != 'windows-latest'
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Get npm cache directory
if: matrix.os == 'windows-latest'
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm on windows
uses: actions/cache@v2
if: matrix.os == 'windows-latest'
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache compiled TS files
# Use an id for this step so that its cache-hit output can be accessed and checked in the next step.
id: out-cache
uses: actions/cache@v2
with:
path: ./out
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}}
# For faster/better builds of sdists.
- run: python -m pip install wheel
if: startsWith(matrix.test-suite, 'functional')
shell: bash
# debugpy is not shipped, only installed for local tests.
# In production, we get debugpy & LS from python extension.
- name: Install functional test requirements
run: |
python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt
python ./pythonFiles/install_debugpy.py
python -m pip install numpy
python -m pip install --upgrade -r build/test-requirements.txt
python -m pip install --upgrade -r ./build/ipython-test-requirements.txt
python -m pip install --upgrade -r ./build/conda-functional-requirements.txt
# This step is slow.
# If running the placeholder suite & not required to run any tests, then don't install python dependencies.
if: matrix.test-suite != 'test-based-on-pr-body' || contains(github.event.pull_request.body, '[x] Run ')
- name: Install dependencies (npm ci)
run: npm ci --prefer-offline
# This step is slow.
# If running the placeholder suite & not required to run any tests, then don't install python dependencies.
if: matrix.test-suite != 'test-based-on-pr-body' || contains(github.event.pull_request.body, '[x] Run ')
# Run the Python and IPython tests in our codebase.
- name: Run Python and IPython unit tests
run: |
python pythonFiles/tests/run_all.py
python -m IPython pythonFiles/tests/run_all.py
if: matrix.test-suite == 'python-unit'
- name: Compile if not cached
run: npx gulp prePublishNonBundle
if: steps.out-cache.outputs.cache-hit == false
- name: Run functional tests
run: npm run test:functional
if: matrix.test-suite == 'functional'
- name: Run single-workspace tests
env:
CI_PYTHON_VERSION: ${{matrix.python}}
uses: GabrielBB/xvfb-action@v1.4
with:
run: npm run testSingleWorkspace
if: matrix.test-suite == 'single-workspace' || (matrix.test-suite == 'test-based-on-pr-body' && github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[x] Run single-workspace test'))
- name: Run functional tests with Jupyter
run: npm run test:functional
env:
VSCODE_PYTHON_ROLLING: 1
VSC_PYTHON_FORCE_LOGGING: 1
if: matrix.test-suite == 'functional-with-jupyter' || (matrix.test-suite == 'test-based-on-pr-body' && github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[x] Run functional-with-jupyter test'))
- name: Run DataScience tests with VSCode & Jupyter
uses: GabrielBB/xvfb-action@v1.4
with:
run: npm run test:testDataScience
env:
VSCODE_PYTHON_ROLLING: 1
VSC_PYTHON_FORCE_LOGGING: 1
if: matrix.test-suite == 'integration' || (matrix.test-suite == 'test-based-on-pr-body' && github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[x] Run integration test'))
# smoke-tests:
# name: Smoke tests
# # The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
# runs-on: ${{ matrix.os }}
# if: github.repository == 'microsoft/vscode-jupyter'
# needs: [build-vsix]
# strategy:
# fail-fast: false
# matrix:
# # We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# # macOS runners are expensive, and we assume that Ubuntu is enough to cover the UNIX case.
# os: [ubuntu-latest, windows-latest]
# python: [3.8]
# steps:
# # Need the source to have the tests available.
# - name: Checkout
# uses: actions/checkout@v2
# - name: Cache pip files
# uses: actions/cache@v2
# with:
# path: ~/.cache/pip
# key: ${{runner.os}}-${{env.CACHE_PIP_DEPS}}-${{env.PYTHON_VERSION}}
# - name: Cache npm files
# uses: actions/cache@v2
# with:
# path: ~/.npm
# key: ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
# - name: Use Python ${{matrix.python}}
# uses: actions/setup-python@v2
# with:
# python-version: ${{matrix.python}}
# - name: Install dependencies (npm ci)
# run: npm ci --prefer-offline
# - name: pip install ipython requirements
# run: |
# python -m pip install numpy
# python -m pip install --upgrade -r ./build/ipython-test-requirements.txt
# - name: pip install jupyter
# run: |
# python -m pip install --upgrade jupyter
# # Save time by reusing bits from the VSIX.
# - name: Download VSIX
# uses: actions/download-artifact@v2
# with:
# name: ${{env.ARTIFACT_NAME_VSIX}}
# # Compile the test files.
# - name: Prepare for smoke tests
# run: npx tsc -p ./
# shell: bash
# - name: Set CI_PYTHON_PATH and CI_DISABLE_AUTO_SELECTION
# run: |
# echo "::set-env name=CI_PYTHON_PATH::python"
# echo "::set-env name=CI_DISABLE_AUTO_SELECTION::1"
# shell: bash
# - name: Run smoke tests
# env:
# DISPLAY: 10
# uses: GabrielBB/xvfb-action@v1.4
# with:
# run: node --no-force-async-hooks-checks ./out/test/smokeTest.js