forked from dotnet/vscode-dotnet-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
152 lines (150 loc) · 4.69 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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)'