This repository has been archived by the owner on May 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
75 lines (72 loc) · 2.55 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
variables:
node_version: '12.4.0'
npm_config_cache: $(Pipeline.Workspace)/.npm
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
displayName: 'Build/Test (Ubuntu)'
mac:
imageName: 'macos-latest'
displayName: 'Build/Test (macOS)'
# TODO (lucas): Windows fails to build because of kerberos native add-on.
# https://jira.mongodb.org/browse/NODE-2465 Will get updated builds to work around
# at which point this might be worth trying again.
# windows:
# imageName: 'windows-latest'
# displayName: 'Build/Test (Windows)'
pool:
vmImage: $(imageName)
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install node.js'
- script: |
set -e
sudo apt-get update
sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgconf-2-4 libasound2 libxtst6 libnss3
displayName: 'Install native Linux dependencies'
condition: in(variables['agent.os'], 'Linux')
# https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops#nodejsnpm
- task: Cache@2
inputs:
key: 'npm | "$(Agent.OS)" | package-lock.json'
restoreKeys: |
npm | "$(Agent.OS)"
npm
path: $(npm_config_cache)
displayName: Cache npm
- script: |
npm ci
displayName: 'Install dependencies from npm'
- script: |
npm run cover
displayName: 'Run unit tests'
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-code-coverage-results?view=azure-devops
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: cobertura
summaryFileLocation: coverage/cobertura-coverage.xml
#pathToSources: # Optional
#reportDirectory: # Optional
#additionalCodeCoverageFiles: # Optional
#failIfCoverageEmpty: false # Optional
- script: |
npm run test:karma
displayName: 'Run functional tests'
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-test-results?view=azure-devops&tabs=yaml
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'coverage/karma-results.xml'
#searchFolder: '$(System.DefaultWorkingDirectory)' # Optional
#mergeTestResults: false # Optional
#failTaskOnFailedTests: false # Optional
#testRunTitle: # Optional
#buildPlatform: # Optional
#buildConfiguration: # Optional
#publishRunAttachments: true # Optional
- script: |
npm run check
displayName: 'Run static analysis checks'