-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines.yml
99 lines (83 loc) · 2.61 KB
/
azure-pipelines.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
# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
npm_cache_path: $(Build.SourcesDirectory)/node_modules
npm_cache_key: npm | $(Agent.OS) | package-lock.json
branchName: $(Build.SourceBranchName)
projectKey: $(AzureSonarQubeProjectKey)
projectName: $(AzureSonarQubeProjectName)
sonarQubeServerUrl: $(AzureSonarQubeServerUrl)
sonarQubeToken: $(AzureSonarQubeToken)
isMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
steps:
- task: replacetokens@3
inputs:
targetFiles: 'sonar-project.js'
encoding: 'auto'
writeBOM: true
actionOnMissing: 'warn'
keepToken: false
tokenPrefix: '#{'
tokenSuffix: '}#'
useLegacyPattern: false
enableTelemetry: true
- task: Cache@2
displayName: Cache NPM packages
inputs:
key: $(npm_cache_key)
restoreKeys: $(npm_cache_key)
path: $(npm_cache_path)
cacheHitVar: CACHE_RESTORED
- script: npm install --quiet
displayName: 'Install NPM dependencies'
condition: ne(variables.CACHE_RESTORED, 'true')
- task: Npm@1
displayName: Run Lint
inputs:
command: custom
customCommand: 'run lint'
- task: Npm@1
displayName: Run Unit Tests
inputs:
command: custom
customCommand: 'run test:ci'
- task: Npm@1
displayName: 'Publish Quality Gate Result'
inputs:
command: 'custom'
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'run sonar'
condition: eq(variables.isMaster, true)
- task: PublishTestResults@2
displayName: Publish test results
inputs:
testResultsFiles: 'coverage/jest-junit/junit.xml'
failTaskOnFailedTests: true
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage report'
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(Build.SourcesDirectory)/coverage/cobertura-coverage.xml'
- script: npm audit --json > audit.json & exit 0
displayName: 'Audit Packages'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: audit_results'
inputs:
PathtoPublish: 'audit.json'
ArtifactName: 'audit_results'
- task: Npm@1
displayName: Build App
inputs:
command: custom
customCommand: 'run build'
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: build'
inputs:
targetPath: $(Build.SourcesDirectory)
artifactName: 'SpeakerMeet.UI'