Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions build/azure-pipeline.pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Run on a schedule
trigger: none
pr: none

schedules:
- cron: '0 10 * * 1-5' # 10AM UTC (2AM PDT) MON-FRI (VS Code Pre-release builds at 9PM PDT)
displayName: Nightly Pre-Release Schedule
always: false # only run if there are source code changes
branches:
include:
- main

resources:
repositories:
- repository: templates
type: github
name: microsoft/vscode-engineering
ref: main
endpoint: Monaco

parameters:
- name: publishExtension
displayName: 🚀 Publish Extension
type: boolean
default: false

extends:
template: azure-pipelines/extension/pre-release.yml@templates
parameters:
publishExtension: ${{ parameters.publishExtension }}
ghCreateTag: false
standardizedVersioning: true
l10nSourcePaths: ./src

buildPlatforms:
- name: Linux
vsceTarget: 'web'
- name: Linux
packageArch: arm64
vsceTarget: linux-arm64
- name: Linux
packageArch: arm
vsceTarget: linux-armhf
- name: Linux
packageArch: x64
vsceTarget: linux-x64
- name: Linux
packageArch: arm64
vsceTarget: alpine-arm64
- name: Linux
packageArch: x64
vsceTarget: alpine-x64
- name: MacOS
packageArch: arm64
vsceTarget: darwin-arm64
- name: MacOS
packageArch: x64
vsceTarget: darwin-x64
- name: Windows
packageArch: arm
vsceTarget: win32-arm64
- name: Windows
packageArch: x64
vsceTarget: win32-x64

buildSteps:
- task: NodeTool@0
inputs:
versionSpec: '20.18.0'
displayName: Select Node version

- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
addToPath: true
architecture: 'x64'
displayName: Select Python version

- script: npm ci
displayName: Install NPM dependencies

- script: python ./build/update_package_file.py
displayName: Update telemetry in package.json

- script: python ./build/update_ext_version.py --for-publishing
displayName: Update build number

- script: npx gulp prePublishBundle
displayName: Build

- bash: |
mkdir -p $(Build.SourcesDirectory)/python-env-tools/bin
chmod +x $(Build.SourcesDirectory)/python-env-tools/bin
displayName: Make Directory for python-env-tool binary

- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'Monaco'
definition: 591
buildVersionToDownload: 'latest'
branchName: 'refs/heads/main'
targetPath: '$(Build.SourcesDirectory)/python-env-tools/bin'
artifactName: 'bin-$(vsceTarget)'
itemPattern: |
pet.exe
pet
ThirdPartyNotices.txt

- bash: |
ls -lf ./python-env-tools/bin
chmod +x ./python-env-tools/bin/pet*
ls -lf ./python-env-tools/bin
displayName: Set chmod for pet binary

- script: npm run package
displayName: Build extension

tsa:
config:
areaPath: 'Visual Studio Code Python Extensions'
serviceTreeID: '6e6194bc-7baa-4486-86d0-9f5419626d46'
enabled: true
88 changes: 88 additions & 0 deletions build/azure-pipeline.stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
trigger: none
# branches:
# include:
# - release*
# tags:
# include: ['*']
pr: none

resources:
repositories:
- repository: templates
type: github
name: microsoft/vscode-engineering
ref: main
endpoint: Monaco

parameters:
- name: publishExtension
displayName: 🚀 Publish Extension
type: boolean
default: false

extends:
template: azure-pipelines/extension/stable.yml@templates
parameters:
l10nSourcePaths: ./src
publishExtension: ${{ parameters.publishExtension }}
ghCreateTag: true
buildSteps:
- task: NodeTool@0
inputs:
versionSpec: '18.17.0'
displayName: Select Node version

- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
addToPath: true
architecture: 'x64'
displayName: Select Python version

- script: npm ci
displayName: Install NPM dependencies

- script: python -m pip install -U pip
displayName: Upgrade pip

- script: python -m pip install wheel
displayName: Install wheel

- script: python -m pip install nox
displayName: Install wheel

- script: python ./build/update_ext_version.py --release --for-publishing
displayName: Update build number

- bash: |
mkdir -p $(Build.SourcesDirectory)/python-env-tools/bin
chmod +x $(Build.SourcesDirectory)/python-env-tools/bin
displayName: Make Directory for python-env-tool binary

- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'Monaco'
definition: 593
buildVersionToDownload: 'latestFromBranch'
branchName: 'refs/heads/release/2024.18'
targetPath: '$(Build.SourcesDirectory)/python-env-tools/bin'
artifactName: 'bin-$(vsceTarget)'
itemPattern: |
pet.exe
pet
ThirdPartyNotices.txt

- bash: |
ls -lf ./python-env-tools/bin
chmod +x ./python-env-tools/bin/pet*
ls -lf ./python-env-tools/bin
displayName: Set chmod for pet binary

- script: npm run package
displayName: Build extension
tsa:
config:
areaPath: 'Visual Studio Code Python Extensions'
serviceTreeID: '6e6194bc-7baa-4486-86d0-9f5419626d46'
enabled: true
104 changes: 104 additions & 0 deletions build/test_update_ext_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import json

import freezegun
import pytest
import update_ext_version

TEST_DATETIME = "2022-03-14 01:23:45"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for and why is it in 2022?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to test if and when the year changes and the updater needs to block the build because the year version does not match.


# The build ID is calculated via:
# "1" + datetime.datetime.strptime(TEST_DATETIME,"%Y-%m-%d %H:%M:%S").strftime('%j%H%M')
EXPECTED_BUILD_ID = "10730123"


def create_package_json(directory, version):
"""Create `package.json` in `directory` with a specified version of `version`."""
package_json = directory / "package.json"
package_json.write_text(json.dumps({"version": version}), encoding="utf-8")
return package_json


def run_test(tmp_path, version, args, expected):
package_json = create_package_json(tmp_path, version)
update_ext_version.main(package_json, args)
package = json.loads(package_json.read_text(encoding="utf-8"))
assert expected == update_ext_version.parse_version(package["version"])


@pytest.mark.parametrize(
"version, args",
[
("1.0.0-rc", []),
("1.1.0-rc", ["--release"]),
("1.0.0-rc", ["--release", "--build-id", "-1"]),
("1.0.0-rc", ["--release", "--for-publishing", "--build-id", "-1"]),
("1.0.0-rc", ["--release", "--for-publishing", "--build-id", "999999999999"]),
("1.1.0-rc", ["--build-id", "-1"]),
("1.1.0-rc", ["--for-publishing", "--build-id", "-1"]),
("1.1.0-rc", ["--for-publishing", "--build-id", "999999999999"]),
],
)
def test_invalid_args(tmp_path, version, args):
with pytest.raises(ValueError):
run_test(tmp_path, version, args, None)


@pytest.mark.parametrize(
"version, args, expected",
[
("1.1.0-rc", ["--build-id", "12345"], ("1", "1", "12345", "rc")),
("1.0.0-rc", ["--release", "--build-id", "12345"], ("1", "0", "12345", "")),
(
"1.1.0-rc",
["--for-publishing", "--build-id", "12345"],
("1", "1", "12345", ""),
),
(
"1.0.0-rc",
["--release", "--for-publishing", "--build-id", "12345"],
("1", "0", "12345", ""),
),
(
"1.0.0-rc",
["--release", "--build-id", "999999999999"],
("1", "0", "999999999999", ""),
),
(
"1.1.0-rc",
["--build-id", "999999999999"],
("1", "1", "999999999999", "rc"),
),
("1.1.0-rc", [], ("1", "1", EXPECTED_BUILD_ID, "rc")),
(
"1.0.0-rc",
["--release"],
("1", "0", "0", ""),
),
(
"1.1.0-rc",
["--for-publishing"],
("1", "1", EXPECTED_BUILD_ID, ""),
),
(
"1.0.0-rc",
["--release", "--for-publishing"],
("1", "0", "0", ""),
),
(
"1.0.0-rc",
["--release"],
("1", "0", "0", ""),
),
(
"1.1.0-rc",
[],
("1", "1", EXPECTED_BUILD_ID, "rc"),
),
],
)
@freezegun.freeze_time("2022-03-14 01:23:45")
def test_update_ext_version(tmp_path, version, args, expected):
run_test(tmp_path, version, args, expected)
Loading