-
Notifications
You must be signed in to change notification settings - Fork 32
186 lines (174 loc) · 5.32 KB
/
ci.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
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
name: CI
on:
merge_group:
pull_request:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # for checkout
jobs:
build:
name: Build, lint and test coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: lts/*
- run: npm ci
- run: npx ls-engines
- run: npm run prepublishOnly
- name: Register Problem Matcher for ESLint that handles --report-unused-disable-directives
run: echo "::add-matcher::.github/eslint-compact.json"
- run: npm run lint -- --report-unused-disable-directives -f compact
- run: npm run coverage
- uses: actions/upload-artifact@v4
name: Cache build output
with:
name: build-output
path: |
dist/
umd/
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Run the testing suite on each major OS with the latest LTS release of Node.js
os: [macos-latest, ubuntu-latest, windows-latest]
node: [lts/*]
# It makes sense to also test the oldest, and latest, versions of Node.js, on ubuntu-only since it's the fastest CI runner
include:
- os: ubuntu-latest
# Also test the previous LTS release
node: lts/-1
# @TODO re-enable after the nightly builds work with vitest once again
# - os: ubuntu-latest
# # Test the actively developed version that will become the latest LTS release next October
# node: current
# The `build` job already runs the testing suite in ubuntu and lts/*
exclude:
- os: ubuntu-latest
node: lts/*
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: ${{ matrix.node }}
- run: npm install
- run: npx ls-engines
- run: npm run coverage
prod-deps:
name: Cache production dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: prod-deps
uses: actions/cache@v4
with:
path: ./node_modules
key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- if: steps.prod-deps.outputs.cache-hit != 'true'
uses: actions/setup-node@v4
with:
node-version: lts/*
- if: steps.prod-deps.outputs.cache-hit != 'true'
run: npm install --omit=dev --ignore-scripts
edge-runtime:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: lts/*
- run: npm install
- uses: actions/download-artifact@v4
name: Restore build output
with:
name: build-output
- run: npm run test:edge-runtime -- --coverage
browser-runtime:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: lts/*
- run: npm install
- uses: actions/download-artifact@v4
name: Restore build output
with:
name: build-output
- run: npm run test:browser -- --coverage
deno-runtime:
runs-on: ubuntu-latest
needs: [build, prod-deps]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
name: Install only production dependencies
with:
path: ./node_modules
key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- uses: actions/download-artifact@v4
name: Restore build output
with:
name: build-output
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x.x
- run: npm run test:deno
bun-runtime:
runs-on: ubuntu-latest
needs: [build, prod-deps]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
name: Install only production dependencies
with:
path: ./node_modules
key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- uses: actions/download-artifact@v4
name: Restore build output
with:
name: build-output
- uses: antongolub/action-setup-bun@f0b9f339a7ce9ba1174a58484e4dc9bbd6f7b133 # v1
- run: npm run test:bun
node-runtimes:
runs-on: ubuntu-latest
needs: [build, prod-deps]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
name: Install only production dependencies
with:
path: ./node_modules
key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/download-artifact@v4
name: Restore build output
with:
name: build-output
- run: npm run test:node-runtimes
next-runtime:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: lts/*
- run: npm install
- run: npm run test:next