Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 3ceab6a

Browse files
authored
Merge pull request #1605 from microsoft/dev/bemcmorr/add-prerelease
Add pipeline for publishing pre-release builds
2 parents 3b17766 + fd2a3be commit 3ceab6a

File tree

5 files changed

+226
-159
lines changed

5 files changed

+226
-159
lines changed

azure-pipelines.yml

+2-157
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ pool:
2828
name: VSEngSS-MicroBuild2019-1ES
2929

3030
variables:
31-
# MicroBuild requires TeamName to be set.
32-
TeamName: C++ Cross Platform and Cloud
3331
# If the user didn't override the signing type, then only real-sign on tags or
3432
# the main branch.
3533
${{ if ne(parameters.SignTypeOverride, 'default') }}:
@@ -39,158 +37,5 @@ variables:
3937
${{ if and(eq(parameters.SignTypeOverride, 'default'), not(or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'main')))) }}:
4038
SignType: test
4139

42-
steps:
43-
- task: MicroBuildSigningPlugin@3
44-
displayName: Install MicroBuild Signing
45-
inputs:
46-
signType: $(SignType)
47-
zipSources: false
48-
# MicroBuild signing will always fail on public PRs.
49-
condition: ne(variables['Build.Reason'], 'PullRequest')
50-
51-
# Run these scanners first so that they don't detect issues in dependencies.
52-
# Failures won't break the build until "Check for compliance errors" step.
53-
- task: CredScan@2
54-
displayName: Run CredScan
55-
inputs:
56-
toolMajorVersion: V2
57-
- task: PoliCheck@1
58-
displayName: Run PoliCheck
59-
inputs:
60-
targetType: F
61-
targetArgument: $(Build.SourcesDirectory)
62-
63-
# Node 14 matches the version of Node used by VS Code when this was written,
64-
# but it should be updated when VS Code updates its Node version.
65-
- task: NodeTool@0
66-
displayName: Use Node 16.x
67-
inputs:
68-
versionSpec: 16.x
69-
- script: npm install --global gulp node-gyp @vscode/vsce
70-
displayName: Install global dependencies
71-
- script: npm install
72-
displayName: Install project dependencies
73-
74-
- task: ComponentGovernanceComponentDetection@0
75-
displayName: Detect components
76-
- task: notice@0
77-
displayName: Generate NOTICE file
78-
inputs:
79-
outputfile: $(Build.SourcesDirectory)/NOTICE.txt
80-
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
81-
82-
- script: gulp tslint
83-
displayName: Check for linting errors
84-
- script: gulp genAikey
85-
displayName: Use production AI key
86-
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
87-
# Pack the extension now even though it's unsigned so that we ignore files
88-
# from .vscodeignore. This will reduce load on the signing server later and
89-
# ensure we only attempt to sign shipping files.
90-
- script: node build/package.js
91-
displayName: Build and pack extension
92-
93-
# Extract the VSIXes, sign what we can, then pack it back up and publish it.
94-
- pwsh: |
95-
$path = Join-Path $Env:TEMP "7z-installer.exe"
96-
Invoke-WebRequest https://www.7-zip.org/a/7z2201-x64.exe -OutFile $path
97-
Start-Process -FilePath $path -Args "/S" -Verb RunAs -Wait
98-
Remove-Item $path
99-
Echo "##vso[task.prependpath]$Env:PROGRAMFILES\7-Zip\"
100-
displayName: Install 7zip
101-
- pwsh: Get-ChildItem out\vsix | Foreach-Object { 7z x $_.FullName -o$(Build.StagingDirectory)\vscode-arduino\$($_.BaseName) }
102-
displayName: Extract extension for signing
103-
- task: NuGetToolInstaller@1
104-
displayName: Install NuGet
105-
- task: NuGetAuthenticate@0
106-
displayName: Authenticate NuGet
107-
- script: nuget restore .\build\SignFiles.proj -PackagesDirectory .\build\packages
108-
displayName: Restore MicroBuild Core
109-
# MicroBuild signing will always fail on public PRs.
110-
condition: ne(variables['Build.Reason'], 'PullRequest')
111-
- task: MSBuild@1
112-
displayName: Sign files
113-
inputs:
114-
solution: .\build\SignFiles.proj
115-
msbuildArguments: /p:SignType=$(SignType)
116-
# MicroBuild signing will always fail on public PRs.
117-
condition: ne(variables['Build.Reason'], 'PullRequest')
118-
- pwsh: |
119-
Get-ChildItem -Directory $(Build.StagingDirectory)\vscode-arduino | Foreach-Object { 7z a ($_.FullName + ".vsix") ($_.FullName + "\*") -tzip }
120-
New-Item -Path $(Build.StagingDirectory)\vscode-arduino\vsix -ItemType Directory
121-
Get-Item $(Build.StagingDirectory)\vscode-arduino\*.vsix | Move-Item -Destination $(Build.StagingDirectory)\vscode-arduino\vsix
122-
displayName: Pack signed files
123-
- task: MSBuild@1
124-
displayName: Sign VSIXes
125-
inputs:
126-
solution: .\build\SignVsix.proj
127-
msbuildArguments: /p:SignType=$(SignType)
128-
# MicroBuild signing will always fail on public PRs.
129-
condition: ne(variables['Build.Reason'], 'PullRequest')
130-
- publish: $(Build.StagingDirectory)\vscode-arduino\vsix
131-
artifact: VS Code extension VSIXes
132-
displayName: Publish extension VSIXes as artifact
133-
134-
# Install the Arduino IDE and run tests.
135-
- script: curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
136-
displayName: Download Arduino IDE
137-
- script: >-
138-
node build/checkHash.js arduino-1.8.19-windows.zip
139-
c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945
140-
displayName: Verify Arduino IDE
141-
- task: ExtractFiles@1
142-
displayName: Extract Arduino IDE
143-
inputs:
144-
archiveFilePatterns: arduino-1.8.19-windows.zip
145-
destinationFolder: arduino-ide
146-
- script: "echo ##vso[task.prependpath]$(Build.SourcesDirectory)\\arduino-ide\\arduino-1.8.19"
147-
displayName: Add Arduino IDE to PATH
148-
- script: npm test --silent
149-
displayName: Run tests
150-
151-
- task: PostAnalysis@1
152-
displayName: Check for compliance errors
153-
# To avoid spirious warnings about missing logs, explicitly declare what we scanned.
154-
inputs:
155-
CredScan: true
156-
PoliCheck: true
157-
158-
# Trust Services Automation (TSA) can automatically open bugs for compliance issues.
159-
# https://www.1eswiki.com/wiki/Trust_Services_Automation_(TSA)
160-
- task: TSAUpload@1
161-
displayName: Upload logs to TSA
162-
inputs:
163-
tsaVersion: TsaV2
164-
codebase: NewOrUpdate
165-
codeBaseName: vscode-arduino
166-
notificationAlias: [email protected]
167-
instanceUrlForTsaV2: DEVDIV
168-
projectNameDEVDIV: DevDiv
169-
areaPath: DevDiv\Cpp Developer Experience\Cross Platform\Embedded
170-
iterationPath: DevDiv
171-
# To avoid spurious warnings about missing logs, explicitly declare what we don't upload.
172-
uploadAPIScan: false
173-
uploadBinSkim: false
174-
uploadFortifySCA: false
175-
uploadFxCop: false
176-
uploadModernCop: false
177-
uploadPREfast: false
178-
uploadRoslyn: false
179-
uploadTSLint: false
180-
# Don't open bugs for PR builds
181-
condition: ne(variables['Build.Reason'], 'PullRequest')
182-
183-
- task: GitHubRelease@0
184-
displayName: Publish to GitHub
185-
inputs:
186-
gitHubConnection: embeddedbot
187-
repositoryName: microsoft/vscode-arduino
188-
action: create
189-
target: $(Build.SourceVersion)
190-
tagSource: auto
191-
assets: $(Build.StagingDirectory)\vscode-arduino\vsix\*.vsix
192-
isPreRelease: $[contains(variables['Build.SourceBranch'], '-rc')]
193-
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
194-
195-
- task: MicroBuildCleanup@1
196-
displayName: Clean up MicroBuild
40+
jobs:
41+
- template: build/build.yml

build/build.yml

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
parameters:
5+
- name: prerelease
6+
type: boolean
7+
default: false
8+
9+
jobs:
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@2
28+
displayName: Run CredScan
29+
inputs:
30+
toolMajorVersion: V2
31+
- task: PoliCheck@1
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@1
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@1
144+
displayName: Upload logs to TSA
145+
inputs:
146+
tsaVersion: TsaV2
147+
codebase: NewOrUpdate
148+
codeBaseName: vscode-arduino
149+
notificationAlias: [email protected]
150+
instanceUrlForTsaV2: DEVDIV
151+
projectNameDEVDIV: DevDiv
152+
areaPath: DevDiv\Cpp Developer Experience\Cross Platform\Embedded
153+
iterationPath: DevDiv
154+
# To avoid spurious warnings about missing logs, explicitly declare what we don't upload.
155+
uploadAPIScan: false
156+
uploadBinSkim: false
157+
uploadFortifySCA: false
158+
uploadFxCop: false
159+
uploadModernCop: false
160+
uploadPREfast: false
161+
uploadRoslyn: false
162+
uploadTSLint: false
163+
# Don't open bugs for PR builds
164+
condition: ne(variables['Build.Reason'], 'PullRequest')
165+
166+
- task: GitHubRelease@0
167+
displayName: Publish to GitHub
168+
inputs:
169+
gitHubConnection: embeddedbot
170+
repositoryName: microsoft/vscode-arduino
171+
action: create
172+
target: $(Build.SourceVersion)
173+
tagSource: auto
174+
assets: $(Build.StagingDirectory)\vscode-arduino\vsix\*.vsix
175+
isPreRelease: $[contains(variables['Build.SourceBranch'], '-rc')]
176+
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
177+
178+
- task: MicroBuildCleanup@1
179+
displayName: Clean up MicroBuild

build/prerelease.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# This will become the patch digit on the extension version. To avoid potential
5+
# issues, it uses a two digit year to keep the entire number well under 2^31-1.
6+
name: $(Date:yyMMdd)$(Rev:rrr)
7+
8+
trigger: none
9+
pr: none
10+
schedules:
11+
- cron: "0 2 * * *"
12+
displayName: Daily 2 AM
13+
branches:
14+
include:
15+
- main
16+
17+
variables:
18+
# TODO: change this to real sign after getting signing approval.
19+
SignType: test
20+
21+
jobs:
22+
- template: ./build.yml
23+
parameters:
24+
prerelease: true
25+
- job: PublishExtensions
26+
displayName: Publish extensions
27+
dependsOn: Build
28+
pool:
29+
name: "AzurePipelines-EO"
30+
steps:
31+
- checkout: none
32+
- download: current
33+
artifact: extension-vsixes
34+
- task: NodeTool@0
35+
displayName: Use Node 16.x
36+
inputs:
37+
versionSpec: 16.x
38+
- script: npm install --global @vscode/vsce
39+
displayName: Install vsce
40+
- script: for f in $(Pipeline.Workspace)/extension-vsixes/*.vsix; do vsce publish --packagePath $f; done
41+
displayName: Publish vscode-arduino
42+
env:
43+
VSCE_PAT: $(vscePat)

0 commit comments

Comments
 (0)