-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathtest.yml
More file actions
104 lines (89 loc) · 4.54 KB
/
test.yml
File metadata and controls
104 lines (89 loc) · 4.54 KB
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
parameters:
Artifacts: []
ServiceDirectory: not-specified
TestProxy: true
OSName: ''
steps:
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
parameters:
AgentImage: ${{ parameters.OSName}}
- template: /eng/common/pipelines/templates/steps/save-package-properties.yml
parameters:
ServiceDirectory: ${{parameters.ServiceDirectory}}
- script: |
node common/scripts/install-run-rush.js install
displayName: "Install dependencies"
- template: /eng/pipelines/templates/steps/set-artifact-packages.yml
parameters:
PackageInfo: $(Build.ArtifactStagingDirectory)/PackageInfo
Artifacts: ${{ parameters.Artifacts }}
# Option "-p max" ensures parallelism is set to the number of cores on all platforms, which improves build times.
# The default on Windows is "cores - 1" (microsoft/rushstack#436).
- script: |
node eng/tools/rush-runner.js build $(ChangedServices) -packages "$(ArtifactPackageNames)" --verbose -p max
displayName: "Build libraries"
# Option "-p max" ensures parallelism is set to the number of cores on all platforms, which improves build times.
# The default on Windows is "cores - 1" (microsoft/rushstack#436).
- script: |
node eng/tools/rush-runner.js build:test $(ChangedServices) -packages "$(ArtifactPackageNames)" --verbose -p max
displayName: "Build test assets"
- template: ../steps/use-node-test-version.yml
- ${{ if eq(parameters.TestProxy, true) }}:
- template: /eng/common/testproxy/test-proxy-standalone-tool.yml
# Option "-p max" ensures parallelism is set to the number of cores on all platforms, which improves build times.
# The default on Windows is "cores - 1" (microsoft/rushstack#436).
- script: |
node eng/tools/rush-runner.js unit-test:node $(ChangedServices) -packages "$(ArtifactPackageNames)" --verbose -p max
displayName: "Test libraries"
condition: and(succeeded(),eq(variables['TestType'], 'node'))
# Option "-p max" ensures parallelism is set to the number of cores on all platforms, which improves build times.
# The default on Windows is "cores - 1" (microsoft/rushstack#436).
- script: |
node eng/tools/rush-runner.js unit-test:browser $(ChangedServices) -packages "$(ArtifactPackageNames)" --verbose -p max
displayName: "Test libraries"
condition: and(succeeded(),eq(variables['TestType'], 'browser'))
- ${{ if eq(parameters.TestProxy, true) }}:
- pwsh: |
copy $(Build.SourcesDirectory)/test-proxy.log $(Build.ArtifactStagingDirectory)
displayName: 'Dump Test Proxy logs'
condition: succeededOrFailed()
# Unlink node_modules folders to significantly improve performance of subsequent tasks
# which need to walk the directory tree (and are hardcoded to follow symlinks).
# Retry for 30 seconds, since this command may fail with error "Another rush command is already
# running in this repository" if the previous rush command was killed.
- pwsh: |
for ($i=0; $i -lt 30; $i++) {
node eng/tools/rush-runner.js unlink
if ($lastexitcode -eq 0) {
break
}
else {
start-sleep 1
}
}
condition: always()
displayName: "Unlink dependencies"
# It's important for performance to pass "sdk" as "searchFolder" to avoid looking under root "node_modules".
# PublishTestResults.searchFolder only supports absolute paths, not relative.
- task: PublishTestResults@2
inputs:
searchFolder: "$(System.DefaultWorkingDirectory)/sdk"
testResultsFiles: "**/test-results.xml"
testRunTitle: "$(OSName) - NodeJS - Unit Tests - [Node $(NodeTestVersion)]"
condition: and(always(),eq(variables['TestType'], 'node'))
displayName: "Publish NodeJS unit test results"
# It's important for performance to pass "sdk" as "searchFolder" to avoid looking under root "node_modules".
# PublishTestResults.searchFolder only supports absolute paths, not relative.
- task: PublishTestResults@2
inputs:
searchFolder: "$(System.DefaultWorkingDirectory)/sdk"
testResultsFiles: "**/test-results.browser.xml"
testRunTitle: "$(OSName) - Browser - Unit Tests - [Node $(NodeTestVersion)]"
condition: and(always(),eq(variables['TestType'], 'browser'))
displayName: "Publish browser unit test results"
- ${{ if eq(parameters.TestProxy, true) }}:
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
parameters:
ArtifactPath: '$(Build.ArtifactStagingDirectory)/test-proxy.log'
ArtifactName: 'test proxy logs $(Agent.JobName)'
SbomEnabled: false