This repository was archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 236
/
Copy pathbuild.yml
135 lines (133 loc) · 5.27 KB
/
build.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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
parameters:
- name: prerelease
type: boolean
default: false
jobs:
- job: Build
pool:
name: VSEngSS-MicroBuild2022-1ES
variables:
TeamName: C++ Cross Platform and Cloud
templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish extension VSIXes as artifact'
targetPath: $(Build.StagingDirectory)\vscode-arduino\vsix
artifactName: extension-vsixes
sbomBuildDropPath: $(Build.SourcesDirectory)
steps:
- task: MicroBuildSigningPlugin@3
displayName: Install MicroBuild Signing
inputs:
signType: $(SignType)
zipSources: false
condition: ne(variables['Build.Reason'], 'PullRequest')
- task: NodeTool@0
displayName: Use Node 18.x
inputs:
versionSpec: 18.x
- task: UsePythonVersion@0
displayName: Use Python 3.8
inputs:
versionSpec: 3.8
- ${{ if parameters.prerelease }}:
- 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))"
- script: npm install --global gulp node-gyp @vscode/vsce
displayName: Install global dependencies
- script: npm install
displayName: Install project dependencies
- task: ComponentGovernanceComponentDetection@0
displayName: Detect components
- task: notice@0
displayName: Generate NOTICE file
inputs:
outputfile: $(Build.SourcesDirectory)/NOTICE.txt
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- script: gulp tslint
displayName: Check for linting errors
- script: gulp genAikey
displayName: Use production AI key
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
- ${{ if parameters.prerelease }}:
- pwsh: |
$env:NODE_OPTIONS="--no-experimental-fetch --openssl-legacy-provider"
node build/package.js --pre-release
displayName: Build and pack extension
- ${{ else }}:
- pwsh: |
$env:NODE_OPTIONS="--no-experimental-fetch --openssl-legacy-provider"
node build/package.js
displayName: Build and pack extension
- pwsh: |
$path = Join-Path $Env:TEMP "7z-installer.exe"
Invoke-WebRequest https://www.7-zip.org/a/7z2201-x64.exe -OutFile $path
Start-Process -FilePath $path -Args "/S" -Verb RunAs -Wait
Remove-Item $path
Echo "##vso[task.prependpath]$Env:PROGRAMFILES\7-Zip\"
displayName: Install 7zip
- pwsh: Get-ChildItem out\vsix | Foreach-Object { 7z x $_.FullName -o$(Build.StagingDirectory)\vscode-arduino\$($_.BaseName) }
displayName: Extract extension for signing
- task: NuGetToolInstaller@1
displayName: Install NuGet
- task: NuGetAuthenticate@0
displayName: Authenticate NuGet
- script: nuget restore .\build\SignFiles.proj -PackagesDirectory .\build\packages
displayName: Restore MicroBuild Core
condition: ne(variables['Build.Reason'], 'PullRequest')
- task: MSBuild@1
displayName: Sign files
inputs:
solution: .\build\SignFiles.proj
msbuildArguments: /p:SignType=$(SignType)
condition: ne(variables['Build.Reason'], 'PullRequest')
- pwsh: |
Get-ChildItem -Directory $(Build.StagingDirectory)\vscode-arduino | Foreach-Object { 7z a ($_.FullName + ".vsix") ($_.FullName + "\*") -tzip }
New-Item -Path $(Build.StagingDirectory)\vscode-arduino\vsix -ItemType Directory
Get-Item $(Build.StagingDirectory)\vscode-arduino\*.vsix | Move-Item -Destination $(Build.StagingDirectory)\vscode-arduino\vsix
displayName: Pack signed files
- task: MSBuild@1
displayName: Sign VSIXes
inputs:
solution: .\build\SignVsix.proj
msbuildArguments: /p:SignType=$(SignType)
condition: ne(variables['Build.Reason'], 'PullRequest')
- script: curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
displayName: Download Arduino IDE
- script: >-
node build/checkHash.js arduino-1.8.19-windows.zip c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945
displayName: Verify Arduino IDE
- task: ExtractFiles@1
displayName: Extract Arduino IDE
inputs:
archiveFilePatterns: arduino-1.8.19-windows.zip
destinationFolder: arduino-ide
- script: "echo ##vso[task.prependpath]$(Build.SourcesDirectory)\\arduino-ide\\arduino-1.8.19"
displayName: Add Arduino IDE to PATH
- script: npm test --silent
displayName: Run tests
- task: DeleteFiles@1
inputs:
SourceFolder: $(Build.SourcesDirectory)/.vscode-test
Contents: "*"
RemoveSourceFolder: true
- task: PostAnalysis@2
displayName: Check for compliance errors
inputs:
CredScan: true
PoliCheck: true
condition: ne(variables['Build.Reason'], 'PullRequest')
- task: GitHubRelease@0
displayName: Publish to GitHub
inputs:
gitHubConnection: embeddedbot
repositoryName: microsoft/vscode-arduino
action: create
target: $(Build.SourceVersion)
tagSource: auto
assets: $(Build.StagingDirectory)\vscode-arduino\vsix\*.vsix
isPreRelease: $[contains(variables['Build.SourceBranch'], '-rc')]
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
- task: MicroBuildCleanup@1
displayName: Clean up MicroBuild