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

Commit c5ab396

Browse files
authored
Merge pull request #1405 from microsoft/master
Integrate CI changes from master
2 parents ce8e9fc + 43abfa9 commit c5ab396

File tree

7 files changed

+319
-89
lines changed

7 files changed

+319
-89
lines changed

.github/workflows/build.yml

+55-88
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
name: CI-Tests
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
name: CI
5+
26
on:
37
push:
48
branches:
@@ -11,110 +15,73 @@ on:
1115
- master
1216
- dev
1317

14-
1518
jobs:
1619
build:
17-
runs-on: ${{ matrix.os }}
20+
runs-on: ${{ matrix.os }}
1821
strategy:
22+
fail-fast: false
1923
matrix:
2024
os: [ ubuntu-latest, macos-latest, windows-latest ]
21-
25+
2226
steps:
23-
- name: checkout
27+
- name: Checkout
2428
uses: actions/checkout@v2
25-
- name: get node
26-
uses: actions/setup-node@v1
29+
30+
# Node 14 matches the version of Node used by VS Code when this was
31+
# written, but it should be updated when VS Code updates its Node version.
32+
# Node needs to be installed before OS-specific setup so that we can run
33+
# the hash verification script.
34+
- name: Use Node 14.x
35+
uses: actions/setup-node@v2
2736
with:
28-
node-version: 11.x
29-
- name: linux setup
37+
node-version: 14.x
38+
39+
- name: Windows setup
40+
if: ${{ matrix.os == 'windows-latest' }}
41+
run: |
42+
curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
43+
node build/checkHash.js arduino-1.8.19-windows.zip `
44+
c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945
45+
7z x arduino-1.8.19-windows.zip -o"$Env:TEMP\arduino-ide"
46+
echo "$Env:TEMP\arduino-ide\arduino-1.8.19" | Out-File -FilePath $env:GITHUB_PATH -Append
47+
- name: Linux setup
3048
if: ${{ matrix.os == 'ubuntu-latest' }}
3149
run: |
3250
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0
3351
sleep 3
34-
wget https://downloads.arduino.cc/arduino-1.8.2-linux64.tar.xz -P /home/$USER
35-
tar -xvf /home/$USER/arduino-1.8.2-linux64.tar.xz -C /home/$USER/
36-
sudo ln -s /home/$USER/arduino-1.8.2/arduino /usr/bin/arduino
52+
wget https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz -P /home/$USER
53+
node build/checkHash.js /home/$USER/arduino-1.8.19-linux64.tar.xz \
54+
eb68bddc1d1c0120be2fca1350a03ee34531cf37f51847b21210b6e70545bc9b
55+
tar -xvf /home/$USER/arduino-1.8.19-linux64.tar.xz -C /home/$USER/
56+
sudo ln -s /home/$USER/arduino-1.8.19/arduino /usr/bin/arduino
3757
sudo apt-get update
38-
sudo apt-get install g++-multilib
39-
sudo apt-get install -y build-essential
40-
sudo apt-get install libudev-dev
41-
- name: macos setup
58+
sudo apt-get install -y g++-multilib build-essential libudev-dev
59+
- name: macOS setup
4260
if: ${{ matrix.os == 'macos-latest' }}
43-
run: |
61+
run: |
4462
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
4563
brew install arduino --cask
46-
- name: preinstall
47-
run: |
48-
npm install -g node-gyp
49-
npm install -g vsce@"^1.0.0"
50-
npm install -g gulp
51-
- name: install
52-
run: npm install
53-
- name: scripts
54-
run: |
55-
gulp tslint
56-
vsce package
57-
- name: run tests
64+
65+
# Windows agents already have gulp installed.
66+
- name: Install gulp
5867
if: ${{ matrix.os != 'windows-latest' }}
68+
run: npm install --global gulp
69+
- name: Install global dependencies
70+
run: npm install --global node-gyp vsce
71+
- name: Install project dependencies
72+
run: npm install
73+
74+
- name: Check for linting errors
75+
run: gulp tslint
76+
- name: Build and pack extension
77+
run: vsce package --out vscode-arduino.vsix
78+
- name: Publish extension VSIX as artifact
79+
uses: actions/upload-artifact@v2
80+
with:
81+
name: VS Code extension VSIX (${{ matrix.os }})
82+
path: vscode-arduino.vsix
83+
84+
- name: Run tests
5985
uses: GabrielBB/xvfb-action@v1
6086
with:
6187
run: npm test --silent
62-
63-
deploy:
64-
needs: build
65-
runs-on: ubuntu-latest
66-
environment: vsix-publishing
67-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
68-
steps:
69-
- run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
70-
- run: echo ${{env.VERSION}}
71-
- name: Checkout
72-
uses: actions/checkout@v2
73-
- name: get node
74-
uses: actions/setup-node@v1
75-
with:
76-
node-version: 11.x
77-
- name: linux setup
78-
run: |
79-
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0
80-
sleep 3
81-
sudo apt-get update
82-
sudo apt-get install g++-multilib
83-
sudo apt-get install -y build-essential
84-
sudo apt-get install libudev-dev
85-
- name: preinstall
86-
run: |
87-
npm install -g node-gyp
88-
npm install -g vsce@"^1.0.0"
89-
npm install -g gulp
90-
- name: install
91-
run: npm install
92-
- name: scripts
93-
run: |
94-
gulp tslint
95-
gulp genAikey
96-
vsce package
97-
- name: upload .vsix to github tag
98-
uses: svenstaro/upload-release-action@v2
99-
with:
100-
repo_token: ${{ secrets.OAUTH_TOKEN }}
101-
file: ${{github.workspace}}/vscode-arduino*.vsix
102-
tag: ${{ github.ref }}
103-
overwrite: true
104-
file_glob: true
105-
- name: check for production tag
106-
id: check-version
107-
run: |
108-
if [[ ${{ env.VERSION }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
109-
echo ::set-output name=ISPRODUCTION::true
110-
fi
111-
# Skip attempting to publish for now, because I can't figure out how to
112-
# generate a valid VSCE_TOKEN. Instead we can manually publish by uploading
113-
# the release build artifact to the extension publisher site.
114-
- name: publish
115-
if: false && steps.check-version.outputs.ISPRODUCTION == 'true'
116-
env:
117-
PROD_AIKEY: ${{ secrets.PROD_AIKEY }}
118-
run: |
119-
gulp genAikey
120-
vsce publish -p ${{ secrets.VSCE_TOKEN }}

.vscodeignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ gulpfile.js
1515
*.log
1616
webpack.config.js
1717
node_modules/**
18-
vendor/**
18+
vendor/**
19+
azure-pipelines.yml
20+
build/**

azure-pipelines.yml

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
name: $(Date:yyyyMMdd)$(Rev:.r).0-$(SourceBranchName)
5+
6+
parameters:
7+
- name: SignTypeOverride
8+
displayName: Signing type override
9+
type: string
10+
default: default
11+
values:
12+
- default
13+
- test
14+
- real
15+
16+
pr:
17+
- master
18+
- dev
19+
20+
trigger:
21+
branches:
22+
include:
23+
- master
24+
- dev
25+
tags:
26+
include:
27+
- v*
28+
29+
pool:
30+
name: VSEngSS-MicroBuild2019-1ES
31+
32+
variables:
33+
# MicroBuild requires TeamName to be set.
34+
TeamName: C++ Cross Platform and Cloud
35+
# If the user didn't override the signing type, then only real-sign on tags,
36+
# master, or dev.
37+
${{ if ne(parameters.SignTypeOverride, 'default') }}:
38+
SignType: ${{ parameters.SignTypeOverride }}
39+
${{ if and(eq(parameters.SignTypeOverride, 'default'), or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'dev'))) }}:
40+
SignType: real
41+
${{ if and(eq(parameters.SignTypeOverride, 'default'), not(or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'dev')))) }}:
42+
SignType: test
43+
44+
steps:
45+
- task: MicroBuildSigningPlugin@3
46+
displayName: Install MicroBuild Signing
47+
inputs:
48+
signType: $(SignType)
49+
zipSources: false
50+
# MicroBuild signing will always fail on public PRs.
51+
condition: ne(variables['Build.Reason'], 'PullRequest')
52+
53+
# Run these scanners first so that they don't detect issues in dependencies.
54+
# Failures won't break the build until "Check for compliance errors" step.
55+
- task: CredScan@2
56+
displayName: Run CredScan
57+
inputs:
58+
toolMajorVersion: V2
59+
- task: PoliCheck@1
60+
displayName: Run PoliCheck
61+
inputs:
62+
targetType: F
63+
targetArgument: $(Build.SourcesDirectory)
64+
65+
# Node 14 matches the version of Node used by VS Code when this was written,
66+
# but it should be updated when VS Code updates its Node version.
67+
- task: NodeTool@0
68+
displayName: Use Node 14.x
69+
inputs:
70+
versionSpec: 14.x
71+
- script: npm install --global gulp node-gyp vsce
72+
displayName: Install global dependencies
73+
- script: npm install
74+
displayName: Install project dependencies
75+
76+
- script: gulp tslint
77+
displayName: Check for linting errors
78+
- script: gulp genAikey
79+
displayName: Use production AI key
80+
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
81+
# Pack the extension now even though it's unsigned so that we ignore files
82+
# from .vscodeignore. This will reduce load on the signing server later and
83+
# ensure we only attempt to sign shipping files.
84+
- script: vsce package --out vscode-arduino.vsix
85+
displayName: Build and pack extension
86+
87+
- task: ComponentGovernanceComponentDetection@0
88+
displayName: Detect components
89+
90+
# Extract the VSIX, sign what we can, then pack it back up and publish it.
91+
- task: ExtractFiles@1
92+
displayName: Extract extension for signing
93+
inputs:
94+
archiveFilePatterns: vscode-arduino.vsix
95+
destinationFolder: $(Build.StagingDirectory)\vscode-arduino
96+
- task: NuGetToolInstaller@1
97+
displayName: Install NuGet
98+
- task: NuGetAuthenticate@0
99+
displayName: Authenticate NuGet
100+
- script: nuget restore .\build\SignFiles.proj -PackagesDirectory .\build\packages
101+
displayName: Restore MicroBuild Core
102+
# MicroBuild signing will always fail on public PRs.
103+
condition: ne(variables['Build.Reason'], 'PullRequest')
104+
- task: MSBuild@1
105+
displayName: Sign files
106+
inputs:
107+
solution: .\build\SignFiles.proj
108+
msbuildArguments: /p:SignType=$(SignType)
109+
# MicroBuild signing will always fail on public PRs.
110+
condition: ne(variables['Build.Reason'], 'PullRequest')
111+
- task: ArchiveFiles@2
112+
displayName: Pack signed files
113+
inputs:
114+
rootFolderOrFile: $(Build.StagingDirectory)\vscode-arduino
115+
includeRootFolder: false
116+
archiveType: zip
117+
archiveFile: $(Build.StagingDirectory)\vscode-arduino.vsix
118+
- task: MSBuild@1
119+
displayName: Sign VSIX
120+
inputs:
121+
solution: .\build\SignVsix.proj
122+
msbuildArguments: /p:SignType=$(SignType)
123+
# MicroBuild signing will always fail on public PRs.
124+
condition: ne(variables['Build.Reason'], 'PullRequest')
125+
- publish: $(Build.StagingDirectory)\vscode-arduino.vsix
126+
artifact: VS Code extension VSIX
127+
displayName: Publish extension VSIX as artifact
128+
129+
# Install the Arduino IDE and run tests.
130+
- script: curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
131+
displayName: Download Arduino IDE
132+
- script: >-
133+
node build/checkHash.js arduino-1.8.19-windows.zip
134+
c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945
135+
displayName: Verify Arduino IDE
136+
- task: ExtractFiles@1
137+
displayName: Extract Arduino IDE
138+
inputs:
139+
archiveFilePatterns: arduino-1.8.19-windows.zip
140+
destinationFolder: arduino-ide
141+
- script: "echo ##vso[task.prependpath]$(Build.SourcesDirectory)\\arduino-ide\\arduino-1.8.19"
142+
displayName: Add Arduino IDE to PATH
143+
- script: npm test --silent
144+
displayName: Run tests
145+
146+
- task: PostAnalysis@1
147+
displayName: Check for compliance errors
148+
# To avoid spirious warnings about missing logs, explicitly declare what we scanned.
149+
inputs:
150+
CredScan: true
151+
PoliCheck: true
152+
153+
# Trust Services Automation (TSA) can automatically open bugs for compliance issues.
154+
# https://www.1eswiki.com/wiki/Trust_Services_Automation_(TSA)
155+
- task: TSAUpload@1
156+
displayName: Upload logs to TSA
157+
inputs:
158+
tsaVersion: TsaV2
159+
codebase: NewOrUpdate
160+
codeBaseName: vscode-arduino
161+
notificationAlias: [email protected]
162+
instanceUrlForTsaV2: DEVDIV
163+
projectNameDEVDIV: DevDiv
164+
areaPath: DevDiv\Cpp Developer Experience\Cross Platform\Embedded
165+
iterationPath: DevDiv
166+
# To avoid spurious warnings about missing logs, explicitly declare what we don't upload.
167+
uploadAPIScan: false
168+
uploadBinSkim: false
169+
uploadFortifySCA: false
170+
uploadFxCop: false
171+
uploadModernCop: false
172+
uploadPREfast: false
173+
uploadRoslyn: false
174+
uploadTSLint: false
175+
# Don't open bugs for PR builds
176+
condition: ne(variables['Build.Reason'], 'PullRequest')
177+
178+
- task: GitHubRelease@0
179+
displayName: Publish to GitHub
180+
inputs:
181+
gitHubConnection: embeddedbot
182+
repositoryName: microsoft/vscode-arduino
183+
action: create
184+
target: $(Build.SourceVersion)
185+
tagSource: auto
186+
assets: $(Build.StagingDirectory)\vscode-arduino.vsix
187+
isPreRelease: $[contains(variables['Build.SourceBranch'], '-rc')]
188+
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
189+
190+
- task: MicroBuildCleanup@1
191+
displayName: Clean up MicroBuild

0 commit comments

Comments
 (0)