forked from MicrosoftDocs/pipelines-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
120 lines (110 loc) · 3.5 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- main
pool:
vmImage: 'vs2017-win2016' # examples of other options: 'macOS-10.15', 'vs2017-win2016'
steps:
- task: NodeTool@0
inputs:
versionSpec: '14.x'
displayName: 'Install Node.js'
- task: Npm@1
inputs:
command: 'install'
- task: Npm@1
inputs:
customEndpoint: <Name of npm service connection>
- task: npmAuthenticate@0
inputs:
customEndpoint: <Name of npm service connection>
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: '**/TEST-RESULTS.xml'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura # or JaCoCo
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'
- task: npmAuthenticate@0
inputs:
customEndpoint: <Name of npm service connection>
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/TEST-RESULTS.xml'
testRunTitle: 'Test results for JavaScript using gulp'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'
- task: npmAuthenticate@0
inputs:
customEndpoint: <Name of npm service connection>
- script: grunt # include any additional options that are needed
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)'
- script: gulp # include any additional options that are needed
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
Contents: |
**\*.js
package.json
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
- script: |
npm install -g @angular/cli
npm install
ng build --prod
- task: Npm@1
inputs:
command: publish
publishRegistry: useExternalRegistry
publishEndpoint: https://my.npmregistry.com
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
- script: |
npm install --only=dev
npm run build
- script: npm install --only=dev
- script: npx mocha
- script: npm install -g @angular/cli
- script: npm install
- script: yarn install
- script: npm run compile
- script: tsc --target ES6 --strict true --project tsconfigs/production.json
- script: mocha test --reporter mocha-junit-reporter
- script: npm test
- script: |
npm install
npm run build
displayName: 'npm install and build'
- script: webpack
- script: npm run build
- script: |
npm install webpack webpack-cli --save-dev
npx webpack --config webpack.config.js
- script: gulp # include any additional options that are needed
- script: grunt # include any additional options that are needed
- script: npm publish
displayName: 'npm install and build'
steps:
- bash: |
NODE_VERSION=12 # or whatever your preferred version is
npm config delete prefix # avoid a warning
. ${NVM_DIR}/nvm.sh
nvm use ${NODE_VERSION}
nvm alias default ${NODE_VERSION}
VERSION_PATH="$(nvm_version_path ${NODE_VERSION})"
echo "##vso[task.prependPath]$VERSION_PATH"
- bash: |
. ${NVM_DIR}/nvm.sh
nvm <command>