This post is as an introduction to Azure DevOps. If you’re new to this topic, check out a helpful DZone article here.
We’ll use an azure-pipelines.yml file at the root of the repository. Get this file to build the Node.js application using CI (Continuous Integration) Build.
Follow the instructions in Create your build pipeline to create a build pipeline for your node application.
Steps:
pool:
name: Hosted Ubuntu 1604
demands: npm
steps:
- task: whitesource.whitesource.task-hash-collector.WhiteSource@18
displayName: 'WhiteSource '
inputs:
cwd: 'cctitan-ui-code'
extensions: '.json .js .ts .css .html'
productName: UIcode
WhiteSourceService: 'cc-titan'
enabled: false
- task: NodeTool@0
displayName: 'Use Node 8.x'
inputs:
versionSpec: 8.x
task: Npm@1
displayName: 'npm install'
inputs:
workingDir: 'cctitan-ui-code'
- task: Npm@1
displayName: 'install angular cli@latest'
inputs:
command: custom
workingDir: 'cctitan-ui-code'
verbose: false
customCommand: 'install -g @angular/cli@latest '
- bash: |
ls /home/vsts/work/1/s
cd cctitan-ui-code
ls
ng --version
ls
ng build
ls
- task: whitesource.ws-bolt.bolt.wss.WhiteSource Bolt@19
displayName: 'WhiteSource Bolt'
inputs:
cwd: 'cctitan-ui-code'
- bash: |
cd CCtest
npm install karma karma-jasmine karma-chrome-launcher karma-jasmine-html-reporter karma-coverage-istanbul-reporter
npm install karma-coverage --save-dev
npm install karma karma-coverage
ng test --watch=false --code-coverage
displayName: 'CodeCOverage tests'
- task: ArchiveFiles@2
displayName: 'Archive cctitan-ui-code/dist'
inputs:
rootFolderOrFile: 'cctitan-ui-code/dist'
includeRootFolder: false
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
Publish the test results to Azure pipelines or TFS when tests are executed to provide complete test reports and analytics. Use the test runner that supports the required test results format. Some specific result formats include JUnit, NUnit, and Visual Studio Test (TRX). This task will generate the JUnit XML formats, and Azure DevOps Build will use this XML file in its build task to grab the test results and publish to the dashboard summary of the build.
steps:
- task: PublishTestResults@2
displayName: 'Publish Test Results **/test-results*.xml **/e2e-results-junit*.xml '
inputs:
testResultsFiles: |
**/test-results*.xml
**/e2e-results-junit*.xml
mergeTestResults: true
continueOnError: true
condition: succeededOrFailed()
steps:
- task: AzureRmWebAppDeployment@3
displayName: 'Deploy Azure App Service'
inputs:
azureSubscription: '$(Parameters.ConnectedServiceName)'
appType: '$(Parameters.WebAppKind)'
WebAppName: '$(Parameters.WebAppName)'
TakeAppOfflineFlag: true
The Complete Node.js Developer Course (3rd Edition)
Build a Node.js Application Using Azure DevOps (CI/CD)
How you can do continuous delivery with Vue, Docker, and Azure
Originally published by Sudheer Mareddy at dzone.com
Thanks for reading :heart: If you liked this post, share it with all of your programming buddies! Follow me on Facebook | Twitter
#node-js #azure