-
-
Notifications
You must be signed in to change notification settings - Fork 843
297 lines (272 loc) 路 10.4 KB
/
Copy pathci.yml
File metadata and controls
297 lines (272 loc) 路 10.4 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
name: CI
on:
merge_group:
types: [checks_requested]
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
pull_request:
types: [opened, synchronize]
push:
branches:
- main
- v1.x
paths-ignore:
- '**/*.md'
- 'website/**'
tags-ignore:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' && github.ref_name != 'v1.x' }}
permissions:
# Allow commenting on issues for `reusable-build.yml`
issues: write
# Allow commenting on pull requests for `size-limit.yml`
pull-requests: write
jobs:
check-changed:
runs-on: ${{ fromJSON(vars.CI_LINUX_MINI_RUNNER || '"ubuntu-latest"') }}
name: Check Source Changed
outputs:
code_changed: ${{ steps.filter.outputs.code_changed == 'true' }}
document_changed: ${{ steps.filter.outputs.document_changed == 'true' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4
id: filter
with:
predicate-quantifier: 'every'
filters: |
code_changed:
- "!**/*.md"
- "!**/*.mdx"
- "!website/**"
document_changed:
- "website/**"
build-linux:
name: Build Linux
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build-build.yml
with:
target: x86_64-unknown-linux-gnu
profile: 'ci'
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
test-linux:
name: Test Linux
needs: [check-changed, build-linux]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build-test.yml
with:
target: x86_64-unknown-linux-gnu
runner: '"ubuntu-22.04"'
bench-rust:
name: Rust Bench
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/bench-rust.yml
with:
target: x86_64-unknown-linux-gnu
runner: '"ubuntu-22.04"'
bench-rust-walltime:
name: Rust Bench Walltime
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) }}
uses: ./.github/workflows/bench-rust.yml
with:
target: x86_64-unknown-linux-gnu
measurement: walltime
bench_target: walltime
runner: '"physical-1-exclusive"'
test-windows:
name: Test Windows
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build.yml
with:
target: x86_64-pc-windows-msvc
profile: 'ci'
runner: ${{ vars.WINDOWS_SELF_HOSTED_RUNNER_LABELS || '"windows-latest"' }}
test-runner: '"windows-latest"'
test: true
test-mac:
name: Test Mac ARM64
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build.yml
with:
target: aarch64-apple-darwin
profile: 'ci'
runner: ${{ vars.MAC_SELF_HOSTED_RUNNER_LABELS || '"macos-latest"' }}
test-runner: ${{ '"macos-latest"' }}
test: true
build-wasm:
name: Build WASM
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build-build.yml
with:
target: wasm32-wasip1-threads
profile: 'ci'
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
test-wasm:
name: Test WASM
needs: [check-changed, build-wasm]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build-test.yml
with:
target: wasm32-wasip1-threads
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
build-riscv64:
name: Build riscv64
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build-build.yml
with:
target: riscv64gc-unknown-linux-gnu
profile: 'ci'
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
build-ppc64:
name: Build ppc64
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build-build.yml
with:
target: powerpc64le-unknown-linux-gnu
profile: 'ci'
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
build-s390x:
name: Build s390x
needs: [check-changed]
# SWC Next 0.1.3 unconditionally rejects big-endian targets in its AST FFI.
# Re-enable after upstream makes the unused FFI serializer portable or optional.
if: ${{ false }}
uses: ./.github/workflows/reusable-build-build.yml
with:
target: s390x-unknown-linux-gnu
profile: 'ci'
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
# TODO: Enable this job after Rspack portable cache is implemented.
check-cache:
name: Check Cache Portable
needs: [test-linux, test-windows]
if: ${{ false }}
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
key: test_cache
save-if: true
- name: Download linux cache
uses: ./.github/actions/artifact/download
with:
name: testCase-persistentCache-linux
path: ./cache-linux
force-use-github-only: true
- name: Download windows cache
uses: ./.github/actions/artifact/download
with:
name: testCase-persistentCache-windows
path: ./cache-windows
force-use-github-only: true
- name: Run compare kit
run: cargo run -p rspack_tools -- compare ./cache-linux ./cache-windows
test_required_check:
# this job will be used for GitHub actions to determine required job success or not;
# When code changed, it will check if any of the test jobs failed.
# When *only* doc changed, it will run as success directly
name: Test Required Check
needs:
[
build-linux,
test-linux,
test-windows,
test-mac,
build-wasm,
build-riscv64,
build-ppc64,
build-s390x,
test-wasm,
check-changed,
check-cache,
]
if: ${{ always() && !cancelled() }}
runs-on: ${{ fromJSON(vars.CI_LINUX_MINI_RUNNER || '"ubuntu-latest"') }}
steps:
- name: Log
run: echo ${{ join(needs.*.result, ',') }}
- name: Test check
if: ${{ needs.check-changed.outputs.code_changed == 'true'
&& join(needs.*.result, ',')!='success,success,success,success,success,success,success,skipped,success,success,skipped' }}
run: echo "Test Failed" && exit 1
- name: No check to Run test
run: echo "Success"
size-limit:
name: Binary Size Limit
needs: [check-changed, build-linux]
# On a PR this only comments (it is deliberately not part of Test Required Check).
# On a trunk push it gates: exceeding the threshold fails the job, and with it the run.
if: ${{ needs.check-changed.outputs.code_changed == 'true' && (github.event_name == 'pull_request' || (github.event_name == 'push' && github.repository == 'web-infra-dev/rspack')) }}
uses: ./.github/workflows/size-limit.yml
ecosystem_ci_per_commit:
name: Run ecosystem CI per commit
needs: [check-changed, build-linux]
runs-on: ubuntu-latest
timeout-minutes: 40
permissions:
contents: write
if: ${{ needs.check-changed.outputs.code_changed == 'true' && github.event_name == 'push' }}
steps:
- name: Trigger Ecosystem CI
uses: rstackjs/rstack-ecosystem-ci/.github/actions/ecosystem_ci_per_commit@ecca2c865c3830f56824fe7a3c6513bac77f5c8f # v0.3.4
with:
github-token: ${{ secrets.REPO_RSTACK_ECO_CI_GITHUB_TOKEN }}
ecosystem-owner: web-infra-dev
ecosystem-repo: rspack
workflow-file: rspack-ecosystem-ci-from-commit.yml
client-payload: '{"commitSHA":"${{ github.sha }}","updateComment":true,"repo":"web-infra-dev/rspack","suite":"-","suiteRefType":"precoded","suiteRef":"precoded","sourceRunId":"${{ github.run_id }}","sourceRepo":"web-infra-dev/rspack"}'
upload-binary-size:
name: Upload Binary Size
needs: [check-changed, build-linux]
if: ${{ needs.check-changed.outputs.code_changed == 'true' && github.event_name == 'push' && github.repository == 'web-infra-dev/rspack' }}
runs-on: ${{ fromJSON(vars.CI_LINUX_MINI_RUNNER || '"ubuntu-latest"') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Download binding artifact
uses: ./.github/actions/artifact/download
with:
name: bindings-x86_64-unknown-linux-gnu
path: crates/node_binding/
# Must mirror size-limit.yml: the uploaded size is the baseline PRs compare against.
- name: Strip binary
run: strip crates/node_binding/rspack.linux-x64-gnu.node
# github-script rather than `run: node`: this runner has no Node installed.
- name: Upload binary size
uses: actions/github-script@450193c5abd4cdb17ba9f3ffcfe8f635c4bb6c2a
env:
PERF_DATA_TOKEN: ${{ secrets.PERF_DATA_TOKEN }}
with:
script: |
const upload = require('./.github/actions/binary-limit/upload-binary-size.js');
upload({ sha: context.sha, token: process.env.PERF_DATA_TOKEN });
# TODO: enable it after self hosted runners are ready
# pkg-preview:
# name: Pkg Preview
# needs:
# - test-linux
# - test-windows
# - cargo-deny
# - lint
# - rust_check
# - rust_test
# # after merged to main branch
# if: ${{ !failure() && github.event_name == 'push' }}
# uses: ./.github/workflows/preview-commit.yml