-
-
Notifications
You must be signed in to change notification settings - Fork 768
204 lines (187 loc) · 6.3 KB
/
ci.yml
File metadata and controls
204 lines (187 loc) · 6.3 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
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
- v2
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 != 'v2' }}
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: 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@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: filter
with:
predicate-quantifier: 'every'
filters: |
code_changed:
- "!**/*.md"
- "!**/*.mdx"
- "!website/**"
document_changed:
- "website/**"
test-linux:
name: Test Linux
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build.yml
with:
target: x86_64-unknown-linux-gnu
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
test: true
bench: true
prefer_docker: false
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: 'dev'
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
test-wasm:
name: Test WASM
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
uses: ./.github/workflows/reusable-build.yml
with:
target: wasm32-wasip1-threads
profile: 'ci'
runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
test: true
check-codspeed:
name: Check Bench Result
needs: [test-linux]
runs-on: ubuntu-24.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Polling Comment
if: ${{ github.event_name == 'pull_request' }}
run: bash .github/actions/codspeed/check-comment.sh
check-cache:
name: Check Cache Portable
needs: [test-linux, test-windows]
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- 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: true
- name: Download windows cache
uses: ./.github/actions/artifact/download
with:
name: testCase-persistentCache-windows
path: ./cache-windows
force-use-github: true
- name: Run compare kit
run: |
echo "success"
# TODO open it after rspack portable cache implementation
# 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:
[
check-codspeed,
test-linux,
test-windows,
test-mac,
test-wasm,
check-changed,
size-limit,
check-cache,
]
if: ${{ always() && !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Log
run: echo ${{ join(needs.*.result, ',') }}
- name: Test check
if: ${{ needs.check-changed.outputs.code_changed == 'true'
&& github.event_name == 'pull_request'
&& join(needs.*.result, ',')!='success,success,success,success,success,success,success,success' }}
run: echo "Tess Failed" && exit 1
- name: Test check
if: ${{ needs.check-changed.outputs.code_changed == 'true'
&& github.event_name != 'pull_request'
&& join(needs.*.result, ',')!='success,success,success,success,success,success,skipped,success' }}
run: echo "Tess Failed" && exit 1
- name: No check to Run test
run: echo "Success"
size-limit:
name: Binary Size Limit
needs: [check-changed]
if: ${{ needs.check-changed.outputs.code_changed == 'true' && github.event_name == 'pull_request' }}
uses: ./.github/workflows/size-limit.yml
# 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