Skip to content

Commit d59fadc

Browse files
authored
Add pipelines yml (#13)
1 parent bb7f42e commit d59fadc

File tree

8 files changed

+473
-29
lines changed

8 files changed

+473
-29
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Run on a schedule
2+
trigger: none
3+
pr: none
4+
5+
schedules:
6+
- cron: '0 10 * * 1-5' # 10AM UTC (2AM PDT) MON-FRI (VS Code Pre-release builds at 9PM PDT)
7+
displayName: Nightly Pre-Release Schedule
8+
always: false # only run if there are source code changes
9+
branches:
10+
include:
11+
- main
12+
13+
resources:
14+
repositories:
15+
- repository: templates
16+
type: github
17+
name: microsoft/vscode-engineering
18+
ref: main
19+
endpoint: Monaco
20+
21+
parameters:
22+
- name: publishExtension
23+
displayName: 🚀 Publish Extension
24+
type: boolean
25+
default: false
26+
27+
extends:
28+
template: azure-pipelines/extension/pre-release.yml@templates
29+
parameters:
30+
publishExtension: ${{ parameters.publishExtension }}
31+
ghCreateTag: false
32+
standardizedVersioning: true
33+
l10nSourcePaths: ./src
34+
35+
buildPlatforms:
36+
- name: Linux
37+
vsceTarget: 'web'
38+
- name: Linux
39+
packageArch: arm64
40+
vsceTarget: linux-arm64
41+
- name: Linux
42+
packageArch: arm
43+
vsceTarget: linux-armhf
44+
- name: Linux
45+
packageArch: x64
46+
vsceTarget: linux-x64
47+
- name: Linux
48+
packageArch: arm64
49+
vsceTarget: alpine-arm64
50+
- name: Linux
51+
packageArch: x64
52+
vsceTarget: alpine-x64
53+
- name: MacOS
54+
packageArch: arm64
55+
vsceTarget: darwin-arm64
56+
- name: MacOS
57+
packageArch: x64
58+
vsceTarget: darwin-x64
59+
- name: Windows
60+
packageArch: arm
61+
vsceTarget: win32-arm64
62+
- name: Windows
63+
packageArch: x64
64+
vsceTarget: win32-x64
65+
66+
buildSteps:
67+
- task: NodeTool@0
68+
inputs:
69+
versionSpec: '20.18.0'
70+
displayName: Select Node version
71+
72+
- task: UsePythonVersion@0
73+
inputs:
74+
versionSpec: '3.8'
75+
addToPath: true
76+
architecture: 'x64'
77+
displayName: Select Python version
78+
79+
- script: npm ci
80+
displayName: Install NPM dependencies
81+
82+
- script: python ./build/update_package_file.py
83+
displayName: Update telemetry in package.json
84+
85+
- script: python ./build/update_ext_version.py --for-publishing
86+
displayName: Update build number
87+
88+
- script: npx gulp prePublishBundle
89+
displayName: Build
90+
91+
- bash: |
92+
mkdir -p $(Build.SourcesDirectory)/python-env-tools/bin
93+
chmod +x $(Build.SourcesDirectory)/python-env-tools/bin
94+
displayName: Make Directory for python-env-tool binary
95+
96+
- task: DownloadPipelineArtifact@2
97+
inputs:
98+
buildType: 'specific'
99+
project: 'Monaco'
100+
definition: 591
101+
buildVersionToDownload: 'latest'
102+
branchName: 'refs/heads/main'
103+
targetPath: '$(Build.SourcesDirectory)/python-env-tools/bin'
104+
artifactName: 'bin-$(vsceTarget)'
105+
itemPattern: |
106+
pet.exe
107+
pet
108+
ThirdPartyNotices.txt
109+
110+
- bash: |
111+
ls -lf ./python-env-tools/bin
112+
chmod +x ./python-env-tools/bin/pet*
113+
ls -lf ./python-env-tools/bin
114+
displayName: Set chmod for pet binary
115+
116+
- script: npm run package
117+
displayName: Build extension
118+
119+
tsa:
120+
config:
121+
areaPath: 'Visual Studio Code Python Extensions'
122+
serviceTreeID: '6e6194bc-7baa-4486-86d0-9f5419626d46'
123+
enabled: true

build/azure-pipeline.stable.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
trigger: none
2+
# branches:
3+
# include:
4+
# - release*
5+
# tags:
6+
# include: ['*']
7+
pr: none
8+
9+
resources:
10+
repositories:
11+
- repository: templates
12+
type: github
13+
name: microsoft/vscode-engineering
14+
ref: main
15+
endpoint: Monaco
16+
17+
parameters:
18+
- name: publishExtension
19+
displayName: 🚀 Publish Extension
20+
type: boolean
21+
default: false
22+
23+
extends:
24+
template: azure-pipelines/extension/stable.yml@templates
25+
parameters:
26+
l10nSourcePaths: ./src
27+
publishExtension: ${{ parameters.publishExtension }}
28+
ghCreateTag: true
29+
buildSteps:
30+
- task: NodeTool@0
31+
inputs:
32+
versionSpec: '18.17.0'
33+
displayName: Select Node version
34+
35+
- task: UsePythonVersion@0
36+
inputs:
37+
versionSpec: '3.8'
38+
addToPath: true
39+
architecture: 'x64'
40+
displayName: Select Python version
41+
42+
- script: npm ci
43+
displayName: Install NPM dependencies
44+
45+
- script: python -m pip install -U pip
46+
displayName: Upgrade pip
47+
48+
- script: python -m pip install wheel
49+
displayName: Install wheel
50+
51+
- script: python -m pip install nox
52+
displayName: Install wheel
53+
54+
- script: python ./build/update_ext_version.py --release --for-publishing
55+
displayName: Update build number
56+
57+
- bash: |
58+
mkdir -p $(Build.SourcesDirectory)/python-env-tools/bin
59+
chmod +x $(Build.SourcesDirectory)/python-env-tools/bin
60+
displayName: Make Directory for python-env-tool binary
61+
62+
- task: DownloadPipelineArtifact@2
63+
inputs:
64+
buildType: 'specific'
65+
project: 'Monaco'
66+
definition: 593
67+
buildVersionToDownload: 'latestFromBranch'
68+
branchName: 'refs/heads/release/2024.18'
69+
targetPath: '$(Build.SourcesDirectory)/python-env-tools/bin'
70+
artifactName: 'bin-$(vsceTarget)'
71+
itemPattern: |
72+
pet.exe
73+
pet
74+
ThirdPartyNotices.txt
75+
76+
- bash: |
77+
ls -lf ./python-env-tools/bin
78+
chmod +x ./python-env-tools/bin/pet*
79+
ls -lf ./python-env-tools/bin
80+
displayName: Set chmod for pet binary
81+
82+
- script: npm run package
83+
displayName: Build extension
84+
tsa:
85+
config:
86+
areaPath: 'Visual Studio Code Python Extensions'
87+
serviceTreeID: '6e6194bc-7baa-4486-86d0-9f5419626d46'
88+
enabled: true

build/test_update_ext_version.py

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
import json
5+
6+
import freezegun
7+
import pytest
8+
import update_ext_version
9+
10+
TEST_DATETIME = "2022-03-14 01:23:45"
11+
12+
# The build ID is calculated via:
13+
# "1" + datetime.datetime.strptime(TEST_DATETIME,"%Y-%m-%d %H:%M:%S").strftime('%j%H%M')
14+
EXPECTED_BUILD_ID = "10730123"
15+
16+
17+
def create_package_json(directory, version):
18+
"""Create `package.json` in `directory` with a specified version of `version`."""
19+
package_json = directory / "package.json"
20+
package_json.write_text(json.dumps({"version": version}), encoding="utf-8")
21+
return package_json
22+
23+
24+
def run_test(tmp_path, version, args, expected):
25+
package_json = create_package_json(tmp_path, version)
26+
update_ext_version.main(package_json, args)
27+
package = json.loads(package_json.read_text(encoding="utf-8"))
28+
assert expected == update_ext_version.parse_version(package["version"])
29+
30+
31+
@pytest.mark.parametrize(
32+
"version, args",
33+
[
34+
("1.0.0-rc", []),
35+
("1.1.0-rc", ["--release"]),
36+
("1.0.0-rc", ["--release", "--build-id", "-1"]),
37+
("1.0.0-rc", ["--release", "--for-publishing", "--build-id", "-1"]),
38+
("1.0.0-rc", ["--release", "--for-publishing", "--build-id", "999999999999"]),
39+
("1.1.0-rc", ["--build-id", "-1"]),
40+
("1.1.0-rc", ["--for-publishing", "--build-id", "-1"]),
41+
("1.1.0-rc", ["--for-publishing", "--build-id", "999999999999"]),
42+
],
43+
)
44+
def test_invalid_args(tmp_path, version, args):
45+
with pytest.raises(ValueError):
46+
run_test(tmp_path, version, args, None)
47+
48+
49+
@pytest.mark.parametrize(
50+
"version, args, expected",
51+
[
52+
("1.1.0-rc", ["--build-id", "12345"], ("1", "1", "12345", "rc")),
53+
("1.0.0-rc", ["--release", "--build-id", "12345"], ("1", "0", "12345", "")),
54+
(
55+
"1.1.0-rc",
56+
["--for-publishing", "--build-id", "12345"],
57+
("1", "1", "12345", ""),
58+
),
59+
(
60+
"1.0.0-rc",
61+
["--release", "--for-publishing", "--build-id", "12345"],
62+
("1", "0", "12345", ""),
63+
),
64+
(
65+
"1.0.0-rc",
66+
["--release", "--build-id", "999999999999"],
67+
("1", "0", "999999999999", ""),
68+
),
69+
(
70+
"1.1.0-rc",
71+
["--build-id", "999999999999"],
72+
("1", "1", "999999999999", "rc"),
73+
),
74+
("1.1.0-rc", [], ("1", "1", EXPECTED_BUILD_ID, "rc")),
75+
(
76+
"1.0.0-rc",
77+
["--release"],
78+
("1", "0", "0", ""),
79+
),
80+
(
81+
"1.1.0-rc",
82+
["--for-publishing"],
83+
("1", "1", EXPECTED_BUILD_ID, ""),
84+
),
85+
(
86+
"1.0.0-rc",
87+
["--release", "--for-publishing"],
88+
("1", "0", "0", ""),
89+
),
90+
(
91+
"1.0.0-rc",
92+
["--release"],
93+
("1", "0", "0", ""),
94+
),
95+
(
96+
"1.1.0-rc",
97+
[],
98+
("1", "1", EXPECTED_BUILD_ID, "rc"),
99+
),
100+
],
101+
)
102+
@freezegun.freeze_time("2022-03-14 01:23:45")
103+
def test_update_ext_version(tmp_path, version, args, expected):
104+
run_test(tmp_path, version, args, expected)

0 commit comments

Comments
 (0)