131 lines
3.4 KiB
YAML
131 lines
3.4 KiB
YAML
# Node.js
|
|
# Build a general Node.js application with npm.
|
|
# Add steps that analyze code, save build artifacts, deploy, and more:
|
|
# https://docs.microsoft.com/vsts/pipelines/languages/javascript
|
|
|
|
jobs:
|
|
- job: Linux
|
|
pool:
|
|
vmImage: 'ubuntu-16.04'
|
|
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '8.x'
|
|
displayName: 'Install Node.js'
|
|
- task: YarnInstaller@3
|
|
inputs:
|
|
versionSpec: '1.x'
|
|
displayName: 'Install Yarn'
|
|
- script: yarn
|
|
displayName: 'Install dependencies and build'
|
|
- script: yarn test-unit --forbid-only
|
|
displayName: 'Unit tests'
|
|
- script: yarn lint
|
|
displayName: 'Lint'
|
|
- script: |
|
|
NODE_PATH=$(pwd)/out ./node_modules/.bin/nyc ./node_modules/.bin/mocha './out/*test.js' './out/**/*test.js'
|
|
./node_modules/.bin/nyc report --reporter=cobertura
|
|
displayName: 'Coverage report'
|
|
- task: PublishCodeCoverageResults@1
|
|
inputs:
|
|
codeCoverageTool: Cobertura
|
|
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
|
|
displayName: 'Publish coverage'
|
|
- task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@6
|
|
displayName: 'Check build quality'
|
|
inputs:
|
|
checkCoverage: true
|
|
coverageType: lines
|
|
coverageThreshold: 60
|
|
coverageFailOption: fixed
|
|
|
|
- job: macOS
|
|
pool:
|
|
vmImage: 'xcode9-macos10.13'
|
|
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '8.x'
|
|
displayName: 'Install Node.js'
|
|
- script: yarn
|
|
displayName: 'Install dependencies and build'
|
|
- script: yarn test-unit --forbid-only
|
|
displayName: 'Unit tests'
|
|
- script: yarn lint
|
|
displayName: 'Lint'
|
|
|
|
- job: Windows
|
|
pool:
|
|
vmImage: 'vs2017-win2016'
|
|
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '8.x'
|
|
displayName: 'Install Node.js'
|
|
- script: yarn
|
|
displayName: 'Install dependencies and build'
|
|
- script: yarn test-unit --forbid-only
|
|
displayName: 'Unit tests'
|
|
- script: yarn lint
|
|
displayName: 'Lint'
|
|
|
|
- job: Linux_IntegrationTests
|
|
pool:
|
|
vmImage: 'ubuntu-16.04'
|
|
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '8.x'
|
|
displayName: 'Install Node.js'
|
|
- task: YarnInstaller@3
|
|
inputs:
|
|
versionSpec: '1.x'
|
|
displayName: 'Install Yarn'
|
|
- script: yarn
|
|
displayName: 'Install dependencies and build'
|
|
- script: |
|
|
yarn start &
|
|
sleep 10
|
|
yarn test-api --headless --forbid-only
|
|
displayName: 'Linux Integration tests'
|
|
|
|
- job: macOS_IntegrationTests
|
|
pool:
|
|
vmImage: 'xcode9-macos10.13'
|
|
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '8.x'
|
|
displayName: 'Install Node.js'
|
|
- script: yarn
|
|
displayName: 'Install dependencies and build'
|
|
- script: |
|
|
yarn start &
|
|
sleep 10
|
|
yarn test-api --headless --forbid-only
|
|
displayName: 'MacOS Integration tests'
|
|
|
|
- job: Release
|
|
dependsOn:
|
|
- Linux
|
|
- macOS
|
|
- Windows
|
|
- Linux_IntegrationTests
|
|
- macOS_IntegrationTests
|
|
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['FORCE_RELEASE'], 'true')))
|
|
pool:
|
|
vmImage: 'ubuntu-16.04'
|
|
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '8.x'
|
|
displayName: 'Install Node.js'
|
|
- task: YarnInstaller@3
|
|
inputs:
|
|
versionSpec: '1.x'
|
|
displayName: 'Install Yarn'
|
|
- script: yarn
|
|
displayName: 'Install dependencies and build'
|
|
- script: NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./bin/publish.js
|
|
displayName: 'Package and publish to npm'
|