azure-pipelines.template.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Node.js
  2. # Build a general Node.js application with npm.
  3. # Add steps that analyze code, save build artifacts, deploy, and more:
  4. # https://docs.microsoft.com/vsts/pipelines/languages/javascript
  5. # demo: https://github.com/parcel-bundler/parcel/blob/master/azure-pipelines-template.yml
  6. jobs:
  7. - job: {% raw %}${{ parameters.name }}{% endraw %}
  8. pool:
  9. vmImage: {% raw %}${{ parameters.vmImage }}{% endraw %}
  10. strategy:
  11. matrix:
  12. {%- for version in versions %}
  13. node_{{version | replace('.', '_')}}:
  14. node_version: {{version}}
  15. {%- endfor %}
  16. maxParallel: {{versions.length}}
  17. steps:
  18. - task: NodeTool@0
  19. inputs:
  20. versionSpec: $(node_version)
  21. displayName: 'Install Node.js'
  22. {% raw %}
  23. # Set ENV
  24. - ${{ if ne(parameters.name, 'windows') }}:
  25. - script: |
  26. echo $PWD
  27. export PATH="$PATH:$PWD/node_modules/.bin"
  28. echo "##vso[task.setvariable variable=PATH]$PATH"
  29. displayName: Set ENV
  30. - ${{ if eq(parameters.name, 'windows') }}:
  31. - script: |
  32. echo %cd%
  33. set PATH=%PATH%;%cd%\node_modules\.bin
  34. echo "##vso[task.setvariable variable=PATH]%PATH%"
  35. displayName: Set ENV
  36. {% endraw %}
  37. - script: |
  38. {%- if npminstall %}
  39. npm i npminstall@5 && npminstall
  40. {%- else %}
  41. npm i
  42. {%- endif %}
  43. displayName: 'Install Packages'
  44. - script: |
  45. npm run {{command['azure-pipelines']}}
  46. displayName: 'Build & Unit Test'
  47. - {% raw %}${{ if ne(parameters.name, 'windows') }}:{% endraw %}
  48. - script: |
  49. {%- if npminstall %}
  50. npminstall codecov && codecov
  51. {%- else %}
  52. npm i codecov && codecov
  53. {%- endif %}
  54. displayName: 'Report Coverage'