-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
azure-pipelines.yml
139 lines (114 loc) · 4.23 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
trigger:
- main
# https://developercommunity.visualstudio.com/comments/949241/view.html
pr:
branches:
include:
- "*"
pool:
vmImage: "ubuntu-20.04"
# TODO we don't actually need this for karma or cypress tests
# but it let's us use a single job. No need to split up jobs yet
strategy:
matrix:
# EOL: 2025-04-30
node_18_x:
node_version: 18.x
# EOL: 2026-04-30
node_20_x:
node_version: 20.x
steps:
- task: [email protected]
inputs:
versionSpec: $(node_version)
displayName: "Install Node.js"
- script: |
yarn install
displayName: "Install packages"
- script: |
yarn format
git diff --exit-code
displayName: "Check format"
- script: yarn lint
displayName: "Lint code"
- script: yarn test:types
displayName: "Test types"
- script: |
yarn build
displayName: "Build"
- script: |
npm pack
mv dom-accessibility-api-*.tgz dom-accessibility-api.tgz
displayName: "Create tarball"
- publish: $(System.DefaultWorkingDirectory)/dom-accessibility-api.tgz
displayName: "Publish tarball"
artifact: dom-accessibility-api-node-$(node_version)
- task: [email protected]
displayName: "Download tarball from main"
inputs:
artifact: dom-accessibility-api-node-$(node_version)
path: $(Agent.TempDirectory)/artifacts-main
source: specific
# Otherwise green builds (with tasks that have `continueOnError`) are not considered.
# We need `continueOnError` if we add a new matrix entry.
allowPartiallySucceededBuilds: true
pipeline: $(System.DefinitionId)
project: $(System.TeamProject)
runVersion: latestFromBranch
runBranch: refs/heads/main
# Needed if we introduce a new Node.js version
continueOnError: true
- script: |
mkdir $(Agent.TempDirectory)/published-previous
mkdir $(Agent.TempDirectory)/published-current
tar xfz $(Agent.TempDirectory)/artifacts-main/dom-accessibility-api.tgz --directory $(Agent.TempDirectory)/published-previous
tar xfz $(System.DefaultWorkingDirectory)/dom-accessibility-api.tgz --directory $(Agent.TempDirectory)/published-current
# --no-index implies --exit-code
# This task is informative only.
# Diffs are almost always expected
git --no-pager diff --color --no-index $(Agent.TempDirectory)/published-previous $(Agent.TempDirectory)/published-current || exit 0
displayName: "Diff tarballs"
- script: yarn start
displayName: "kcd-rollup smoke tests of build"
workingDirectory: tests/build/fixtures/kcd-rollup
- script: yarn start
displayName: "ava+ts-node smoke tests of build"
workingDirectory: tests/build/fixtures/ava-ts-node
- script: yarn start
displayName: "ES modules in node smoke tests of build"
workingDirectory: tests/build/fixtures/node-es-modules
- script: yarn test:ci
displayName: "Run jest tests"
- task: [email protected]
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: "$(System.DefaultWorkingDirectory)/junit.xml"
- task: [email protected]
inputs:
codeCoverageTool: Cobertura
failIfCoverageEmpty: true
summaryFileLocation: "$(System.DefaultWorkingDirectory)/scripts/jest/coverage/*coverage.xml"
- script: |
yarn wpt:init
tests/wpt/wpt make-hosts-file | sudo tee -a /etc/hosts
displayName: "Prepare web-platform-test"
- script: yarn test:wpt:jsdom
displayName: "Run wpt tests in jsdom"
- script: yarn test:wpt:browser
displayName: "Run wpt tests in browser"
- bash: |
if [ -d tests/cypress/screenshots ]; then
echo "##vso[task.setVariable variable=CY_SCREENSHOTS_EXIST]true"
else
echo "##vso[task.setVariable variable=CY_SCREENSHOTS_EXIST]false"
fi
condition: always()
displayName: Check if cypress screenshots were created
- publish: tests/cypress/screenshots
artifact: browser-test-screenshots-node-$(node_version)
condition: and(failed(), eq(variables.CY_SCREENSHOTS_EXIST, 'true'))
displayName: "Publish cypress screenshots"
- publish: tests/cypress/videos
artifact: browser-test-videos-node-$(node_version)
displayName: "Publish cypress screenshots"