Skip to content

Commit 9e2ff17

Browse files
authored
Build pipeline (#1026)
* Set up CI with Azure Pipelines [skip ci] * remove trigger * adding common security template * using windows image when testing * junit runner; publish result * contents to ignore * script for each line * displayName for each script
1 parent a6be301 commit 9e2ff17

File tree

7 files changed

+465
-137
lines changed

7 files changed

+465
-137
lines changed
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Node.js
2+
# Build a general Node.js project with npm.
3+
# Add steps that analyze code, save build artifacts, deploy, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
5+
6+
name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
7+
8+
trigger:
9+
branches:
10+
include:
11+
- main
12+
13+
pr: none
14+
15+
16+
stages:
17+
- stage: "Test"
18+
jobs:
19+
- job:
20+
pool:
21+
vmImage: windows-latest
22+
strategy:
23+
matrix:
24+
Node 12:
25+
NODE_VERSION: '12.x'
26+
Node 14:
27+
NODE_VERSION: '14.x'
28+
Node 16:
29+
NODE_VERSION: '16.x'
30+
maxParallel: 2
31+
steps:
32+
- template: ./common-templates/security-pre-checks.yml
33+
- task: NodeTool@0
34+
inputs:
35+
versionSpec: $(NODE_VERSION)
36+
displayName: 'Install Node.js'
37+
38+
- script: npm ci
39+
displayName: 'npm install for tests'
40+
- script: npm run build
41+
displayName: 'npm build for tests'
42+
- script: npm run test
43+
displayName: 'Run the node tests'
44+
- script: npm run karma
45+
displayName: 'Run karma tests'
46+
47+
- task: PublishTestResults@2
48+
displayName: 'Publish Unit Test Results'
49+
inputs:
50+
testResultsFormat: 'JUnit'
51+
testResultsFiles: '**/testResult.xml'
52+
failTaskOnFailedTests: true
53+
54+
- template: ./common-templates/security-post-checks.yml
55+
56+
- stage: "Build"
57+
jobs:
58+
- job:
59+
60+
pool:
61+
vmImage: ubuntu-latest
62+
steps:
63+
- task: NodeTool@0
64+
inputs:
65+
versionSpec: '16.x'
66+
displayName: 'Install Node.js'
67+
68+
- script: |
69+
npm ci
70+
npm run build
71+
displayName: 'Build for production artifact'
72+
- task: CopyFiles@2
73+
inputs:
74+
sourceFolder: '$(Build.SourcesDirectory)'
75+
targetFolder: $(Build.ArtifactStagingDirectory)
76+
Contents: |
77+
**/*
78+
!test/**
79+
!.azure-pipelines/**
80+
!.github/**
81+
!.git/**
82+
!.vscode/**
83+
!node_modules/**
84+
displayName: 'Copy npm package'
85+
86+
- task: PublishBuildArtifacts@1
87+
inputs:
88+
pathtoPublish: $(Build.ArtifactStagingDirectory)
89+
artifactName: "release-drop"
90+
displayName: 'Publish artifacts'
91+
92+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
steps:
4+
- task: CodesignValidation@0
5+
6+
- task: SdtReport@1
7+
displayName: "Security Analysis Report"
8+
continueOnError: true
9+
condition: succeededOrFailed()
10+
inputs:
11+
AllTools: false
12+
APIScan: false
13+
BinSkim: false
14+
BinSkimBreakOn: "WarningAbove"
15+
CodesignValidation: true
16+
CodesignValidationBreakOn: "WarningAbove"
17+
CredScan: true
18+
FortifySCA: false
19+
FxCop: false
20+
ModernCop: false
21+
MSRD: false
22+
PoliCheck: true
23+
PoliCheckBreakOn: "Severity1"
24+
RoslynAnalyzers: true
25+
RoslynAnalyzersBreakOn: "WarningAbove"
26+
SDLNativeRules: false
27+
Semmle: false
28+
TSLint: false
29+
TSLintBreakOn: "WarningAbove"
30+
ToolLogsNotFoundAction: "Standard"
31+
32+
- task: PublishSecurityAnalysisLogs@3
33+
displayName: "Publish Security Analysis Logs"
34+
inputs:
35+
ArtifactName: "CodeAnalysisLogs"
36+
ArtifactType: "Container"
37+
AllTools: false
38+
AntiMalware: false
39+
APIScan: false
40+
BinSkim: false
41+
CodesignValidation: true
42+
CredScan: true
43+
FortifySCA: false
44+
FxCop: false
45+
ModernCop: true
46+
MSRD: false
47+
PoliCheck: true
48+
RoslynAnalyzers: true
49+
SDLNativeRules: false
50+
Semmle: false
51+
TSLint: false
52+
WebScout: false
53+
ToolLogsNotFoundAction: "Standard"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
steps:
4+
- task: CredScan@2
5+
displayName: "Run CredScan"
6+
inputs:
7+
debugMode: false
8+
batchSize: 20
9+
toolMajorVersion: "V2"
10+
searchersFileType: "Skype"
11+
12+
- task: PoliCheck@1
13+
displayName: "Run PoliCheck"
14+
condition: and(succeeded(), eq(eq(variables['Build.SourceBranch'], 'refs/heads/main'), false))
15+
inputs:
16+
targetType: F
17+
SOMEnabled: true
18+
optionsFC: 0
19+
optionsXS: 0
20+
optionsHMENABLE: 0
21+
continueOnError: true

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ test/development/secrets.ts
2828

2929
.nyc_output/*
3030

31-
.idea/*
31+
.idea/*
32+
33+
testResult.xml

.npmignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
src/
22
scripts/
33
design/
4-
changelogs/
4+
changelogs/
5+
testResult.xml

0 commit comments

Comments
 (0)