-
-
Notifications
You must be signed in to change notification settings - Fork 477
305 lines (278 loc) · 8.83 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
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
name: CI
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**/*.md'
- '**/*.yml'
- '!.github/workflows/ci.yml'
- '!.github/actions/clone-submodules/action.yml'
push:
branches:
- main
- "renovate/**"
paths-ignore:
- '**/*.md'
- '**/*.yml'
- '!.github/workflows/ci.yml'
- '!.github/actions/clone-submodules/action.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-D warnings"
jobs:
optimize_ci:
name: Graphite Optimize CI
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- uses: withgraphite/graphite-ci-action@main
id: check_skip
with:
graphite_token: ${{ secrets.GRAPHITE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
test:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Test
strategy:
fail-fast: false
matrix:
include:
# - os: windows-latest # See `test-windows` job below
- os: ubuntu-latest
- os: macos-14
runs-on: ${{ matrix.os }}
env:
# https://github.com/mozilla/sccache/blob/main/docs/S3.md
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }}
SCCACHE_ENDPOINT: ${{ secrets.SCCACHE_ENDPOINT }}
SCCACHE_REGION: auto
RUSTC_WRAPPER: ${{ vars.USE_SCCACHE == 'true' && 'sccache' || '' }}
CARGO_INCREMENTAL: 0
SCCACHE_LOCAL_RW_MODE:
steps:
- uses: taiki-e/checkout-action@v1
- uses: Boshen/setup-rust@main
with:
# warm cache factory for all other CI jobs
# cache `target` directory to avoid download crates
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm
# cache build outputs to speed up compilation
- uses: mozilla-actions/sccache-action@v0.0.5
if: ${{ vars.USE_SCCACHE == 'true' }}
- run: cargo ck
- run: cargo test --no-run
- run: cargo test
test-windows:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Test (windows-latest)
runs-on: windows-latest
steps:
- uses: taiki-e/checkout-action@v1
# Unsung heros of the internet, who led me here to speed up window's slowness:
# https://github.com/actions/cache/issues/752#issuecomment-1847036770
# https://github.com/astral-sh/uv/blob/502e04200d52de30d3159894833b3db4f0d6644d/.github/workflows/ci.yml#L158
- uses: samypr100/setup-dev-drive@v3
with:
workspace-copy: true
drive-size: 8GB
- name: Install Rust
working-directory: ${{ env.DEV_DRIVE_WORKSPACE }}
env:
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
shell: bash
run: |
sed -i -e 's/profile = "default"/profile = "minimal"/g' rust-toolchain.toml
rustup set profile minimal
rustup show
git restore .
- uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ env.DEV_DRIVE_WORKSPACE }}
save-if: ${{ github.ref_name == 'main' }}
shared-key: windows-latest
env:
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
- name: Run
working-directory: ${{ env.DEV_DRIVE_WORKSPACE }}
env:
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
shell: bash
run: |
cargo test --no-run
cargo test
cargo ck
wasm:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Check Wasm
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: Boshen/setup-rust@main
with:
cache-key: wasm
save-cache: ${{ github.ref_name == 'main' }}
- name: Check
run: |
rustup target add wasm32-unknown-unknown
cargo check -p oxc_wasm --target wasm32-unknown-unknown
- name: Build
run: |
npx -y wasm-pack build --target web --dev ./crates/oxc_wasm
npx -y wasm-pack build --target web --dev ./wasm/parser
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Check output types
run: npx -y -p typescript tsc --lib es2020,dom crates/oxc_wasm/pkg/oxc_wasm.d.ts
typos:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Spell Check
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: crate-ci/typos@v1.22.9
with:
files: .
deny:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Cargo Deny
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'Cargo.lock'
- uses: Boshen/setup-rust@main
if: steps.filter.outputs.src == 'true'
with:
restore-cache: false
tools: cargo-deny
- if: steps.filter.outputs.src == 'true'
run: cargo deny check
unused-deps:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Check Unused Dependencies
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- '**/*.rs'
- '**/Cargo.toml'
- 'Cargo.lock'
- uses: Boshen/setup-rust@main
with:
restore-cache: false
if: steps.filter.outputs.src == 'true'
- uses: cargo-bins/cargo-binstall@main
if: steps.filter.outputs.src == 'true'
- run: cargo binstall --no-confirm cargo-shear
if: steps.filter.outputs.src == 'true'
- run: cargo shear
if: steps.filter.outputs.src == 'true'
format:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Format
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: Boshen/setup-rust@main
with:
components: rustfmt
restore-cache: false
- run: cargo fmt --all -- --check
lint:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: Boshen/setup-rust@main
with:
cache-key: warm
components: clippy
- run: cargo lint -- -D warnings
doc:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Doc
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: Boshen/setup-rust@main
with:
cache-key: warm
components: rust-docs
- run: RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items
conformance:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Conformance
runs-on: ubuntu-latest
env:
# https://github.com/mozilla/sccache/blob/main/docs/S3.md
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }}
SCCACHE_ENDPOINT: ${{ secrets.SCCACHE_ENDPOINT }}
SCCACHE_REGION: auto
RUSTC_WRAPPER: ${{ vars.USE_SCCACHE == 'true' && 'sccache' || '' }}
CARGO_INCREMENTAL: 0
steps:
- uses: taiki-e/checkout-action@v1
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- '!crates/oxc_linter/**'
- uses: Boshen/setup-rust@main
if: steps.filter.outputs.src == 'true'
with:
cache-key: conformance
save-cache: ${{ github.ref_name == 'main' }}
tools: just
- uses: mozilla-actions/sccache-action@v0.0.5
- name: Clone submodules
if: steps.filter.outputs.src == 'true'
uses: ./.github/actions/clone-submodules
- name: Set up Bun
if: steps.filter.outputs.src == 'true'
uses: oven-sh/setup-bun@v2
- name: Install Node.js
if: steps.filter.outputs.src == 'true'
uses: actions/setup-node@v4
with:
node-version-file: .node-version
registry-url: 'https://registry.npmjs.org'
- name: Check Conformance
if: steps.filter.outputs.src == 'true'
run: |
just coverage
git diff --exit-code