forked from eps1lon/dom-accessibility-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
150 lines (125 loc) · 4.6 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
140
141
142
143
144
145
146
147
148
149
150
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: 2022-04-30
node_12_x:
node_version: 12.x
# EOL: 2023-04-30
node_14_x:
node_version: 14.x
# EOL: 2024-04-30
node_16_x:
node_version: 16.x
# EOL: 2022-06-01
node_17_x:
node_version: 17.x
# Initial release: 2022-04-19
# EOL: 2025-04-30
#node_18_x:
# node_version: 18.x
steps:
- task: NodeTool@0
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: DownloadPipelineArtifact@2
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
- 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
# in node 12 we need to use a flag and I'm too lazy to branch even further
# not running in node < 13 is hopefully a sufficient smoke test
condition: not(or(startsWith(variables['node_version'], '10.'), startsWith(variables['node_version'], '12.')))
- script: yarn test:ci
displayName: "Run jest tests"
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: "$(System.DefaultWorkingDirectory)/junit.xml"
- task: PublishCodeCoverageResults@1
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"