-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathazure-pipelines.yml
62 lines (49 loc) · 1.63 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
trigger:
- main
- azure-pipelines
pool:
vmImage: 'ubuntu-latest'
variables:
log_to_splunk: true
steps:
- task: NodeTool@0
inputs:
versionSpec: '20.x'
displayName: 'Install Node.js'
- script: npm install
displayName: npm install
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud'
organization: 'nhsdigital'
scannerMode: 'CLI'
configMode: 'file'
extraProperties: |
sonar.language=js
sonar.projectKey=nhsuk-cookie-consent
sonar.javascript.lcov.reportPaths=coverage/lcov.info,tests/integration-tests/coverage/lcov.info
sonar.dependencyCheck.htmlReportPath=$(System.DefaultWorkingDirectory)/dependency-scan-results/dependency-check-report.html
sonar.exclusions=**/*.config.js,/coverage/**,tests/**/coverage/**,**/integration-tests/,**/tests/example/,**/*.test.*,__mocks__/**,*test-environment.*,**/dependency-scan-results/dependency-check-report.html,node_modules/**
- script: npm run build:production
displayName: 'build'
- script: npm run lint
displayName: linting
- script: CI=true npm run test
displayName: testing
- task: SonarCloudAnalyze@1
displayName: 'Run SonarCloud Code Analysis'
- task: SonarCloudPublish@1
displayName: 'Publish Quality Gate Result'
- task: sonarcloud-buildbreaker@2
displayName: "Break the build if the quality gate fails"
inputs:
SonarCloud: 'SonarCloud'
organization: 'nhsdigital'
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)/dist
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: dist