Skip to content

Commit f31cd42

Browse files
authored
Rewrite release pipeline to use MicroBuild rather than vscode's templates (#421)
Also documented the release process in `RELEASE.md`.
1 parent 926bd43 commit f31cd42

File tree

2 files changed

+188
-18
lines changed

2 files changed

+188
-18
lines changed

RELEASE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# How to ship a release
2+
3+
1. Ensure that the project version number in [`packages/python/pyproject.toml`](packages/python/pyproject.toml) has been updated. Historically we have sometimes done this before the release. If not, change it now. Our versioning scheme is:
4+
| Release type | Version format | Notes |
5+
|--------------|----------------|-------|
6+
| Stable | YYYY.0.N | `N` starts at `0` and increments with each release during the year |
7+
| Release candidate | YYYY.O.NrcX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each RC |
8+
| Beta | YYYY.0.NbX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each beta release |
9+
| Alpha | YYYY.0.NaX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each alpha release |
10+
11+
1. Run the [`lsprotocol-Release` pipeline](https://dev.azure.com/devdiv/DevDiv/_build?definitionId=26767) against the `main` branch and check the `🚀 Publish Package` checkbox.
12+
1. Wait for the pipeline to reach the `WaitForValidation` stage.
13+
1. Run the `pygls` tests against the new release:
14+
1. `git clone https://github.com/openlawlibrary/pygls`
15+
1. `cd pygls`
16+
1. `poetry install --all-extras` -- Save the path to the generated virtualenv
17+
1. `poetry run poe test` -- Baseline. Note which tests fail, if any. Don't run their `test-pyodide` tests.
18+
1. Download the `lsprotocol-*.tar.gz` file from the Github Release created by the pipeline.
19+
1. Remove the `lsprotocol` directory in the Poetry virtualenv and create a new one using the `lsprotocol` directory within the `tar.gz`.
20+
1. Rerun the tests -- Compare against baseline.
21+
1. Once you're satisfied with the release, publish it by going to the `lsprotocol-Release` pipeline run that you started earlier and pressing the blue `Review` button and then pressing the blue `Resume` button to initiate publishing.
22+
1. Publish the GitHub release (it was created as a draft).

azure-pipelines/release-pypi.yml

Lines changed: 166 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,180 @@
1+
name: Release
12
trigger: none
23
pr: none
34

45
resources:
56
repositories:
6-
- repository: templates
7-
type: github
8-
name: microsoft/vscode-engineering
9-
ref: main
10-
endpoint: Monaco
7+
- repository: MicroBuildTemplate
8+
type: git
9+
name: 1ESPipelineTemplates/MicroBuildTemplate
10+
ref: refs/tags/release
1111

1212
parameters:
1313
- name: publishPackage
1414
displayName: 🚀 Publish Package
1515
type: boolean
1616
default: false
1717

18+
variables:
19+
ARTIFACT_NAME_WHEEL: wheel
20+
architecture: x64
21+
python.version: '3.8'
22+
TeamName: lsprotocol
23+
1824
extends:
19-
template: azure-pipelines/pypi-package/pipeline.yml@templates
25+
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
2026
parameters:
21-
publishPackage: ${{ parameters.publishPackage }}
22-
pythonVersion: '3.8'
23-
# We don't ship any built in packages.
24-
generateNotice: false
25-
projectRootDirectory: $(Build.SourcesDirectory)/packages/python
26-
packageName: lsprotocol
27-
buildSteps:
28-
- script: python -m pip install nox
29-
displayName: Install nox
30-
31-
- script: python -m nox --session build_python_package
32-
displayName: Build package (sdist and wheels)
27+
sdl:
28+
sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES
29+
pool:
30+
name: AzurePipelines-EO
31+
demands:
32+
- ImageOverride -equals 1ESPT-Ubuntu22.04
33+
os: Linux
34+
customBuildTags:
35+
- ES365AIMigrationTooling
36+
stages:
37+
- stage: Build
38+
displayName: Build
39+
jobs:
40+
- job: Build
41+
42+
templateContext:
43+
outputs:
44+
- output: pipelineArtifact
45+
targetPath: $(Build.StagingDirectory)/dist
46+
sbomBuildDropPath: $(Build.StagingDirectory)/dist
47+
artifactName: $(ARTIFACT_NAME_WHEEL)
48+
49+
steps:
50+
- checkout: self
51+
fetchDepth: 1
52+
fetchTags: false
53+
54+
- task: UsePythonVersion@0
55+
inputs:
56+
versionSpec: '$(python.version)'
57+
architecture: '$(architecture)'
58+
displayName: 'Use Python $(python.version) $(architecture)'
59+
60+
- script: python -m pip install nox
61+
displayName: Install nox
62+
63+
- script: python -m nox --session build_python_package
64+
displayName: Build package (sdist and wheels)
65+
66+
- powershell: |
67+
python -m pip install toml-cli
68+
$releaseVersion = & toml get --toml-path packages/python/pyproject.toml project.version
69+
echo "releaseVersion: $releaseVersion"
70+
echo "##vso[task.setvariable variable=releaseVersion;isOutput=true]$releaseVersion"
71+
displayName: Get release version
72+
name: getReleaseVersionStep
73+
74+
- script: ls -al packages/python/dist
75+
76+
- task: CopyFiles@2
77+
displayName: Copy wheel and tarball
78+
inputs:
79+
sourceFolder: packages/python/dist
80+
targetFolder: $(Build.StagingDirectory)/dist
81+
contents: |
82+
lsprotocol-$(getReleaseVersionStep.releaseVersion)-py3-none-any.whl
83+
lsprotocol-$(getReleaseVersionStep.releaseVersion).tar.gz
84+
85+
- stage: CreateTag
86+
displayName: Create Tag
87+
dependsOn: Build
88+
variables:
89+
releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ]
90+
jobs:
91+
- job: CreateTag
92+
steps:
93+
- checkout: self
94+
fetchDepth: 1
95+
fetchTags: false
96+
persistCredentials: true
97+
98+
- script: |
99+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
100+
git config user.name "Azure Piplines"
101+
git fetch --depth 1 origin $(Build.SourceBranchName)
102+
git tag -a $(releaseVersion) -m "Release $(releaseVersion)" origin/$(Build.SourceBranchName)
103+
git push origin $(releaseVersion)
104+
displayName: Create git tag
105+
106+
- stage: CreateRelease
107+
displayName: Create GitHub Release
108+
dependsOn:
109+
- Build
110+
- CreateTag
111+
variables:
112+
releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ]
113+
jobs:
114+
- job: CreateRelease
115+
templateContext:
116+
type: releaseJob
117+
isProduction: true
118+
inputs:
119+
- input: pipelineArtifact
120+
artifactName: $(ARTIFACT_NAME_WHEEL)
121+
targetPath: $(Build.StagingDirectory)/dist
122+
steps:
123+
- task: GitHubRelease@1 #https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/github-release-v1?view=azure-pipelines
124+
displayName: Create GitHub Release
125+
inputs:
126+
gitHubConnection: GitHub-lsprotocol
127+
repositoryName: microsoft/lsprotocol
128+
action: create
129+
target: $(Build.SourceBranchName)
130+
title: $(releaseVersion)
131+
tag: $(releaseVersion)
132+
tagSource: userSpecifiedTag
133+
isDraft: true
134+
addChangeLog: false
135+
assets: $(Build.StagingDirectory)/dist/*
136+
137+
- stage: WaitForValidation
138+
dependsOn: CreateRelease
139+
condition: and(succeeded(), ${{ parameters.publishPackage }})
140+
jobs:
141+
- job: wait_for_validation
142+
displayName: Wait for manual validation
143+
pool: server
144+
steps:
145+
- task: ManualValidation@0
146+
timeoutInMinutes: 1440 # task times out in 1 day
147+
inputs:
148+
notifyUsers: [email protected]
149+
instructions: Please test the latest draft release and then publish it.
150+
onTimeout: reject
151+
152+
- stage: Release
153+
dependsOn: WaitForValidation
154+
jobs:
155+
- job: PublishToPyPi
156+
displayName: Release to PyPi
157+
158+
pool:
159+
name: VSEngSS-MicroBuild2022-1ES # This pool is required to have the certs needed to publish to PyPi using ESRP.
160+
os: windows
161+
image: server2022-microbuildVS2022-1es
162+
163+
templateContext:
164+
type: releaseJob
165+
isProduction: true
166+
inputs:
167+
- input: pipelineArtifact
168+
artifactName: $(ARTIFACT_NAME_WHEEL)
169+
targetPath: $(Build.StagingDirectory)/dist
170+
171+
steps:
172+
- template: MicroBuild.Publish.yml@MicroBuildTemplate
173+
parameters:
174+
intent: PackageDistribution
175+
contentType: PyPi
176+
contentSource: Folder
177+
folderLocation: $(Build.StagingDirectory)/dist
178+
waitForReleaseCompletion: true
179+
180+
approvers: [email protected]

0 commit comments

Comments
 (0)