Repository navigation
324 lines (278 loc) · 11 KB
/
Copy pathci.yml
File metadata and controls
324 lines (278 loc) · 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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
name: CI
# Jobs in this workflow are all required run successfully before the PR can be merged. This is enforced by using GitHub status checks.
# What's GitHub status check: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks
permissions: {}
on:
pull_request:
types: [opened, synchronize]
merge_group:
push:
branches:
- main
- 'renovate/**' # For renovate bot "automerge": true
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
# JOB to run change detection
changes: # https://github.com/dorny/paths-filter
name: Detect Changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
rust-changes: ${{ (steps.filter.outputs.rust-changes == 'true') || (github.ref_name == 'main') }}
node-changes: ${{ (steps.filter.outputs.node-changes == 'true') || (github.ref_name == 'main') }}
pluginutils-changes: ${{ (steps.filter.outputs.pluginutils-changes == 'true') || (github.ref_name == 'main') }}
steps:
- uses: taiki-e/checkout-action@83ed61bfbe2b8abbb3c66e8b65b1335484c70009 # v1.4.1
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: |
rust-changes: &rust-changes
- '.github/workflows/**'
- 'crates/**'
- 'tasks/**'
- 'scripts/src/esbuild-tests/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- '.gitattributes'
- 'justfile'
- 'test262'
node-changes:
- *rust-changes
- 'packages/**'
- 'examples/**'
- 'scripts/**'
- 'package.json'
- 'justfile'
- 'rollup'
pluginutils-changes:
- 'packages/pluginutils/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- name: Show outputs
run: |
echo "Rust changes: ${{ (steps.filter.outputs.rust-changes == 'true') || (github.ref_name == 'main') }}"
echo "Node changes: ${{ (steps.filter.outputs.node-changes == 'true') || (github.ref_name == 'main') }}"
echo "PluginUtils changes: ${{ (steps.filter.outputs.pluginutils-changes == 'true') || (github.ref_name == 'main') }}"
rust-validation:
name: Rust Validation
needs: changes
if: ${{ needs.changes.outputs.rust-changes == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@83ed61bfbe2b8abbb3c66e8b65b1335484c70009 # v1.4.1
- name: Setup Rust
uses: oxc-project/setup-rust@23f38cfb0c04af97a055f76acee94d5be71c7c82 # v1.0.16
with:
tools: just
cache-key: lint
save-cache: ${{ github.ref_name == 'main' }}
components: clippy rustfmt
- run: just lint-rust
cargo-test:
needs: changes
strategy:
matrix:
target: ${{ github.ref_name == 'main' && fromJSON('["ubuntu-latest","macos-latest","windows-latest"]') || fromJSON('["ubuntu-latest"]') }}
uses: ./.github/workflows/reusable-cargo-test.yml
with:
os: ${{ matrix.target }}
changed: ${{ needs.changes.outputs.rust-changes == 'true' }}
node-test-windows:
needs: [changes, build-rolldown-windows]
uses: ./.github/workflows/reusable-node-test.yml
if: |
github.ref_name == 'main' &&
always() &&
(needs.build-rolldown-windows.result == 'success' || needs.build-rolldown-windows.result == 'skipped')
with:
os: windows-latest
node-version: 24
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
node-test-macos:
needs: [changes, build-rolldown-macos]
uses: ./.github/workflows/reusable-node-test.yml
if: |
github.ref_name == 'main' &&
always() &&
(needs.build-rolldown-macos.result == 'success' || needs.build-rolldown-macos.result == 'skipped')
with:
os: macos-latest
node-version: 24
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
node-test-ubuntu:
needs: [changes, build-rolldown-ubuntu]
# Matrix is defined here (not inside reusable-node-test.yml) because when the
# reusable workflow's job is skipped via `if: inputs.changed`, an internal matrix
# would never expand — producing zero jobs instead of skipped ones. GitHub required
# status checks need the job names to exist (even as "skipped") to pass.
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24]
uses: ./.github/workflows/reusable-node-test.yml
if: |
always() &&
(needs.build-rolldown-ubuntu.result == 'success' || needs.build-rolldown-ubuntu.result == 'skipped')
with:
os: ubuntu-latest
node-version: ${{ matrix.node-version }}
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
type-check:
name: Type Check
needs: [changes, build-rolldown-ubuntu]
if: needs.changes.outputs.node-changes == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: taiki-e/checkout-action@83ed61bfbe2b8abbb3c66e8b65b1335484c70009 # v1.4.1
- uses: oxc-project/setup-node@b8d296d30eafd1ae2968fab67aead472a1dbf6d4 # v1.0.7
- name: Download Native Rolldown Build
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: rolldown-native-ubuntu-latest
path: ./packages
- name: Build `@rolldown/test-dev-server`
run: pnpm --filter '@rolldown/test-dev-server' build
- name: Type Check
run: pnpm type-check
- name: Node Type Test
run: pnpm run --filter rolldown-tests test:types
node-dev-server-test-windows:
needs: [changes, build-rolldown-windows]
uses: ./.github/workflows/reusable-node-dev-server-test.yml
if: |
github.ref_name == 'main' &&
always() &&
(needs.build-rolldown-windows.result == 'success' || needs.build-rolldown-windows.result == 'skipped')
with:
os: windows-latest
node-version: 24
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
node-dev-server-test-macos:
needs: [changes, build-rolldown-macos]
uses: ./.github/workflows/reusable-node-dev-server-test.yml
if: |
github.ref_name == 'main' &&
always() &&
(needs.build-rolldown-macos.result == 'success' || needs.build-rolldown-macos.result == 'skipped')
with:
os: macos-latest
node-version: 24
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
node-dev-server-test-ubuntu:
needs: [changes, build-rolldown-ubuntu]
# Matrix is defined here (not inside reusable-node-dev-server-test.yml) because when the
# reusable workflow's job is skipped via `if: inputs.changed`, an internal matrix
# would never expand — producing zero jobs instead of skipped ones. GitHub required
# status checks need the job names to exist (even as "skipped") to pass.
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24]
uses: ./.github/workflows/reusable-node-dev-server-test.yml
if: |
always() &&
(needs.build-rolldown-ubuntu.result == 'success' || needs.build-rolldown-ubuntu.result == 'skipped')
with:
os: ubuntu-latest
node-version: ${{ matrix.node-version }}
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
build-rolldown-windows:
needs: changes
if: github.ref_name == 'main'
uses: ./.github/workflows/reusable-native-build.yml
with:
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
os: windows-latest
build-rolldown-macos:
needs: changes
if: github.ref_name == 'main'
uses: ./.github/workflows/reusable-native-build.yml
with:
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
os: macos-latest
build-rolldown-ubuntu:
needs: changes
uses: ./.github/workflows/reusable-native-build.yml
with:
changed: ${{ needs.changes.outputs.node-changes == 'true' }}
os: ubuntu-latest
pluginutils-test:
name: Pluginutils Test
needs: changes
if: ${{ needs.changes.outputs.pluginutils-changes == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@83ed61bfbe2b8abbb3c66e8b65b1335484c70009 # v1.4.1
- uses: oxc-project/setup-node@b8d296d30eafd1ae2968fab67aead472a1dbf6d4 # v1.0.7
- name: Test `@rolldown/pluginutils`
run: pnpm --filter '@rolldown/pluginutils' test
node-validation:
name: Node Validation
needs: changes
if: ${{ needs.changes.outputs.node-changes == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@83ed61bfbe2b8abbb3c66e8b65b1335484c70009 # v1.4.1
- name: Setup Rust
uses: oxc-project/setup-rust@23f38cfb0c04af97a055f76acee94d5be71c7c82 # v1.0.16
with:
tools: just
cache-key: native-build
save-cache: false
- uses: oxc-project/setup-node@b8d296d30eafd1ae2968fab67aead472a1dbf6d4 # v1.0.7
- name: Add WASI target
run: rustup target add wasm32-wasip1-threads
- name: Build Native Rolldown
run: just build-rolldown
- name: Build @rolldown/browser
run: just build-browser
- name: Build @rolldown/debug
run: just build-rolldown-debug
- name: Make sure generated code of `@rolldown/debug` is up-to-date
run: git diff --exit-code
- name: Build @rolldown/pluginutils
run: just build-pluginutils
- name: Lint Code
run: pnpm lint-code
- name: Lint publint
run: pnpm lint-publint
- name: Lint exports & dependencies
run: pnpm lint-knip
- name: Validate workspace package
run: node scripts/misc/published-package-check.mjs
repo-validation:
name: Repo Validation
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@83ed61bfbe2b8abbb3c66e8b65b1335484c70009 # v1.4.1
- name: Setup Rust
uses: oxc-project/setup-rust@23f38cfb0c04af97a055f76acee94d5be71c7c82 # v1.0.16
with:
cache-key: repo-validation
save-cache: ${{ github.ref_name == 'main' }}
components: rustfmt
- uses: oxc-project/setup-node@b8d296d30eafd1ae2968fab67aead472a1dbf6d4 # v1.0.7
- name: Lint Filename
run: cargo ls-lint
- name: update generated code
run: |
cargo run --bin generator
git diff --exit-code
typos:
name: Spell Check
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@83ed61bfbe2b8abbb3c66e8b65b1335484c70009 # v1.4.1
- uses: crate-ci/typos@631208b7aac2daa8b707f55e7331f9112b0e062d # v1.44.0
with:
files: .