-
Notifications
You must be signed in to change notification settings - Fork 5.5k
vscode-test related updates #2695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
464e593
f096f1b
0a7ec59
c719c69
ecc908d
96d9e78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,108 +9,58 @@ MetaDescription: Use Continuous Integration for testing Visual Studio Code exten | |
|
|
||
| # Continuous Integration | ||
|
|
||
| Extension tests can be run on CI services. The `vscode` npm module provides a built-in command (`bin/test`) which: | ||
|
|
||
| 1. Downloads and unzips VS Code; | ||
| 2. Launches your extension tests inside VS Code; | ||
| 3. Prints the results to the console and exits with an appropriate status code. | ||
|
|
||
| The command will expose some optional environment variables, which you can use to customize the build: | ||
|
|
||
| | Name | Description | | ||
| | ------------------------- | ---------------------------------------------------------------------------------------------- | | ||
| | `CODE_VERSION` | Version of VS Code to run the tests against (e.g. `0.10.10`) | | ||
| | `CODE_DOWNLOAD_URL` | Full URL of a VS Code drop to use for running tests against | | ||
| | `CODE_TESTS_PATH` | Location of the tests to execute (default is `process.cwd()/out/test` or `process.cwd()/test`) | | ||
| | `CODE_EXTENSIONS_PATH` | Location of the extensions to load (default is `process.cwd()`) | | ||
| | `CODE_TESTS_WORKSPACE` | Location of a workspace to open for the test instance (default is CODE_TESTS_PATH) | | ||
| | `CODE_LOCALE` | Display language to use when running the tests (default is English) | | ||
| | `CODE_DISABLE_EXTENSIONS` | Disable all other extensions except the one that is being tested | | ||
| | `CODE_TESTS_DATA_DIR` | Allows to specify the user-data-dir for the tests to use and thus enables to run multiple tests at the same time | | ||
| Extension tests can be run on CI services. The `vscode-test` repository itself contains a sample extension that is tested on Azure Devops Pipelines. You can check out the [build pipeline](https://dev.azure.com/vscode/VSCode/_build?definitionId=14) or jump directly to the [build definition yaml file](https://github.com/microsoft/vscode-test/blob/master/azure-pipelines.yml). | ||
|
||
|
|
||
| ## Azure Pipelines | ||
|
|
||
| <a href="https://azure.microsoft.com/services/devops/"><img alt="Azure Pipelines" src="/assets/api/working-with-extensions/continuous-integration/pipelines-logo.png" width="318" /></a> | ||
|
|
||
| You can create free projects on [Azure DevOps](https://azure.microsoft.com/services/devops/). This gives you source code hosting, planning boards, building and testing infrastructure, and more. On top of that, you get [10 free parallel jobs](https://azure.microsoft.com/services/devops/pipelines/) for building your projects across all 3 major platforms: Windows, macOS and Linux. | ||
|
|
||
| After registering and creating your new project, simply add the following `build.yml` to the root of your extension's repository: | ||
| After registering and creating your new project, simply add the following `azure-pipelines.yml` to the root of your extension's repository. Other than the xvfb setup for Linux, the definition is straight-forward: | ||
|
|
||
| ```yaml | ||
| jobs: | ||
| - job: Windows | ||
| pool: | ||
| name: Hosted VS2017 | ||
| demands: npm | ||
| steps: | ||
| - task: NodeTool@0 | ||
| displayName: 'Use Node 8.x' | ||
| inputs: | ||
| versionSpec: 8.x | ||
| - task: Npm@1 | ||
| displayName: 'Install dependencies' | ||
| inputs: | ||
| verbose: false | ||
| - task: Npm@1 | ||
| displayName: 'Compile sources' | ||
| inputs: | ||
| command: custom | ||
| verbose: false | ||
| customCommand: 'run compile' | ||
| - script: 'node node_modules/vscode/bin/test' | ||
| displayName: 'Run tests' | ||
| - job: macOS | ||
| pool: | ||
| name: Hosted macOS | ||
| demands: npm | ||
| steps: | ||
| - task: NodeTool@0 | ||
| displayName: 'Use Node 8.x' | ||
| inputs: | ||
| versionSpec: 8.x | ||
| - task: Npm@1 | ||
| displayName: 'Install dependencies' | ||
| inputs: | ||
| verbose: false | ||
| - task: Npm@1 | ||
| displayName: 'Compile sources' | ||
| inputs: | ||
| command: custom | ||
| verbose: false | ||
| customCommand: 'run compile' | ||
| - script: 'node node_modules/vscode/bin/test' | ||
| displayName: 'Run tests' | ||
| - job: Linux | ||
| pool: | ||
| name: Hosted Ubuntu 1604 | ||
| demands: npm | ||
| steps: | ||
| - task: NodeTool@0 | ||
| displayName: 'Use Node 8.x' | ||
| inputs: | ||
| versionSpec: 8.x | ||
| - task: Npm@1 | ||
| displayName: 'Install dependencies' | ||
| inputs: | ||
| verbose: false | ||
| - task: Npm@1 | ||
| displayName: 'Compile sources' | ||
| inputs: | ||
| command: custom | ||
| verbose: false | ||
| customCommand: 'run compile' | ||
| - script: | | ||
| set -e | ||
| /usr/bin/Xvfb :10 -ac >> /tmp/Xvfb.out 2>&1 & | ||
| disown -ar | ||
| displayName: 'Start xvfb' | ||
| - script: 'node node_modules/vscode/bin/test' | ||
| displayName: 'Run tests' | ||
| env: | ||
| DISPLAY: :10 | ||
| trigger: | ||
| - master | ||
|
|
||
| strategy: | ||
| matrix: | ||
| linux: | ||
| imageName: 'ubuntu-16.04' | ||
| mac: | ||
| imageName: 'macos-10.13' | ||
| windows: | ||
| imageName: 'vs2017-win2016' | ||
|
|
||
| pool: | ||
| vmImage: $(imageName) | ||
|
|
||
| steps: | ||
|
|
||
| - task: NodeTool@0 | ||
| inputs: | ||
| versionSpec: '8.x' | ||
| displayName: 'Install Node.js' | ||
|
|
||
| - bash: | | ||
joaomoreno marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if [ $AGENT_OS == "Linux" ]; then | ||
octref marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| set -e | ||
| /usr/bin/Xvfb :10 -ac >> /tmp/Xvfb.out 2>&1 & | ||
| disown -ar | ||
| echo "Started xvfb" | ||
| fi | ||
| displayName: Start xvfb | ||
|
|
||
| - bash: | | ||
| yarn install | ||
octref marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| yarn compile | ||
| yarn test | ||
| displayName: Run Tests | ||
| env: | ||
| DISPLAY: :10 | ||
| ``` | ||
|
|
||
| Next [create a new Pipeline](https://docs.microsoft.com/azure/devops/pipelines/get-started-yaml?view=vsts#get-your-first-build) in your DevOps project and point it to the `build.yml` file. Trigger a build and voilà: | ||
| Next [create a new Pipeline](https://docs.microsoft.com/azure/devops/pipelines/get-started-yaml?view=vsts#get-your-first-build) in your DevOps project and point it to the `azure-pipelines.yml` file. Trigger a build and voilà: | ||
|
|
||
|  | ||
|
|
||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.

Uh oh!
There was an error while loading. Please reload this page.