vscode-dotnet-runtime/azure-pipelines.yml

153 строки
4.7 KiB
YAML

trigger:
batch: true
branches:
include:
- main
tags:
include:
- SDK-v*
- Runtime-v*
pr:
autoCancel: false
branches:
include:
- '*'
variables:
- name: is-runtime-release
value: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/Runtime-v')]
- name: is-sdk-release
value: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/SDK-v')]
- name: Codeql.Enabled
value: true
stages:
##### Test and Build #####
- stage: Build
jobs:
##### Build #####
- job: Build
displayName: 'Build and Test'
pool:
vmImage: $(imageName)
strategy:
matrix:
Linux:
imageName: 'ubuntu-latest'
Mac:
imageName: 'macOS-latest'
Windows:
imageName: 'windows-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '16.10.0'
displayName: 'Install Node.js'
- script: build.cmd
displayName: Build Windows
condition: eq(variables['Agent.OS'], 'Windows_NT')
- script: test.cmd
displayName: Test Windows
condition: eq(variables['Agent.OS'], 'Windows_NT')
- bash: |
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
echo ">>> Started xvfb"
displayName: Start xvfb
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- script: ./build.sh
displayName: Build Mac and Linux
condition: or(eq(variables['Agent.OS'], 'Darwin'), eq(variables['Agent.OS'], 'Linux'))
- script: ./test.sh
displayName: Test Mac and Linux
env: { DISPLAY: ':99.0' }
condition: or(eq(variables['Agent.OS'], 'Darwin'), eq(variables['Agent.OS'], 'Linux'))
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.SourcesDirectory)/vscode-dotnet-runtime-extension/dist/test/functional/logs'
artifactName: 'logs'
displayName: Publish Logs
condition: always()
##### TSLint #####
- job: TSLint
displayName: 'TSLint'
pool:
vmImage: 'windows-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '16.10.0'
displayName: 'Install Node.js'
- bash: |
npm install --cache /temp/empty-cache
npm install tslint --reg https://registry.npmjs.org/ --verbose
npm run lint
displayName: Run Lint
##### Verify NPM and Yarn are in sync #####
- job: SyncPackageManagers
displayName: 'Verify NPM & Yarn In-Sync [Local Copy of Target Branch Must Be Up to Date]'
pool:
vmImage: 'windows-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true
architecture: 'x64'
- task: PythonScript@0
continueOnError: true
inputs:
scriptSource: 'filePath'
scriptPath: 'dependency-verifier.py'
arguments: '$(System.PullRequest.TargetBranch)'
##### Package and Publish #####
- job: Package
displayName: 'Package and Publish'
dependsOn:
- Build
- TSLint
condition: succeeded()
pool:
vmImage: 'windows-latest'
strategy:
matrix:
Runtime:
dir-name: 'vscode-dotnet-runtime-extension'
package-name: 'vscode-dotnet-runtime'
SDK:
dir-name: 'vscode-dotnet-sdk-extension'
package-name: 'vscode-dotnet-sdk'
steps:
- task: NodeTool@0
inputs:
versionSpec: '16.10.0'
displayName: 'Install Node.js'
- bash: |
if ([ $(is-sdk-release) = 'True' ] && [ $(package-name) = 'vscode-dotnet-sdk' ]) || ([ $(is-runtime-release) = 'True' ] && [ $(package-name) = 'vscode-dotnet-runtime' ]); then
VERSION=`node -p "require('./package.json').version"`
else
VERSION_NUM=`node -p "require('./package.json').version"`
VERSION="$VERSION_NUM-alpha-$(Build.BuildId)"
fi
npm version $VERSION --allow-same-version
echo "##vso[task.setvariable variable=version;isOutput=true]$VERSION"
name: GetVersion
displayName: 'Get Version'
workingDirectory: $(dir-name)
- bash: |
npm install rimraf --reg https://registry.npmjs.org/ --verbose
npm install vsce -g --reg https://registry.npmjs.org/ --verbose
vsce package -o $(package-name)-$(GetVersion.version).vsix --ignoreFile ../.vscodeignore --yarn
displayName: Package Artifact
workingDirectory: $(dir-name)
- task: CopyFiles@2
displayName: 'Copy Artifact'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**\*.vsix'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
- task: PublishPipelineArtifact@0
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(dir-name)'