1
- name : CI
1
+ name : Insiders Build
2
2
3
3
on :
4
4
push :
5
5
branches :
6
- # Run the CI workflow only on master for microsoft/vscode-python for now.
7
6
- master
7
+ - main
8
8
9
9
env :
10
10
PYTHON_VERSION : 3.8
15
15
# Key for the cache created at the end of the the 'Cache ./pythonFiles/lib/python' step.
16
16
CACHE_PYTHONFILES : cache-pvsc-pythonFiles
17
17
ARTIFACT_NAME_VSIX : ms-python-insiders-vsix
18
+ VSIX_NAME : ms-python-insiders.vsix
18
19
COVERAGE_REPORTS : tests-coverage-reports
19
20
TEST_RESULTS_DIRECTORY : .
20
- LKG_TAG : ci-lkg
21
21
22
22
jobs :
23
- # ## Initialization: retrieve, install and cache dependencies
24
- python-deps :
25
- name : Install Python Requirements
23
+ build-vsix :
24
+ name : Build VSIX
26
25
runs-on : ubuntu-latest
27
- if : github.repository == 'microsoft/vscode-python'
28
26
steps :
29
27
- name : Checkout
30
28
uses : actions/checkout@v2
31
29
32
- - name : Show all env vars
33
- run : |
34
- printenv
35
- shell : bash
30
+ - name : Cache pip files
31
+ uses : actions/cache@v2
32
+ with :
33
+ path : ~/.cache/pip
34
+ key : ${{runner.os}}-${{env.CACHE_PIP_DEPS}}-${{env.PYTHON_VERSION}}-${{hashFiles('requirements.txt')}}-${{hashFiles('build/debugger-install-requirements.txt')}}
35
+
36
+ - name : Cache npm files
37
+ uses : actions/cache@v2
38
+ with :
39
+ path : ~/.npm
40
+ key : ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
36
41
37
42
- name : Use Python ${{env.PYTHON_VERSION}}
38
43
uses : actions/setup-python@v2
@@ -52,58 +57,38 @@ jobs:
52
57
python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt
53
58
python ./pythonFiles/install_debugpy.py
54
59
55
- # Retrieve the list of debugpy versions from PyPI in order to increase the specificity of the pip cache key,
56
- # so that the cache gets invalidated as necessary.
57
- # See https://github.com/microsoft/vscode-python/pull/9843#discussion_r373635221
58
- - name : curl PyPI to get debugpy versions
59
- run : curl --output debugpy.json https://pypi.org/pypi/debugpy/json
60
-
61
- - name : Cache pip files
62
- uses : actions/cache@v1
63
- with :
64
- path : ~/.cache/pip
65
- key : ${{runner.os}}-${{env.CACHE_PIP_DEPS}}-pip-${{env.PYTHON_VERSION}}-${{hashFiles('requirements.txt')}}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('debugpy.json')}}
66
-
67
- - name : Cache ./pythonFiles/lib/python
68
- uses : actions/cache@v1
69
- with :
70
- path : ./pythonFiles/lib/python
71
- key : ${{runner.os}}-${{env.CACHE_PYTHONFILES}}-pythonFiles-${{env.PYTHON_VERSION}}-${{hashFiles('requirements.txt')}}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('debugpy.json')}}
72
-
73
- js-ts-deps :
74
- name : Install npm dependencies
75
- runs-on : ubuntu-latest
76
- if : github.repository == 'microsoft/vscode-python'
77
- steps :
78
- - name : Checkout
79
- uses : actions/checkout@v2
80
-
81
60
- name : Install dependencies (npm ci)
82
61
run : npm ci --prefer-offline
83
62
84
- - name : Cache npm files
85
- uses : actions/cache@v1
63
+ # Use the GITHUB_RUN_ID environment variable to update the build number.
64
+ # GITHUB_RUN_ID is a unique number for each run within a repository.
65
+ # This number does not change if you re-run the workflow run.
66
+ - name : Update build number
67
+ run : npm run updateBuildNumber -- --buildNumber $GITHUB_RUN_ID
68
+
69
+ - name : Create the VSIX
70
+ run : npm run package
71
+
72
+ - uses : actions/upload-artifact@v2
86
73
with :
87
- path : ~/.npm
88
- key : ${{runner.os}}-${{ env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json') }}
74
+ name : ${{env.ARTIFACT_NAME_VSIX}}
75
+ path : ${{env.VSIX_NAME }}
89
76
90
- # ## Hygiene + VSIX upload
91
- compile-hygiene :
92
- name : Compile, lint, check for errors
77
+ lint :
78
+ name : Lint
93
79
runs-on : ubuntu-latest
94
- if : github.repository == 'microsoft/vscode-python'
95
- needs : [js-ts-deps, python-deps]
96
80
steps :
97
81
- name : Checkout
98
82
uses : actions/checkout@v2
99
83
100
- - name : Show all env vars
101
- run : |
102
- printenv
103
- shell : bash
84
+ - name : Cache pip files
85
+ uses : actions/cache@v2
86
+ with :
87
+ path : ~/.cache/pip
88
+ key : ${{runner.os}}-${{env.CACHE_PIP_DEPS}}-${{env.PYTHON_VERSION}}-${{hashFiles('requirements.txt')}}-${{hashFiles('build/debugger-install-requirements.txt')}}
104
89
105
- - name : Retrieve cached npm files
106
- uses : actions/cache@v1
90
+ - name : Cache npm files
91
+ uses : actions/cache@v2
107
92
with :
108
93
path : ~/.npm
109
94
key : ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
@@ -115,7 +100,7 @@ jobs:
115
100
run : npx gulp prePublishNonBundle
116
101
117
102
- name : Cache the out/ directory
118
- uses : actions/cache@v1
103
+ uses : actions/cache@v2
119
104
with :
120
105
path : ./out
121
106
key : ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}}
@@ -143,57 +128,11 @@ jobs:
143
128
python -m black . --check
144
129
working-directory : pythonFiles
145
130
146
- build-vsix :
147
- name : Build VSIX
148
- runs-on : ubuntu-latest
149
- if : github.repository == 'microsoft/vscode-python'
150
- needs : [python-deps, js-ts-deps]
151
- steps :
152
- - name : Checkout
153
- uses : actions/checkout@v2
154
-
155
- - name : Retrieve cached npm files
156
- uses : actions/cache@v1
157
- with :
158
- path : ~/.npm
159
- key : ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
160
-
161
- - name : curl PyPI to get debugpy versions
162
- run : curl --output debugpy.json https://pypi.org/pypi/debugpy/json
163
-
164
- - name : Retrieve cached pythonFiles/ directory
165
- uses : actions/cache@v1
166
- with :
167
- path : ./pythonFiles/lib/python
168
- key : ${{runner.os}}-${{env.CACHE_PYTHONFILES}}-pythonFiles-${{env.PYTHON_VERSION}}-${{hashFiles('requirements.txt')}}-${{hashFiles('build/debugger-install-requirements.txt')}}-${{hashFiles('debugpy.json')}}
169
-
170
- - name : Install dependencies (npm ci)
171
- run : npm ci --prefer-offline
172
-
173
- - name : Clean directory
174
- run : npm run clean
175
-
176
- # Use the GITHUB_RUN_ID environment variable to update the build number.
177
- # GITHUB_RUN_ID is a unique number for each run within a repository.
178
- # This number does not change if you re-run the workflow run.
179
- - name : Update build number
180
- run : npm run updateBuildNumber -- --buildNumber $GITHUB_RUN_ID
181
-
182
- - name : Package the VSIX
183
- run : npm run package
184
-
185
- - uses : actions/upload-artifact@v1
186
- with :
187
- name : ${{env.ARTIFACT_NAME_VSIX}}
188
- path : ms-python-insiders.vsix
189
-
190
131
# ## Non-smoke tests
191
132
tests :
192
133
name : Tests
193
134
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
194
135
runs-on : ${{ matrix.os }}
195
- if : github.repository == 'microsoft/vscode-python'
196
- needs : [python-deps, js-ts-deps]
197
136
strategy :
198
137
fail-fast : false
199
138
matrix :
@@ -213,28 +152,29 @@ jobs:
213
152
- name : Checkout
214
153
uses : actions/checkout@v2
215
154
216
- - name : Show all env vars
217
- run : |
218
- printenv
219
- shell : bash
155
+ - name : Cache pip files
156
+ uses : actions/cache@v2
157
+ with :
158
+ path : ~/.cache/pip
159
+ key : ${{runner.os}}-${{env.CACHE_PIP_DEPS}}-${{env.PYTHON_VERSION}}-${{hashFiles('requirements.txt')}}-${{hashFiles('build/debugger-install-requirements.txt')}}
220
160
221
- - name : Retrieve cached npm files
222
- uses : actions/cache@v1
161
+ - name : Cache npm files
162
+ uses : actions/cache@v2
223
163
with :
224
164
path : ~/.npm
225
165
key : ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
226
166
227
- - name : Install dependencies (npm ci)
228
- run : npm ci
229
-
230
- - name : Retrieve cached compile output directory
167
+ - name : Cache compiled TS files
231
168
# Use an id for this step so that its cache-hit output can be accessed and checked in the next step.
232
169
id : out-cache
233
- uses : actions/cache@v1
170
+ uses : actions/cache@v2
234
171
with :
235
172
path : ./out
236
173
key : ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}}
237
174
175
+ - name : Install dependencies (npm ci)
176
+ run : npm ci
177
+
238
178
- name : Compile if not cached
239
179
run : npx gulp prePublishNonBundle
240
180
if : steps.out-cache.outputs.cache-hit == false
@@ -249,11 +189,6 @@ jobs:
249
189
with :
250
190
node-version : ${{env.NODE_VERSION}}
251
191
252
- - name : curl PyPI to get debugpy versions
253
- run : curl --output debugpy.json https://pypi.org/pypi/debugpy/json
254
-
255
- # We're intentionally not retrieving cached Python requirements installation, as it appears that pulling the cache pulls in some extra libraries as well,
256
- # which causes problems with the tests. Also, running the installation seems much faster than retrieving it from cache.
257
192
- name : Install Python requirements
258
193
run : |
259
194
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt
@@ -421,7 +356,6 @@ jobs:
421
356
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
422
357
runs-on : ${{ matrix.os }}
423
358
needs : [build-vsix]
424
- if : github.repository == 'microsoft/vscode-python'
425
359
strategy :
426
360
fail-fast : false
427
361
matrix :
@@ -430,25 +364,27 @@ jobs:
430
364
os : [ubuntu-latest, windows-latest]
431
365
python : [3.8]
432
366
steps :
367
+ # Need the source to have the tests available.
433
368
- name : Checkout
434
369
uses : actions/checkout@v2
435
370
436
- - name : Show all env vars
437
- run : |
438
- printenv
439
- shell : bash
440
-
441
- - name : Use Python ${{matrix.python}}
442
- uses : actions/setup-python@v2
371
+ - name : Cache pip files
372
+ uses : actions/cache@v2
443
373
with :
444
- python-version : ${{matrix.python}}
374
+ path : ~/.cache/pip
375
+ key : ${{runner.os}}-${{env.CACHE_PIP_DEPS}}-${{env.PYTHON_VERSION}}-${{hashFiles('requirements.txt')}}-${{hashFiles('build/debugger-install-requirements.txt')}}
445
376
446
- - name : Retrieve cached npm files
447
- uses : actions/cache@v1
377
+ - name : Cache npm files
378
+ uses : actions/cache@v2
448
379
with :
449
380
path : ~/.npm
450
381
key : ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
451
382
383
+ - name : Use Python ${{matrix.python}}
384
+ uses : actions/setup-python@v2
385
+ with :
386
+ python-version : ${{matrix.python}}
387
+
452
388
- name : Install dependencies (npm ci)
453
389
run : npm ci --prefer-offline
454
390
@@ -468,18 +404,15 @@ jobs:
468
404
run : |
469
405
python -m pip install --upgrade jupyter
470
406
407
+ # Save time by reusing bits from the VSIX.
471
408
- name : Download VSIX
472
- uses : actions/download-artifact@v1
409
+ uses : actions/download-artifact@v2
473
410
with :
474
411
name : ${{env.ARTIFACT_NAME_VSIX}}
475
412
476
- # Extract the artifact from its download folder (./${{env.ARTIFACT_NAME_VSIX}}) to the repo root,
477
- # then delete the download folder and compile the source code.
413
+ # Compile the test files.
478
414
- name : Prepare for smoke tests
479
- run : |
480
- mv ${{env.ARTIFACT_NAME_VSIX}}/* .
481
- rm -r ${{env.ARTIFACT_NAME_VSIX}}
482
- npx tsc -p ./
415
+ run : npx tsc -p ./
483
416
shell : bash
484
417
485
418
- name : Set CI_PYTHON_PATH and CI_DISABLE_AUTO_SELECTION
@@ -504,8 +437,8 @@ jobs:
504
437
- name : Checkout
505
438
uses : actions/checkout@v2
506
439
507
- - name : Retrieve cached npm files
508
- uses : actions/cache@v1
440
+ - name : Cache npm files
441
+ uses : actions/cache@v2
509
442
with :
510
443
path : ~/.npm
511
444
key : ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
@@ -537,28 +470,29 @@ jobs:
537
470
CODECOV_TOKEN : ${{secrets.CODECOV_TOKEN}}
538
471
file : ./coverage/cobertura-coverage.xml
539
472
540
- lkg-tag :
541
- # LKG = last known good
542
- name : Tag successful build as CI LKG
473
+ upload :
474
+ name : Upload VSIX to Azure Blob Storage
543
475
runs-on : ubuntu-latest
544
- needs : [tests, smoke-tests]
545
476
if : github.repository == 'microsoft/vscode-python'
477
+ needs : [tests, smoke-tests, build-vsix]
478
+ env :
479
+ BLOB_CONTAINER_NAME : extension-builds
480
+ BLOB_NAME : ms-python-gha-insiders.vsix # So named to avoid clobbering Azure Pipelines upload.
481
+
546
482
steps :
547
- - name : Delete existing tag
548
- run : |
549
- curl -s -X DELETE https://api.github.com/repos/microsoft/vscode-python/git/refs/tags/${{env.LKG_TAG}} \
550
- -H "Authorization: token ${{secrets.GITHUB_TOKEN}}"
483
+ - name : Download VSIX
484
+ uses : actions/download-artifact@v2
485
+ with :
486
+ name : ${{ env.ARTIFACT_NAME_VSIX }}
551
487
552
- # We only need to create a tag reference for lightweight tags.
553
- # See https://developer.github.com/v3/git/tags/#create-a-tag-object
554
- # And https://developer.github.com/v3/git/refs/#create-a-reference
555
- - name : Create a tag reference
556
- run : |
557
- curl -s -X POST "https://api.github.com/repos/microsoft/vscode-python/git/refs" \
558
- -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
559
- -d @- << EOF
560
- {
561
- "ref": "refs/tags/${{env.LKG_TAG}}",
562
- "sha": "${{github.sha}}"
563
- }
564
- EOF
488
+ - name : Azure Login
489
+ uses : azure/login@v1
490
+ with :
491
+ creds : ${{ secrets.AZURE_CREDENTIALS }}
492
+
493
+ - name : Upload to Blob Storage
494
+ uses : azure/CLI@v1
495
+ with :
496
+ inlineScript : |
497
+ az storage blob upload --file ${{ env.VSIX_NAME }} --container-name ${{ env.BLOB_CONTAINER_NAME }} --name ${{ env.BLOB_NAME }}
498
+ az storage blob url --container-name ${{ env.BLOB_CONTAINER_NAME }} --name ${{ env.BLOB_NAME }}
0 commit comments