Repository navigation
239 lines (231 loc) · 8.11 KB
/
Copy pathci.yml
File metadata and controls
239 lines (231 loc) · 8.11 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: CI
on:
push:
branches:
- develop
- 'feature/**'
pull_request:
branches:
- main
- develop
- 'feature/**'
workflow_call:
inputs:
full:
description: 'Run full OS x Node matrix'
required: false
type: boolean
default: false
jobs:
compute-matrix:
name: Compute matrix
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.set.outputs.matrix }}
name_suffix: ${{ steps.set.outputs.name_suffix }}
steps:
- id: set
env:
EVENT_NAME: ${{ github.event_name }}
BASE_REF: ${{ github.base_ref }}
FULL_MATRIX: ${{ inputs.full }}
run: |
if [[ "$FULL_MATRIX" == "true" || ( "$EVENT_NAME" == "pull_request" && "$BASE_REF" == "main" ) ]]; then
echo 'matrix={"os":["ubuntu-24.04","windows-latest"],"node":[22,24]}' >> "$GITHUB_OUTPUT"
echo 'name_suffix=(full matrix)' >> "$GITHUB_OUTPUT"
else
echo 'matrix={"os":["ubuntu-24.04","windows-latest"],"node":[24]}' >> "$GITHUB_OUTPUT"
echo 'name_suffix=' >> "$GITHUB_OUTPUT"
fi
unit:
name: Units (${{ matrix.os }}, Node ${{ matrix.node }})
needs: compute-matrix
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.compute-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Use Node.js
uses: actions/setup-node@v7.0.0
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Typecheck
run: npm run typecheck
- name: Verify test groups
run: npm run test:inventory
- name: Units with coverage (no package build)
if: matrix.os == 'ubuntu-24.04' && matrix.node == 24
run: npm run test:run -- --selectProjects unit-node unit-dom --ci --coverage --coverageDirectory=coverage/unit
- name: Units (no package build)
if: matrix.os != 'ubuntu-24.04' || matrix.node != 24
run: npm run test:run -- --selectProjects unit-node unit-dom --ci
- name: Upload unit coverage
if: matrix.os == 'ubuntu-24.04' && matrix.node == 24
uses: actions/upload-artifact@v7.0.1
with:
name: coverage-unit-${{ matrix.os }}-node${{ matrix.node }}
path: coverage/unit/coverage-final.json
build:
name: Build integrations (${{ matrix.os }}, Node ${{ matrix.node }})
needs: compute-matrix
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.compute-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Use Node.js
uses: actions/setup-node@v7.0.0
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Compiler, CLI and declaration integrations with coverage
if: matrix.os == 'ubuntu-24.04' && matrix.node == 24
run: npm run test:run -- --selectProjects build types --ci --maxWorkers=2 --coverage --coverageDirectory=coverage/build
- name: Compiler, CLI and declaration integrations
if: matrix.os != 'ubuntu-24.04' || matrix.node != 24
run: npm run test:run -- --selectProjects build types --ci --maxWorkers=2
- name: Override builds in isolated sessions
run: npm run test:run -- --selectProjects build --testPathPatterns=tests/integration/build/override --ci --maxWorkers=2
env:
ADNBN_OVERRIDE_BUILD_MODE: session
- name: Upload build coverage
if: matrix.os == 'ubuntu-24.04' && matrix.node == 24
uses: actions/upload-artifact@v7.0.1
with:
name: coverage-build-${{ matrix.os }}-node${{ matrix.node }}
path: coverage/build/coverage-final.json
fixtures:
name: Fixture types (${{ matrix.os }}, Node ${{ matrix.node }})
needs: compute-matrix
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.compute-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Use Node.js
uses: actions/setup-node@v7.0.0
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Build package, prepare and typecheck every application
run: npm run typecheck:fixtures
browser:
name: Browser (${{ matrix.browser }}, Node ${{ matrix.node }})
needs: compute-matrix
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
node: ${{ fromJSON(needs.compute-matrix.outputs.matrix).node }}
browser: [chrome, firefox]
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Use Node.js
uses: actions/setup-node@v7.0.0
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Set up Chrome
if: matrix.browser == 'chrome'
id: chrome
uses: browser-actions/setup-chrome@v2
with:
chrome-version: stable
- name: Set up Firefox
if: matrix.browser == 'firefox'
id: firefox
uses: browser-actions/setup-firefox@v1
with:
firefox-version: latest
- name: Build package
run: npm run build
- name: Browser integrations
run: npm run test:run -- --selectProjects ${{ matrix.browser }} --ci --maxWorkers=2
env:
ADNBN_CHROME_BIN: ${{ steps.chrome.outputs.chrome-path }}
ADNBN_FIREFOX_BIN: ${{ steps.firefox.outputs.firefox-path }}
- name: Upload browser startup timings
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: browser-startup-${{ matrix.browser }}-node-${{ matrix.node }}
path: .cache/integration/browser-startup.json
include-hidden-files: true
if-no-files-found: ignore
retention-days: 7
coverage:
name: Coverage (ubuntu-24.04, Node 24)
needs: [compute-matrix, unit, build]
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Use Node.js
uses: actions/setup-node@v7.0.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Download unit coverage
uses: actions/download-artifact@v8.0.1
with:
name: coverage-unit-ubuntu-24.04-node24
path: coverage/unit
- name: Download build coverage
uses: actions/download-artifact@v8.0.1
with:
name: coverage-build-ubuntu-24.04-node24
path: coverage/build
- name: Merge source coverage from both groups
run: node scripts/merge-coverage.mjs coverage/unit/coverage-final.json coverage/build/coverage-final.json
- name: Upload coverage
uses: actions/upload-artifact@v7.0.1
with:
name: coverage-ubuntu-24.04-node24
path: coverage/merged
# Keep the existing required check names while the work runs in independent jobs.
build-and-test:
name: Test and Build (${{ matrix.os == 'ubuntu-24.04' && 'ubuntu-latest' || matrix.os }}, Node ${{ matrix.node }}) ${{ needs.compute-matrix.outputs.name_suffix }}
if: ${{ always() && needs.compute-matrix.result == 'success' }}
needs: [compute-matrix, unit, build, fixtures, browser, coverage]
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.compute-matrix.outputs.matrix) }}
steps:
- name: Require all test groups
env:
RESULTS: ${{ join(needs.*.result, ',') }}
run: |
if [[ "$RESULTS" == *failure* || "$RESULTS" == *cancelled* || "$RESULTS" == *skipped* ]]; then
exit 1
fi