From 4f6781f2b607b09d9cc3f30c51e391da959d5046 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 14:05:59 -0700 Subject: [PATCH 01/19] First cut --- RELEASE.md | 92 +++++++++++++ azure-pipelines/release-pypi.yml | 176 +++++++++++++++++++++--- azure-pipelines/template/use_python.xml | 6 + 3 files changed, 256 insertions(+), 18 deletions(-) create mode 100644 RELEASE.md create mode 100644 azure-pipelines/template/use_python.xml diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..47b8ee33 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,92 @@ +# Language Server Protocol types code generator & packages + +This repository contains packages and tools to generate code for [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) types and classes. + +It simplifies the creation of language servers for different programming languages by providing a robust and easy-to-use type generation system. + +➡️ For instructions on how to use the **code generator**, refer to the [Usage](#usage) section. + +➡️ For instructions on existing **plugins and packages** for different languages, refer to the table in the [Existing packages/plugins](#existing-packagesplugins) section. + +➡️ For instructions on how to **create additional plugins** to support more languages, refer to the [Contributing plugins](#contributing-plugins) section. + +# Code Generator Usage + +You will need a Python environment to run the generator. Here are the steps: + +1. Create a Python environment: `python -m venv .venv` + > **Note**: Python 3.8 is the minimum supported version +2. Activate the environment: `.venv\Scripts\activate` (Windows) or `source .venv/bin/activate` (Linux/macOS) +3. Install this repo's tool: `python -m pip install git+https://github.com/microsoft/lsprotocol.git` +4. Run your plugin. You can use the [command line](#command-line) or [Nox](#using-nox) to run the generator. + +## Command line + +Clone this repository and run `generator` as a Python module. + +For example: `python -m generator --plugin dotnet --output-dir ./code` + +```console +>python -m generator --help +usage: __main__.py [-h] [--model [MODEL [MODEL ...]]] --plugin PLUGIN + [--output-dir OUTPUT_DIR] + +Generate types from LSP JSON model. + +optional arguments: + -h, --help show this help message and exit + --model [MODEL [MODEL ...]], -m [MODEL [MODEL ...]] + Path to a model JSON file. By default uses packaged + model file. + --plugin PLUGIN, -p PLUGIN + Name of a builtin plugin module. By default uses all + plugins. + --output-dir OUTPUT_DIR, -o OUTPUT_DIR + Path to a directory where the generated content is +``` + +## Using Nox + +This project uses Nox as a task runner to run the code generator. You can install Nox and run a `build_lsp` session to generate code from the spec available in this repo. + +```console +> python -m pip install nox +> nox --session build_lsp +``` + +You can also use Nox to format code, run tests and run various tasks. Run `nox --list` to see all available tasks. + +# Contributing plugins + +## Adding a new plugin + +Follow these steps to generate boilerplate code for a new plugin: + +1. Create a virtual environment for Python using Python >= 3.8 and activate that environment. + 1. If you are using the Python extension for VS Code, you can just run the **Python: Create Environment** command from the Command Palette. Be sure to select all the `requirements.txt` files in the repo. This command will install all packages needed and select the newly created environment for you. +1. Ensure `nox` is installed. + 1. Run `nox --list` in the terminal. If Nox is installed, you should see a list of all available sessions. Otherwise, run `python -m pip install nox` in the activated environment you created above. +1. Run `nox --session create_plugin` and follow the prompts to create a new plugin. + +Example: + +```console +> nox --session create_plugin +nox > Running session create_plugin +nox > Creating virtual environment (virtualenv) using python.exe in .nox\create_plugin +Enter the name of the plugin: java +nox > Created plugin java. +nox > Session create_plugin was successful. +``` + +# Existing packages/plugins + +Below is the list of plugins already created using this package, with their respective package links. + +| Language | Plugin Module | Package | Status | Documentation | +| ---------------- | ------------------------ | --------------------------------------------------------------------------------------------------- | ----------------- | ----------------------------------------------------------- | +| Python | generator.plugins.python | [![PyPI](https://img.shields.io/pypi/v/lsprotocol?label=lsprotocol)](https://pypi.org/p/lsprotocol) | Active | [Python package README](./packages/python/README.md) | +| Rust | generator.plugins.rust | [![Crates](https://img.shields.io/crates/v/lsprotocol)](https://crates.io/crates/lsprotocol) | Active | [Rust package README](./packages/rust/lsprotocol/README.md) | +| Dotnet | generator.plugins.dotnet | | Under development | +| Crystal | | [nobodywasishere/lsprotocol-crystal](https://github.com/nobodywasishere/lsprotocol-crystal) | Active | [CrystalDoc.info](https://crystaldoc.info/github/nobodywasishere/lsprotocol-crystal/main/index.html) | +| | diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 8443faf9..a5abcd9e 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -1,13 +1,13 @@ +name: Release trigger: none pr: none resources: repositories: - - repository: templates - type: github - name: microsoft/vscode-engineering - ref: main - endpoint: Monaco + - repository: MicroBuildTemplate + type: git + name: 1ESPipelineTemplates/MicroBuildTemplate + ref: refs/tags/release parameters: - name: publishPackage @@ -15,18 +15,158 @@ parameters: type: boolean default: false +variables: + ARTIFACT_NAME_WHEEL: wheel + architecture: x64 + python.version: '3.8' + extends: - template: azure-pipelines/pypi-package/pipeline.yml@templates + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: - publishPackage: ${{ parameters.publishPackage }} - pythonVersion: '3.8' - # We don't ship any built in packages. - generateNotice: false - projectRootDirectory: $(Build.SourcesDirectory)/packages/python - packageName: lsprotocol - buildSteps: - - script: python -m pip install nox - displayName: Install nox - - - script: python -m nox --session build_python_package - displayName: Build package (sdist and wheels) + sdl: + sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + pool: + name: AzurePipelines-EO + demands: + - ImageOverride -equals 1ESPT-Ubuntu22.04 + os: Linux + customBuildTags: + - ES365AIMigrationTooling + stages: + - name: Build + displayName: Build + jobs: + - job: Build + + templateContext: + outputs: + - output: pipelineArtifact + targetPath: $(Build.StagingDirectory)/dist + sbomBuildDropPath: $(Build.StagingDirectory)/dist + artifactName: $(ARTIFACT_NAME_WHEEL) + + steps: + - checkout: self + fetchDepth: 1 + fetchTags: false + + - template: use_python.yml@self + + - script: python -m pip install nox + displayName: Install nox + + - script: python -m nox --session build_python_package + displayName: Build package (sdist and wheels) + + - powershell: | + $releaseVersion = & poetry version --short + echo "releaseVersion: $releaseVersion" + echo "##vso[task.setvariable variable=releaseVersion;isOutput=true]$releaseVersion" + displayName: Get release version + name: getReleaseVersionStep + + - task: CopyFiles@2 + displayName: Copy wheel and tarball + inputs: + sourceFolder: dist + targetFolder: $(Build.StagingDirectory)/dist + contents: | + sarif_tools-$(releaseVersion)-py3-none-any.whl + sarif_tools-$(releaseVersion).tar.gz + + - stage: CreateTag + displayName: Create Tag + dependsOn: Build + variables: + releaseVersionWithPrefix: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersionWithPrefix'] ] + jobs: + - job: CreateTag + steps: + - checkout: self + fetchDepth: 1 + fetchTags: false + persistCredentials: true + + - script: | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "Azure Piplines" + git fetch --depth 1 origin $(Build.SourceBranchName) + git tag -a $(releaseVersionWithPrefix) -m "Release $(releaseVersionWithPrefix)" origin/$(Build.SourceBranchName) + git push origin $(releaseVersionWithPrefix) + displayName: Create git tag + + - stage: CreateRelease + displayName: Create GitHub Release + dependsOn: + - Build + - CreateTag + variables: + releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ] + jobs: + - job: CreateRelease + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: $(ARTIFACT_NAME_WHEEL) + targetPath: $(Build.StagingDirectory)/dist + steps: + - task: GitHubRelease@1 #https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/github-release-v1?view=azure-pipelines + displayName: Create GitHub Release + inputs: + gitHubConnection: GitHub-lsprotocol + repositoryName: microsoft/lsprotocol + action: create + target: $(Build.SourceBranchName) + title: $(releaseVersion) + tag: $(releaseVersion) + tagSource: userSpecifiedTag + isDraft: true + addChangeLog: false + assets: $(Build.StagingDirectory)/dist/* + + - stage: WaitForValidation + dependsOn: CreateRelease + jobs: + - job: wait_for_validation + displayName: Wait for manual validation + pool: server + steps: + - task: ManualValidation@0 + timeoutInMinutes: 1440 # task times out in 1 day + inputs: + notifyUsers: erikd@microsoft.com + instructions: Please test the latest draft release and then publish it. + onTimeout: reject + + - stage: Release + dependsOn: WaitForValidation + condition: and(succeeded(), ${{ parameters.publishPackage }}) + jobs: + - job: PublishToPyPi + displayName: Release to PyPi + + pool: + name: VSEngSS-MicroBuild2022-1ES # This pool is required to have the certs needed to publish to PyPi using ESRP. + os: windows + image: server2022-microbuildVS2022-1es + + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: $(ARTIFACT_NAME_WHEEL) + targetPath: $(Build.StagingDirectory)/dist + + steps: + - template: MicroBuild.Publish.yml@MicroBuildTemplate + parameters: + intent: PackageDistribution + contentType: PyPi + contentSource: Folder + folderLocation: $(Build.StagingDirectory)/dist + waitForReleaseCompletion: true + owners: erikd@microsoft.com + approvers: grwheele@microsoft.com diff --git a/azure-pipelines/template/use_python.xml b/azure-pipelines/template/use_python.xml new file mode 100644 index 00000000..3e277296 --- /dev/null +++ b/azure-pipelines/template/use_python.xml @@ -0,0 +1,6 @@ +steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: "$(python.version)" + architecture: "$(architecture)" + displayName: "Use Python $(python.version) $(architecture)" From 5d92568b138dca1ba8d2d73d1dac7a30fc8bdbef Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 15:22:22 -0700 Subject: [PATCH 02/19] Changes for debugging pipeline on my fork --- azure-pipelines/release-pypi.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index a5abcd9e..468c95b9 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -116,7 +116,7 @@ extends: displayName: Create GitHub Release inputs: gitHubConnection: GitHub-lsprotocol - repositoryName: microsoft/lsprotocol + repositoryName: debonte/lsprotocol action: create target: $(Build.SourceBranchName) title: $(releaseVersion) @@ -161,12 +161,14 @@ extends: targetPath: $(Build.StagingDirectory)/dist steps: - - template: MicroBuild.Publish.yml@MicroBuildTemplate - parameters: - intent: PackageDistribution - contentType: PyPi - contentSource: Folder - folderLocation: $(Build.StagingDirectory)/dist - waitForReleaseCompletion: true - owners: erikd@microsoft.com - approvers: grwheele@microsoft.com + # - template: MicroBuild.Publish.yml@MicroBuildTemplate + # parameters: + # intent: PackageDistribution + # contentType: PyPi + # contentSource: Folder + # folderLocation: $(Build.StagingDirectory)/dist + # waitForReleaseCompletion: true + # owners: erikd@microsoft.com + # approvers: grwheele@microsoft.com + + - script: dir $(Build.StagingDirectory)/dist From c401e6b06256837772fa790e15e401d550740034 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 16:41:25 -0700 Subject: [PATCH 03/19] Fix location and name of whl and tarball --- azure-pipelines/release-pypi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 468c95b9..5515ed41 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -68,11 +68,11 @@ extends: - task: CopyFiles@2 displayName: Copy wheel and tarball inputs: - sourceFolder: dist + sourceFolder: packages/python/dist targetFolder: $(Build.StagingDirectory)/dist contents: | - sarif_tools-$(releaseVersion)-py3-none-any.whl - sarif_tools-$(releaseVersion).tar.gz + lsprotocol-$(releaseVersion)-py3-none-any.whl + lsprotocol-$(releaseVersion).tar.gz - stage: CreateTag displayName: Create Tag From 32b67f842743ec1f874666472fbe1ca1d71137c3 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 16:43:18 -0700 Subject: [PATCH 04/19] Fix releaseVersion var naming --- azure-pipelines/release-pypi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 5515ed41..66cf0be3 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -78,7 +78,7 @@ extends: displayName: Create Tag dependsOn: Build variables: - releaseVersionWithPrefix: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersionWithPrefix'] ] + releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ] jobs: - job: CreateTag steps: @@ -91,8 +91,8 @@ extends: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "Azure Piplines" git fetch --depth 1 origin $(Build.SourceBranchName) - git tag -a $(releaseVersionWithPrefix) -m "Release $(releaseVersionWithPrefix)" origin/$(Build.SourceBranchName) - git push origin $(releaseVersionWithPrefix) + git tag -a $(releaseVersion) -m "Release $(releaseVersion)" origin/$(Build.SourceBranchName) + git push origin $(releaseVersion) displayName: Create git tag - stage: CreateRelease From c90724d7303e2177b7549d95a6252166daa4896a Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 16:45:20 -0700 Subject: [PATCH 05/19] Fix root element name of first stage --- azure-pipelines/release-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 66cf0be3..3725a5fd 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -33,7 +33,7 @@ extends: customBuildTags: - ES365AIMigrationTooling stages: - - name: Build + - stage: Build displayName: Build jobs: - job: Build From bcf43db40a2f536b900144ddb4ede5c8dedf4cdf Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 16:51:44 -0700 Subject: [PATCH 06/19] First cut on RELEASE.md --- RELEASE.md | 93 +++--------------------------------------------------- 1 file changed, 4 insertions(+), 89 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 47b8ee33..dfecf93c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,92 +1,7 @@ -# Language Server Protocol types code generator & packages +# Release Process -This repository contains packages and tools to generate code for [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) types and classes. +1. Run and generate the latest from spec. Then clone pygls, run their setup, then install the generated lsprotocol, run tests and see if anything breaks. If something breaks it is likely in pygls, just update and ship -It simplifies the creation of language servers for different programming languages by providing a robust and easy-to-use type generation system. +There isn't a wiki. I just follow the guidelines on pygls, to setup the testing and run tests. Then install the local lsprotocol version on top of it, run tests again to see if anything breaks. -➡️ For instructions on how to use the **code generator**, refer to the [Usage](#usage) section. - -➡️ For instructions on existing **plugins and packages** for different languages, refer to the table in the [Existing packages/plugins](#existing-packagesplugins) section. - -➡️ For instructions on how to **create additional plugins** to support more languages, refer to the [Contributing plugins](#contributing-plugins) section. - -# Code Generator Usage - -You will need a Python environment to run the generator. Here are the steps: - -1. Create a Python environment: `python -m venv .venv` - > **Note**: Python 3.8 is the minimum supported version -2. Activate the environment: `.venv\Scripts\activate` (Windows) or `source .venv/bin/activate` (Linux/macOS) -3. Install this repo's tool: `python -m pip install git+https://github.com/microsoft/lsprotocol.git` -4. Run your plugin. You can use the [command line](#command-line) or [Nox](#using-nox) to run the generator. - -## Command line - -Clone this repository and run `generator` as a Python module. - -For example: `python -m generator --plugin dotnet --output-dir ./code` - -```console ->python -m generator --help -usage: __main__.py [-h] [--model [MODEL [MODEL ...]]] --plugin PLUGIN - [--output-dir OUTPUT_DIR] - -Generate types from LSP JSON model. - -optional arguments: - -h, --help show this help message and exit - --model [MODEL [MODEL ...]], -m [MODEL [MODEL ...]] - Path to a model JSON file. By default uses packaged - model file. - --plugin PLUGIN, -p PLUGIN - Name of a builtin plugin module. By default uses all - plugins. - --output-dir OUTPUT_DIR, -o OUTPUT_DIR - Path to a directory where the generated content is -``` - -## Using Nox - -This project uses Nox as a task runner to run the code generator. You can install Nox and run a `build_lsp` session to generate code from the spec available in this repo. - -```console -> python -m pip install nox -> nox --session build_lsp -``` - -You can also use Nox to format code, run tests and run various tasks. Run `nox --list` to see all available tasks. - -# Contributing plugins - -## Adding a new plugin - -Follow these steps to generate boilerplate code for a new plugin: - -1. Create a virtual environment for Python using Python >= 3.8 and activate that environment. - 1. If you are using the Python extension for VS Code, you can just run the **Python: Create Environment** command from the Command Palette. Be sure to select all the `requirements.txt` files in the repo. This command will install all packages needed and select the newly created environment for you. -1. Ensure `nox` is installed. - 1. Run `nox --list` in the terminal. If Nox is installed, you should see a list of all available sessions. Otherwise, run `python -m pip install nox` in the activated environment you created above. -1. Run `nox --session create_plugin` and follow the prompts to create a new plugin. - -Example: - -```console -> nox --session create_plugin -nox > Running session create_plugin -nox > Creating virtual environment (virtualenv) using python.exe in .nox\create_plugin -Enter the name of the plugin: java -nox > Created plugin java. -nox > Session create_plugin was successful. -``` - -# Existing packages/plugins - -Below is the list of plugins already created using this package, with their respective package links. - -| Language | Plugin Module | Package | Status | Documentation | -| ---------------- | ------------------------ | --------------------------------------------------------------------------------------------------- | ----------------- | ----------------------------------------------------------- | -| Python | generator.plugins.python | [![PyPI](https://img.shields.io/pypi/v/lsprotocol?label=lsprotocol)](https://pypi.org/p/lsprotocol) | Active | [Python package README](./packages/python/README.md) | -| Rust | generator.plugins.rust | [![Crates](https://img.shields.io/crates/v/lsprotocol)](https://crates.io/crates/lsprotocol) | Active | [Rust package README](./packages/rust/lsprotocol/README.md) | -| Dotnet | generator.plugins.dotnet | | Under development | -| Crystal | | [nobodywasishere/lsprotocol-crystal](https://github.com/nobodywasishere/lsprotocol-crystal) | Active | [CrystalDoc.info](https://crystaldoc.info/github/nobodywasishere/lsprotocol-crystal/main/index.html) | -| | +You will want to duplicate the azure-publish pipeline for lsprotocol package (not the generator). the generator is not published. From 45030b834317c289f0d8f57b05cca7b1926b589e Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 16:52:58 -0700 Subject: [PATCH 07/19] Fix extension on use_python.yml --- azure-pipelines/release-pypi.yml | 6 +++++- azure-pipelines/template/{use_python.xml => use_python.yml} | 0 2 files changed, 5 insertions(+), 1 deletion(-) rename azure-pipelines/template/{use_python.xml => use_python.yml} (100%) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 3725a5fd..80767800 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -50,7 +50,11 @@ extends: fetchDepth: 1 fetchTags: false - - template: use_python.yml@self + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + architecture: '$(architecture)' + displayName: 'Use Python $(python.version) $(architecture)' - script: python -m pip install nox displayName: Install nox diff --git a/azure-pipelines/template/use_python.xml b/azure-pipelines/template/use_python.yml similarity index 100% rename from azure-pipelines/template/use_python.xml rename to azure-pipelines/template/use_python.yml From ce537905d81658af4a43df99de413cf62e440dd1 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 17:09:59 -0700 Subject: [PATCH 08/19] Use toml-cli to get version from pyproject.toml --- azure-pipelines/release-pypi.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 80767800..73d6fbcc 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -63,7 +63,8 @@ extends: displayName: Build package (sdist and wheels) - powershell: | - $releaseVersion = & poetry version --short + python -m pip install toml-cli + $releaseVersion = & toml get --toml-path packages/python/pyproject.toml project.version echo "releaseVersion: $releaseVersion" echo "##vso[task.setvariable variable=releaseVersion;isOutput=true]$releaseVersion" displayName: Get release version From 0e3dba36484d7dceb2234c9f8eba8c75013b2fc2 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 17:20:48 -0700 Subject: [PATCH 09/19] Add TeamName var for MicroBuild Telemetry step --- azure-pipelines/release-pypi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 73d6fbcc..c0501627 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -19,6 +19,7 @@ variables: ARTIFACT_NAME_WHEEL: wheel architecture: x64 python.version: '3.8' + TeamName: lsprotocol extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate From 48ca3451b11b281c087bbe5d3c18cc9209ae5e72 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 17:29:52 -0700 Subject: [PATCH 10/19] Add step to inspect dist dir --- azure-pipelines/release-pypi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index c0501627..a28fe658 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -71,6 +71,8 @@ extends: displayName: Get release version name: getReleaseVersionStep + - script: ls -al packages/python/dist + - task: CopyFiles@2 displayName: Copy wheel and tarball inputs: From c5c8c4c507b3b5f69f77af3ce9573b8d99aa1faa Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 17:35:27 -0700 Subject: [PATCH 11/19] Fix reference to releaseVersion var in CopyFiles --- azure-pipelines/release-pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index a28fe658..0f9e38b7 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -79,8 +79,8 @@ extends: sourceFolder: packages/python/dist targetFolder: $(Build.StagingDirectory)/dist contents: | - lsprotocol-$(releaseVersion)-py3-none-any.whl - lsprotocol-$(releaseVersion).tar.gz + lsprotocol-$(getReleaseVersionStep.releaseVersion)-py3-none-any.whl + lsprotocol-$(getReleaseVersionStep.releaseVersion).tar.gz - stage: CreateTag displayName: Create Tag From 657d2b8bd9a64ce4c0d5757e16143148ba13f0e0 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 23 May 2025 17:48:54 -0700 Subject: [PATCH 12/19] Move publishPackage condition back to the wait step --- azure-pipelines/release-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 0f9e38b7..364b7f3e 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -136,6 +136,7 @@ extends: - stage: WaitForValidation dependsOn: CreateRelease + condition: and(succeeded(), ${{ parameters.publishPackage }}) jobs: - job: wait_for_validation displayName: Wait for manual validation @@ -150,7 +151,6 @@ extends: - stage: Release dependsOn: WaitForValidation - condition: and(succeeded(), ${{ parameters.publishPackage }}) jobs: - job: PublishToPyPi displayName: Release to PyPi From 059de40983bf3e5b0a5cfee00d1c1beee1ffe537 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Tue, 27 May 2025 17:21:38 -0700 Subject: [PATCH 13/19] / -> \ on dir command --- azure-pipelines/release-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index 364b7f3e..afbde27d 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -179,4 +179,4 @@ extends: # owners: erikd@microsoft.com # approvers: grwheele@microsoft.com - - script: dir $(Build.StagingDirectory)/dist + - script: dir $(Build.StagingDirectory)\dist From d65aa1821c78ccb97331e4e5dc1751e0410037c3 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Wed, 28 May 2025 16:34:18 -0700 Subject: [PATCH 14/19] Revert "Changes for debugging pipeline on my fork" This reverts commit 5d92568b138dca1ba8d2d73d1dac7a30fc8bdbef. --- azure-pipelines/release-pypi.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/azure-pipelines/release-pypi.yml b/azure-pipelines/release-pypi.yml index afbde27d..f7e38756 100644 --- a/azure-pipelines/release-pypi.yml +++ b/azure-pipelines/release-pypi.yml @@ -124,7 +124,7 @@ extends: displayName: Create GitHub Release inputs: gitHubConnection: GitHub-lsprotocol - repositoryName: debonte/lsprotocol + repositoryName: microsoft/lsprotocol action: create target: $(Build.SourceBranchName) title: $(releaseVersion) @@ -169,14 +169,12 @@ extends: targetPath: $(Build.StagingDirectory)/dist steps: - # - template: MicroBuild.Publish.yml@MicroBuildTemplate - # parameters: - # intent: PackageDistribution - # contentType: PyPi - # contentSource: Folder - # folderLocation: $(Build.StagingDirectory)/dist - # waitForReleaseCompletion: true - # owners: erikd@microsoft.com - # approvers: grwheele@microsoft.com - - - script: dir $(Build.StagingDirectory)\dist + - template: MicroBuild.Publish.yml@MicroBuildTemplate + parameters: + intent: PackageDistribution + contentType: PyPi + contentSource: Folder + folderLocation: $(Build.StagingDirectory)/dist + waitForReleaseCompletion: true + owners: erikd@microsoft.com + approvers: grwheele@microsoft.com From b8e68b042d80c1ae6a487c1f72d9785b6d21de08 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Wed, 28 May 2025 18:22:05 -0700 Subject: [PATCH 15/19] More detail in RELEASE.md; still wip' --- RELEASE.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index dfecf93c..0cbc1413 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,7 +1,29 @@ -# Release Process +# Update LSP spec -1. Run and generate the latest from spec. Then clone pygls, run their setup, then install the generated lsprotocol, run tests and see if anything breaks. If something breaks it is likely in pygls, just update and ship +1. `nox --session update_lsp` -There isn't a wiki. I just follow the guidelines on pygls, to setup the testing and run tests. Then install the local lsprotocol version on top of it, run tests again to see if anything breaks. +# How to ship a release + +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: + | Release type | Version format | Notes | + |--------------|----------------|-------| + | Stable | YYYY.0.N | `N` starts at `0` and increments with each release during the year | + | Beta | YYYY.0.NbX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each beta release until stable is shipped | + | Alpha | YYYY.0.NaX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each alpha release until a beta is shipped | -You will want to duplicate the azure-publish pipeline for lsprotocol package (not the generator). the generator is not published. +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. +1. Wait for the pipeline to reach the `WaitForValidation` stage. +1. Run the `pygls` tests against the new release: + 1. `git clone https://github.com/openlawlibrary/pygls` + 1. `cd pygls` + 1. `poetry install --all-extras` -- Note the path to the generated virtualenv + 1. `poetry run poe test` + 1. Download the `lsprotocol-*.tar.gz` file from the Github Release created by the pipeline. + 1. Remove the `lsprotocol` directory in the Poetry virtualenv and create a new one using the `lsprotocol` directory within the `tar.gz`. + 1. Rerun the tests + 1. `poetry run poe test-pyodide` +1. and generate the latest from spec. Then clone pygls, run their setup, then install the generated lsprotocol, run tests and see if anything breaks. If something breaks it is likely in pygls, just update and ship +1. Once you're satisfied with the release, publish it by going to the `lsprotocol-Release` pipeline run that you started earlier and press the blue `Review` button and then the blue `Resume` button to initiate publishing. +1. Publish the GitHub release (it was created as a draft). + +There isn't a wiki. I just follow the guidelines on pygls, to setup the testing and run tests. Then install the local lsprotocol version on top of it, run tests again to see if anything breaks. From b9f0b6558978ffbc5fdb6fac15a17b171a081214 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Thu, 29 May 2025 15:30:45 -0700 Subject: [PATCH 16/19] Clean up RELEASE.md --- RELEASE.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 0cbc1413..6f889fa5 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,7 +1,3 @@ -# Update LSP spec - -1. `nox --session update_lsp` - # How to ship a release 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: @@ -17,13 +13,9 @@ 1. `git clone https://github.com/openlawlibrary/pygls` 1. `cd pygls` 1. `poetry install --all-extras` -- Note the path to the generated virtualenv - 1. `poetry run poe test` + 1. `poetry run poe test` -- Baseline. Don't run their `test-pyodide` tests. 1. Download the `lsprotocol-*.tar.gz` file from the Github Release created by the pipeline. 1. Remove the `lsprotocol` directory in the Poetry virtualenv and create a new one using the `lsprotocol` directory within the `tar.gz`. 1. Rerun the tests - 1. `poetry run poe test-pyodide` -1. and generate the latest from spec. Then clone pygls, run their setup, then install the generated lsprotocol, run tests and see if anything breaks. If something breaks it is likely in pygls, just update and ship -1. Once you're satisfied with the release, publish it by going to the `lsprotocol-Release` pipeline run that you started earlier and press the blue `Review` button and then the blue `Resume` button to initiate publishing. +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. 1. Publish the GitHub release (it was created as a draft). - -There isn't a wiki. I just follow the guidelines on pygls, to setup the testing and run tests. Then install the local lsprotocol version on top of it, run tests again to see if anything breaks. From 2a77346acbf54da7a40d0b57906e5a842f3ac6af Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Thu, 29 May 2025 15:32:03 -0700 Subject: [PATCH 17/19] Remove use_python.yml since it has been inlined (1 spot) --- azure-pipelines/template/use_python.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 azure-pipelines/template/use_python.yml diff --git a/azure-pipelines/template/use_python.yml b/azure-pipelines/template/use_python.yml deleted file mode 100644 index 3e277296..00000000 --- a/azure-pipelines/template/use_python.yml +++ /dev/null @@ -1,6 +0,0 @@ -steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: "$(python.version)" - architecture: "$(architecture)" - displayName: "Use Python $(python.version) $(architecture)" From 0700306351c21ba8efd20dbf0f85a9d6a478fc06 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Thu, 29 May 2025 15:34:14 -0700 Subject: [PATCH 18/19] Add rc versioning to RELEASE.md --- RELEASE.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 6f889fa5..08ed5bb3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -4,8 +4,9 @@ | Release type | Version format | Notes | |--------------|----------------|-------| | Stable | YYYY.0.N | `N` starts at `0` and increments with each release during the year | - | Beta | YYYY.0.NbX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each beta release until stable is shipped | - | Alpha | YYYY.0.NaX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each alpha release until a beta is shipped | + | Release candidate | YYYY.O.NrcX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each RC | + | Beta | YYYY.0.NbX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each beta release | + | Alpha | YYYY.0.NaX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each alpha release | 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. 1. Wait for the pipeline to reach the `WaitForValidation` stage. From 586224ff1f2399fa84eda676b25c876f8977a8c6 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Thu, 29 May 2025 15:35:55 -0700 Subject: [PATCH 19/19] More RELEASE.md cleanup --- RELEASE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 08ed5bb3..a16a883a 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -13,10 +13,10 @@ 1. Run the `pygls` tests against the new release: 1. `git clone https://github.com/openlawlibrary/pygls` 1. `cd pygls` - 1. `poetry install --all-extras` -- Note the path to the generated virtualenv - 1. `poetry run poe test` -- Baseline. Don't run their `test-pyodide` tests. + 1. `poetry install --all-extras` -- Save the path to the generated virtualenv + 1. `poetry run poe test` -- Baseline. Note which tests fail, if any. Don't run their `test-pyodide` tests. 1. Download the `lsprotocol-*.tar.gz` file from the Github Release created by the pipeline. 1. Remove the `lsprotocol` directory in the Poetry virtualenv and create a new one using the `lsprotocol` directory within the `tar.gz`. - 1. Rerun the tests + 1. Rerun the tests -- Compare against baseline. 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. 1. Publish the GitHub release (it was created as a draft).