@@ -24,40 +24,65 @@ concurrency:
24
24
cancel-in-progress : true
25
25
26
26
jobs :
27
- test :
28
- runs-on : ubuntu-latest
29
- strategy :
30
- matrix :
31
- node-version : [lts/-3, lts/-2, lts/-1, lts/*, current]
32
- name : node ${{ matrix.node-version }}
33
- steps :
34
- - uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
35
- - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
36
- with :
37
- node-version : ${{ matrix.node-version }}
38
- cache : ' npm'
39
- - run : npm install
40
- - run : npm test
41
-
42
27
build :
28
+ name : Build, lint and test coverage
43
29
runs-on : ubuntu-latest
44
30
steps :
45
31
- uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
46
- - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag= v3
32
+ - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
47
33
with :
34
+ cache : npm
48
35
node-version : lts/*
49
- cache : ' npm'
50
36
- run : npm ci
37
+ - run : npx ls-engines
51
38
- run : npm run prepublishOnly
52
- - uses : actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # tag=v3
39
+ - run : npm run lint -- --report-unused-disable-directives
40
+ - run : npm run coverage
41
+ - uses : actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
42
+ name : Cache build output
53
43
with :
54
44
name : build-output
55
45
path : |
56
46
dist/
57
- lib/
58
47
umd/
59
48
49
+ test :
50
+ needs : build
51
+ runs-on : ${{ matrix.os }}
52
+ strategy :
53
+ fail-fast : false
54
+ matrix :
55
+ # Run the testing suite on each major OS with the latest LTS release of Node.js
56
+ os : [macos-latest, ubuntu-latest, windows-latest]
57
+ node : [lts/*]
58
+ # It makes sense to also test the oldest, and latest, versions of Node.js, on ubuntu-only since it's the fastest CI runner
59
+ include :
60
+ - os : ubuntu-latest
61
+ # Test the oldest LTS release of Node that's still receiving bugfixes and security patches, versions older than that have reached End-of-Life
62
+ node : lts/-2
63
+ - os : ubuntu-latest
64
+ # Also test the previous LTS release
65
+ node : lts/-1
66
+ - os : ubuntu-latest
67
+ # Test the actively developed version that will become the latest LTS release next October
68
+ node : current
69
+ # The `build` job already runs the testing suite in ubuntu and lts/*
70
+ exclude :
71
+ - os : ubuntu-latest
72
+ # Test the oldest LTS release of Node that's still receiving bugfixes and security patches, versions older than that have reached End-of-Life
73
+ node : lts/*
74
+ steps :
75
+ - uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
76
+ - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
77
+ with :
78
+ cache : npm
79
+ node-version : ${{ matrix.node }}
80
+ - run : npm install
81
+ - run : npx ls-engines
82
+ - run : npm run coverage
83
+
60
84
prod-deps :
85
+ name : Cache production dependencies
61
86
runs-on : ubuntu-latest
62
87
steps :
63
88
- uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
@@ -67,70 +92,101 @@ jobs:
67
92
path : ./node_modules
68
93
key : prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
69
94
- if : steps.prod-deps.outputs.cache-hit != 'true'
70
- uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag= v3
95
+ uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
71
96
with :
72
97
node-version : lts/*
73
98
- if : steps.prod-deps.outputs.cache-hit != 'true'
74
99
run : npm install --omit=dev --ignore-scripts
75
100
76
- # Disabled until the jest runtime works with ESM
77
- # edge-runtime:
78
- # runs-on: ubuntu-latest
79
- # needs: [build, prod-deps]
80
- # steps:
81
- # - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
82
- # - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
83
- # with:
84
- # node-version: lts/*
85
- # cache: 'npm'
86
- # cache-dependency-path: runtimes/edge/package-lock.json
87
- # - uses: actions/cache@1c73980b09e7aea7201f325a7aa3ad00beddcdda # tag=v3
88
- # with:
89
- # path: ./node_modules
90
- # key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
91
- # - uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # tag=v3
92
- # with:
93
- # name: build-output
94
- # - run: npm ci
95
- # working-directory: runtimes/edge
96
- # - run: npm test
97
- # working-directory: runtimes/edge
101
+ edge-runtime :
102
+ runs-on : ubuntu-latest
103
+ needs : [build]
104
+ steps :
105
+ - uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
106
+ - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
107
+ with :
108
+ cache : npm
109
+ node-version : lts/*
110
+ - run : npm install
111
+ - uses : actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3
112
+ name : Restore build output
113
+ with :
114
+ name : build-output
115
+ - run : npm run test:edge-runtime -- --coverage
116
+
117
+ browser-runtime :
118
+ runs-on : ubuntu-latest
119
+ needs : [build]
120
+ steps :
121
+ - uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
122
+ - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
123
+ with :
124
+ cache : npm
125
+ node-version : lts/*
126
+ - run : npm install
127
+ - uses : actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3
128
+ name : Restore build output
129
+ with :
130
+ name : build-output
131
+ - run : npm run test:browser -- --coverage
98
132
99
133
deno-runtime :
100
134
runs-on : ubuntu-latest
101
135
needs : [build, prod-deps]
102
136
steps :
103
137
- uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
104
138
- uses : actions/cache@4723a57e26efda3a62cbde1812113b730952852d # v3
139
+ name : Install only production dependencies
105
140
with :
106
141
path : ./node_modules
107
142
key : prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
108
143
- uses : actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3
144
+ name : Restore build output
109
145
with :
110
146
name : build-output
111
147
- uses : denoland/setup-deno@v1
112
- - name : deno test
113
- run : |
114
- deno fmt --check
115
- deno lint
116
- deno task test
117
- working-directory : runtimes/deno
148
+ with :
149
+ deno-version : vx.x.x
150
+ - run : npm run test:deno
118
151
119
152
bun-runtime :
120
153
runs-on : ubuntu-latest
121
154
needs : [build, prod-deps]
122
155
steps :
123
156
- uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
124
157
- uses : actions/cache@4723a57e26efda3a62cbde1812113b730952852d # v3
158
+ name : Install only production dependencies
125
159
with :
126
160
path : ./node_modules
127
161
key : prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
128
- - uses : antongolub/action-setup-bun@bc198f5cb868ce282f0a72bdd7da3a06a5387f83 # tag=v1
129
- - run : bun wiptest
130
- working-directory : runtimes/bun
162
+ - uses : actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3
163
+ name : Restore build output
164
+ with :
165
+ name : build-output
166
+ - uses : antongolub/action-setup-bun@bc198f5cb868ce282f0a72bdd7da3a06a5387f83 # v1
167
+ - run : npm run test:bun
168
+
169
+ node-runtimes :
170
+ runs-on : ubuntu-latest
171
+ needs : [build, prod-deps]
172
+ steps :
173
+ - uses : actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
174
+ - uses : actions/cache@4723a57e26efda3a62cbde1812113b730952852d # v3
175
+ name : Install only production dependencies
176
+ with :
177
+ path : ./node_modules
178
+ key : prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
179
+ - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
180
+ with :
181
+ node-version : lts/*
182
+ - uses : actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3
183
+ name : Restore build output
184
+ with :
185
+ name : build-output
186
+ - run : npm run test:node-runtimes
131
187
132
188
release :
133
- needs : [build, test, deno-runtime, bun-runtime]
189
+ needs : [build, test, deno-runtime, bun-runtime, edge-runtime, browser-runtime, node-runtimes ]
134
190
# only run if opt-in during workflow_dispatch
135
191
if : github.event.inputs.release == 'true'
136
192
runs-on : ubuntu-latest
@@ -140,13 +196,12 @@ jobs:
140
196
# Need to fetch entire commit history to
141
197
# analyze every commit since last release
142
198
fetch-depth : 0
143
- - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag= v3
199
+ - uses : actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
144
200
with :
145
201
node-version : lts/*
146
202
cache : npm
147
203
- run : npm ci
148
204
# Branches that will release new versions are defined in .releaserc.json
149
- # @TODO remove dry-run after everything is good to go
150
205
- run : npx semantic-release
151
206
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
152
207
# e.g. git tags were pushed but it exited before `npm publish`
0 commit comments