22# Licensed under the MIT License.
33
44parameters :
5- - name : prerelease
6- type : boolean
7- default : false
5+ - name : prerelease
6+ type : boolean
7+ default : false
88
99jobs :
10- - job : Build
11- pool :
12- name : VSEngSS-MicroBuild2019-1ES
13- variables :
14- # MicroBuild requires TeamName to be set.
15- TeamName : C++ Cross Platform and Cloud
16- steps :
17- - task : MicroBuildSigningPlugin@3
18- displayName : Install MicroBuild Signing
19- inputs :
20- signType : $(SignType)
21- zipSources : false
22- # MicroBuild signing will always fail on public PRs.
23- condition : ne(variables['Build.Reason'], 'PullRequest')
24-
25- # Run these scanners first so that they don't detect issues in dependencies.
26- # Failures won't break the build until "Check for compliance errors" step.
27- - task : CredScan@3
28- displayName : Run CredScan
29- inputs :
30- toolMajorVersion : V2
31- - task : PoliCheck@2
32- displayName : Run PoliCheck
33- inputs :
34- targetType : F
35- targetArgument : $(Build.SourcesDirectory)
36-
37- # Node 14 matches the version of Node used by VS Code when this was written,
38- # but it should be updated when VS Code updates its Node version.
39- - task : NodeTool@0
40- displayName : Use Node 16.x
41- inputs :
42- versionSpec : 16.x
43-
44- # Override the patch version if this is a pre-release build.
45- - ${{ if parameters.prerelease }} :
46- - pwsh : node -e "p=require('./package.json');p.version=p.version.replace(/\.\d+$/,'.'+$(Build.BuildNumber));require('fs').writeFileSync('./package.json',JSON.stringify(p,undefined,2))"
47-
48- - script : npm install --global gulp node-gyp @vscode/vsce
49- displayName : Install global dependencies
50- - script : npm install
51- displayName : Install project dependencies
52-
53- - task : ComponentGovernanceComponentDetection@0
54- displayName : Detect components
55- - task : notice@0
56- displayName : Generate NOTICE file
57- inputs :
58- outputfile : $(Build.SourcesDirectory)/NOTICE.txt
59- condition : and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
60-
61- - script : gulp tslint
62- displayName : Check for linting errors
63- - script : gulp genAikey
64- displayName : Use production AI key
65- condition : and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
66- # Pack the extension now even though it's unsigned so that we ignore files
67- # from .vscodeignore. This will reduce load on the signing server later and
68- # ensure we only attempt to sign shipping files.
69- - ${{ if parameters.prerelease }} :
70- - script : node build/package.js --pre-release
71- displayName : Build and pack extension
72- - ${{ else }} :
73- - script : node build/package.js
74- displayName : Build and pack extension
75-
76- # Extract the VSIXes, sign what we can, then pack it back up and publish it.
77- - pwsh : |
78- $path = Join-Path $Env:TEMP "7z-installer.exe"
79- Invoke-WebRequest https://www.7-zip.org/a/7z2201-x64.exe -OutFile $path
80- Start-Process -FilePath $path -Args "/S" -Verb RunAs -Wait
81- Remove-Item $path
82- Echo "##vso[task.prependpath]$Env:PROGRAMFILES\7-Zip\"
83- displayName: Install 7zip
84- - pwsh : Get-ChildItem out\vsix | Foreach-Object { 7z x $_.FullName -o$(Build.StagingDirectory)\vscode-arduino\$($_.BaseName) }
85- displayName : Extract extension for signing
86- - task : NuGetToolInstaller@1
87- displayName : Install NuGet
88- - task : NuGetAuthenticate@0
89- displayName : Authenticate NuGet
90- - script : nuget restore .\build\SignFiles.proj -PackagesDirectory .\build\packages
91- displayName : Restore MicroBuild Core
92- # MicroBuild signing will always fail on public PRs.
93- condition : ne(variables['Build.Reason'], 'PullRequest')
94- - task : MSBuild@1
95- displayName : Sign files
96- inputs :
97- solution : .\build\SignFiles.proj
98- msbuildArguments : /p:SignType=$(SignType)
99- # MicroBuild signing will always fail on public PRs.
100- condition : ne(variables['Build.Reason'], 'PullRequest')
101- - pwsh : |
102- Get-ChildItem -Directory $(Build.StagingDirectory)\vscode-arduino | Foreach-Object { 7z a ($_.FullName + ".vsix") ($_.FullName + "\*") -tzip }
103- New-Item -Path $(Build.StagingDirectory)\vscode-arduino\vsix -ItemType Directory
104- Get-Item $(Build.StagingDirectory)\vscode-arduino\*.vsix | Move-Item -Destination $(Build.StagingDirectory)\vscode-arduino\vsix
105- displayName: Pack signed files
106- - task : MSBuild@1
107- displayName : Sign VSIXes
108- inputs :
109- solution : .\build\SignVsix.proj
110- msbuildArguments : /p:SignType=$(SignType)
111- # MicroBuild signing will always fail on public PRs.
112- condition : ne(variables['Build.Reason'], 'PullRequest')
113- - publish : $(Build.StagingDirectory)\vscode-arduino\vsix
114- artifact : extension-vsixes
115- displayName : Publish extension VSIXes as artifact
116-
117- # Install the Arduino IDE and run tests.
118- - script : curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
119- displayName : Download Arduino IDE
120- - script : >-
121- node build/checkHash.js arduino-1.8.19-windows.zip
122- c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945
123- displayName: Verify Arduino IDE
124- - task : ExtractFiles@1
125- displayName : Extract Arduino IDE
126- inputs :
127- archiveFilePatterns : arduino-1.8.19-windows.zip
128- destinationFolder : arduino-ide
129- - script : " echo ##vso[task.prependpath]$(Build.SourcesDirectory)\\ arduino-ide\\ arduino-1.8.19"
130- displayName : Add Arduino IDE to PATH
131- - script : npm test --silent
132- displayName : Run tests
133-
134- - task : PostAnalysis@2
135- displayName : Check for compliance errors
136- # To avoid spirious warnings about missing logs, explicitly declare what we scanned.
137- inputs :
138- CredScan : true
139- PoliCheck : true
140-
141- # Trust Services Automation (TSA) can automatically open bugs for compliance issues.
142- # https://www.1eswiki.com/wiki/Trust_Services_Automation_(TSA)
143- - task : TSAUpload@2
144- displayName : Upload logs to TSA
145- inputs :
146- GdnPublishTsaOnboard : true
147- GdnPublishTsaConfigFile : $(Build.SourcesDirectory)\build\tsa.gdntsa
148- # Don't open bugs for PR builds
149- condition : ne(variables['Build.Reason'], 'PullRequest')
150-
151- - task : GitHubRelease@0
152- displayName : Publish to GitHub
153- inputs :
154- gitHubConnection : embeddedbot
155- repositoryName : microsoft/vscode-arduino
156- action : create
157- target : $(Build.SourceVersion)
158- tagSource : auto
159- assets : $(Build.StagingDirectory)\vscode-arduino\vsix\*.vsix
160- isPreRelease : $[contains(variables['Build.SourceBranch'], '-rc')]
161- condition : and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
162-
163- - task : MicroBuildCleanup@1
164- displayName : Clean up MicroBuild
10+ - job : Build
11+ pool :
12+ name : VSEngSS-MicroBuild2022-1ES
13+ variables :
14+ TeamName : C++ Cross Platform and Cloud
15+ templateContext :
16+ sdl :
17+ ${{ if ne(variables['Build.Reason'], 'PullRequest') }} :
18+ tsa :
19+ enabled : true
20+ GdnPublishTsaOnboard : true
21+ GdnPublishTsaConfigFile : $(Build.SourcesDirectory)\build\tsa.gdntsa
22+ outputs :
23+ - output : pipelineArtifact
24+ displayName : ' Publish extension VSIXes as artifact'
25+ targetPath : $(Build.StagingDirectory)\vscode-arduino\vsix
26+ artifactName : extension-vsixes
27+ sbomBuildDropPath : $(Build.SourcesDirectory)
28+ steps :
29+ - task : MicroBuildSigningPlugin@3
30+ displayName : Install MicroBuild Signing
31+ inputs :
32+ signType : $(SignType)
33+ zipSources : false
34+ condition : ne(variables['Build.Reason'], 'PullRequest')
35+ - task : NodeTool@0
36+ displayName : Use Node 16.x
37+ inputs :
38+ versionSpec : 16.x
39+ - ${{ if parameters.prerelease }} :
40+ - pwsh : node -e "p=require('./package.json');p.version=p.version.replace(/\.\d+$/,'.'+$(Build.BuildNumber));require('fs').writeFileSync('./package.json',JSON.stringify(p,undefined,2))"
41+ - script : npm install --global gulp node-gyp @vscode/vsce
42+ displayName : Install global dependencies
43+ - script : npm install
44+ displayName : Install project dependencies
45+ - task : ComponentGovernanceComponentDetection@0
46+ displayName : Detect components
47+ - task : notice@0
48+ displayName : Generate NOTICE file
49+ inputs :
50+ outputfile : $(Build.SourcesDirectory)/NOTICE.txt
51+ condition : and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
52+ - script : gulp tslint
53+ displayName : Check for linting errors
54+ - script : gulp genAikey
55+ displayName : Use production AI key
56+ condition : and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
57+ - ${{ if parameters.prerelease }} :
58+ - script : node build/package.js --pre-release
59+ displayName : Build and pack extension
60+ - ${{ else }} :
61+ - script : node build/package.js
62+ displayName : Build and pack extension
63+ - pwsh : |
64+ $path = Join-Path $Env:TEMP "7z-installer.exe"
65+ Invoke-WebRequest https://www.7-zip.org/a/7z2201-x64.exe -OutFile $path
66+ Start-Process -FilePath $path -Args "/S" -Verb RunAs -Wait
67+ Remove-Item $path
68+ Echo "##vso[task.prependpath]$Env:PROGRAMFILES\7-Zip\"
69+ displayName: Install 7zip
70+ - pwsh : Get-ChildItem out\vsix | Foreach-Object { 7z x $_.FullName -o$(Build.StagingDirectory)\vscode-arduino\$($_.BaseName) }
71+ displayName : Extract extension for signing
72+ - task : NuGetToolInstaller@1
73+ displayName : Install NuGet
74+ - task : NuGetAuthenticate@0
75+ displayName : Authenticate NuGet
76+ - script : nuget restore .\build\SignFiles.proj -PackagesDirectory .\build\packages
77+ displayName : Restore MicroBuild Core
78+ condition : ne(variables['Build.Reason'], 'PullRequest')
79+ - task : MSBuild@1
80+ displayName : Sign files
81+ inputs :
82+ solution : .\build\SignFiles.proj
83+ msbuildArguments : /p:SignType=$(SignType)
84+ condition : ne(variables['Build.Reason'], 'PullRequest')
85+ - pwsh : |
86+ Get-ChildItem -Directory $(Build.StagingDirectory)\vscode-arduino | Foreach-Object { 7z a ($_.FullName + ".vsix") ($_.FullName + "\*") -tzip }
87+ New-Item -Path $(Build.StagingDirectory)\vscode-arduino\vsix -ItemType Directory
88+ Get-Item $(Build.StagingDirectory)\vscode-arduino\*.vsix | Move-Item -Destination $(Build.StagingDirectory)\vscode-arduino\vsix
89+ displayName: Pack signed files
90+ - task : MSBuild@1
91+ displayName : Sign VSIXes
92+ inputs :
93+ solution : .\build\SignVsix.proj
94+ msbuildArguments : /p:SignType=$(SignType)
95+ condition : ne(variables['Build.Reason'], 'PullRequest')
96+ - script : curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
97+ displayName : Download Arduino IDE
98+ - script : >-
99+ node build/checkHash.js arduino-1.8.19-windows.zip c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945
100+ displayName: Verify Arduino IDE
101+ - task : ExtractFiles@1
102+ displayName : Extract Arduino IDE
103+ inputs :
104+ archiveFilePatterns : arduino-1.8.19-windows.zip
105+ destinationFolder : arduino-ide
106+ - script : " echo ##vso[task.prependpath]$(Build.SourcesDirectory)\\ arduino-ide\\ arduino-1.8.19"
107+ displayName : Add Arduino IDE to PATH
108+ - script : npm test --silent
109+ displayName : Run tests
110+ - task : PostAnalysis@2
111+ displayName : Check for compliance errors
112+ inputs :
113+ CredScan : true
114+ PoliCheck : true
115+ condition : ne(variables['Build.Reason'], 'PullRequest')
116+ - task : GitHubRelease@0
117+ displayName : Publish to GitHub
118+ inputs :
119+ gitHubConnection : embeddedbot
120+ repositoryName : microsoft/vscode-arduino
121+ action : create
122+ target : $(Build.SourceVersion)
123+ tagSource : auto
124+ assets : $(Build.StagingDirectory)\vscode-arduino\vsix\*.vsix
125+ isPreRelease : $[contains(variables['Build.SourceBranch'], '-rc')]
126+ condition : and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
127+ - task : MicroBuildCleanup@1
128+ displayName : Clean up MicroBuild
0 commit comments