Skip to content

Commit 6c09b63

Browse files
authored
Add uploading to the insiders build GitHub Action (#13547)
Initially set to upload blob as `ms-python-gha-insiders.vsix` to prevent clobbering the version uploaded by Azure Pipelines.
1 parent 6f512b1 commit 6c09b63

File tree

1 file changed

+90
-156
lines changed

1 file changed

+90
-156
lines changed

.github/workflows/ci.yml renamed to .github/workflows/insiders.yml

Lines changed: 90 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: CI
1+
name: Insiders Build
22

33
on:
44
push:
55
branches:
6-
# Run the CI workflow only on master for microsoft/vscode-python for now.
76
- master
7+
- main
88

99
env:
1010
PYTHON_VERSION: 3.8
@@ -15,24 +15,29 @@ env:
1515
# Key for the cache created at the end of the the 'Cache ./pythonFiles/lib/python' step.
1616
CACHE_PYTHONFILES: cache-pvsc-pythonFiles
1717
ARTIFACT_NAME_VSIX: ms-python-insiders-vsix
18+
VSIX_NAME: ms-python-insiders.vsix
1819
COVERAGE_REPORTS: tests-coverage-reports
1920
TEST_RESULTS_DIRECTORY: .
20-
LKG_TAG: ci-lkg
2121

2222
jobs:
23-
### Initialization: retrieve, install and cache dependencies
24-
python-deps:
25-
name: Install Python Requirements
23+
build-vsix:
24+
name: Build VSIX
2625
runs-on: ubuntu-latest
27-
if: github.repository == 'microsoft/vscode-python'
2826
steps:
2927
- name: Checkout
3028
uses: actions/checkout@v2
3129

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')}}
3641

3742
- name: Use Python ${{env.PYTHON_VERSION}}
3843
uses: actions/setup-python@v2
@@ -52,58 +57,38 @@ jobs:
5257
python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt
5358
python ./pythonFiles/install_debugpy.py
5459
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-
8160
- name: Install dependencies (npm ci)
8261
run: npm ci --prefer-offline
8362

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
8673
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}}
8976

90-
### Hygiene + VSIX upload
91-
compile-hygiene:
92-
name: Compile, lint, check for errors
77+
lint:
78+
name: Lint
9379
runs-on: ubuntu-latest
94-
if: github.repository == 'microsoft/vscode-python'
95-
needs: [js-ts-deps, python-deps]
9680
steps:
9781
- name: Checkout
9882
uses: actions/checkout@v2
9983

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')}}
10489

105-
- name: Retrieve cached npm files
106-
uses: actions/cache@v1
90+
- name: Cache npm files
91+
uses: actions/cache@v2
10792
with:
10893
path: ~/.npm
10994
key: ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
@@ -115,7 +100,7 @@ jobs:
115100
run: npx gulp prePublishNonBundle
116101

117102
- name: Cache the out/ directory
118-
uses: actions/cache@v1
103+
uses: actions/cache@v2
119104
with:
120105
path: ./out
121106
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}}
@@ -143,57 +128,11 @@ jobs:
143128
python -m black . --check
144129
working-directory: pythonFiles
145130

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-
190131
### Non-smoke tests
191132
tests:
192133
name: Tests
193134
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
194135
runs-on: ${{ matrix.os }}
195-
if: github.repository == 'microsoft/vscode-python'
196-
needs: [python-deps, js-ts-deps]
197136
strategy:
198137
fail-fast: false
199138
matrix:
@@ -213,28 +152,29 @@ jobs:
213152
- name: Checkout
214153
uses: actions/checkout@v2
215154

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')}}
220160

221-
- name: Retrieve cached npm files
222-
uses: actions/cache@v1
161+
- name: Cache npm files
162+
uses: actions/cache@v2
223163
with:
224164
path: ~/.npm
225165
key: ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
226166

227-
- name: Install dependencies (npm ci)
228-
run: npm ci
229-
230-
- name: Retrieve cached compile output directory
167+
- name: Cache compiled TS files
231168
# Use an id for this step so that its cache-hit output can be accessed and checked in the next step.
232169
id: out-cache
233-
uses: actions/cache@v1
170+
uses: actions/cache@v2
234171
with:
235172
path: ./out
236173
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}}
237174

175+
- name: Install dependencies (npm ci)
176+
run: npm ci
177+
238178
- name: Compile if not cached
239179
run: npx gulp prePublishNonBundle
240180
if: steps.out-cache.outputs.cache-hit == false
@@ -249,11 +189,6 @@ jobs:
249189
with:
250190
node-version: ${{env.NODE_VERSION}}
251191

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.
257192
- name: Install Python requirements
258193
run: |
259194
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:
421356
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
422357
runs-on: ${{ matrix.os }}
423358
needs: [build-vsix]
424-
if: github.repository == 'microsoft/vscode-python'
425359
strategy:
426360
fail-fast: false
427361
matrix:
@@ -430,25 +364,27 @@ jobs:
430364
os: [ubuntu-latest, windows-latest]
431365
python: [3.8]
432366
steps:
367+
# Need the source to have the tests available.
433368
- name: Checkout
434369
uses: actions/checkout@v2
435370

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
443373
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')}}
445376

446-
- name: Retrieve cached npm files
447-
uses: actions/cache@v1
377+
- name: Cache npm files
378+
uses: actions/cache@v2
448379
with:
449380
path: ~/.npm
450381
key: ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
451382

383+
- name: Use Python ${{matrix.python}}
384+
uses: actions/setup-python@v2
385+
with:
386+
python-version: ${{matrix.python}}
387+
452388
- name: Install dependencies (npm ci)
453389
run: npm ci --prefer-offline
454390

@@ -468,18 +404,15 @@ jobs:
468404
run: |
469405
python -m pip install --upgrade jupyter
470406
407+
# Save time by reusing bits from the VSIX.
471408
- name: Download VSIX
472-
uses: actions/download-artifact@v1
409+
uses: actions/download-artifact@v2
473410
with:
474411
name: ${{env.ARTIFACT_NAME_VSIX}}
475412

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.
478414
- 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 ./
483416
shell: bash
484417

485418
- name: Set CI_PYTHON_PATH and CI_DISABLE_AUTO_SELECTION
@@ -504,8 +437,8 @@ jobs:
504437
- name: Checkout
505438
uses: actions/checkout@v2
506439

507-
- name: Retrieve cached npm files
508-
uses: actions/cache@v1
440+
- name: Cache npm files
441+
uses: actions/cache@v2
509442
with:
510443
path: ~/.npm
511444
key: ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}}
@@ -537,28 +470,29 @@ jobs:
537470
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
538471
file: ./coverage/cobertura-coverage.xml
539472

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
543475
runs-on: ubuntu-latest
544-
needs: [tests, smoke-tests]
545476
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+
546482
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 }}
551487

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

Comments
 (0)