1# Generated from xtask::workflows::run_tests
2# Rebuild with `cargo xtask workflows`.
3name: run_tests
4env:
5 CARGO_TERM_COLOR: always
6 RUST_BACKTRACE: '1'
7 CARGO_INCREMENTAL: '0'
8on:
9 pull_request:
10 branches:
11 - '**'
12 push:
13 branches:
14 - main
15 - v[0-9]+.[0-9]+.x
16jobs:
17 orchestrate:
18 if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
19 runs-on: namespace-profile-2x4-ubuntu-2404
20 steps:
21 - name: steps::checkout_repo
22 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
23 with:
24 clean: false
25 fetch-depth: ${{ github.ref == 'refs/heads/main' && 2 || 350 }}
26 - id: filter
27 name: filter
28 run: |
29 set -euo pipefail
30 if [ -z "$GITHUB_BASE_REF" ]; then
31 echo "Not in a PR context (i.e., push to main/stable/preview)"
32 COMPARE_REV="$(git rev-parse HEAD~1)"
33 else
34 echo "In a PR context comparing to pull_request.base.ref"
35 git fetch origin "$GITHUB_BASE_REF" --depth=350
36 COMPARE_REV="$(git merge-base "origin/${GITHUB_BASE_REF}" HEAD)"
37 fi
38 CHANGED_FILES="$(git diff --name-only "$COMPARE_REV" "$GITHUB_SHA")"
39
40 check_pattern() {
41 local output_name="$1"
42 local pattern="$2"
43 local grep_arg="$3"
44
45 echo "$CHANGED_FILES" | grep "$grep_arg" "$pattern" && \
46 echo "${output_name}=true" >> "$GITHUB_OUTPUT" || \
47 echo "${output_name}=false" >> "$GITHUB_OUTPUT"
48 }
49
50 # Check for changes that require full rebuild (no filter)
51 # Direct pushes to main/stable/preview always run full suite
52 if [ -z "$GITHUB_BASE_REF" ]; then
53 echo "Not a PR, running full test suite"
54 echo "changed_packages=" >> "$GITHUB_OUTPUT"
55 elif echo "$CHANGED_FILES" | grep -qP '^(rust-toolchain\.toml|\.cargo/|\.github/|Cargo\.(toml|lock)$)'; then
56 echo "Toolchain, cargo config, or root Cargo files changed, will run all tests"
57 echo "changed_packages=" >> "$GITHUB_OUTPUT"
58 else
59 # Extract changed directories from file paths
60 CHANGED_DIRS=$(echo "$CHANGED_FILES" | \
61 grep -oP '^(crates|tooling)/\K[^/]+' | \
62 sort -u || true)
63
64 # Build directory-to-package mapping using cargo metadata
65 DIR_TO_PKG=$(cargo metadata --format-version=1 --no-deps 2>/dev/null | \
66 jq -r '.packages[] | select(.manifest_path | test("crates/|tooling/")) | "\(.manifest_path | capture("(crates|tooling)/(?<dir>[^/]+)") | .dir)=\(.name)"')
67
68 # Map directory names to package names
69 FILE_CHANGED_PKGS=""
70 for dir in $CHANGED_DIRS; do
71 pkg=$(echo "$DIR_TO_PKG" | grep "^${dir}=" | cut -d= -f2 | head -1)
72 if [ -n "$pkg" ]; then
73 FILE_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$pkg")
74 else
75 # Fall back to directory name if no mapping found
76 FILE_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$dir")
77 fi
78 done
79 FILE_CHANGED_PKGS=$(echo "$FILE_CHANGED_PKGS" | grep -v '^$' | sort -u || true)
80
81 # If assets/ changed, add crates that depend on those assets
82 if echo "$CHANGED_FILES" | grep -qP '^assets/'; then
83 FILE_CHANGED_PKGS=$(printf '%s\n%s\n%s\n%s' "$FILE_CHANGED_PKGS" "settings" "storybook" "assets" | sort -u)
84 fi
85
86 # Combine all changed packages
87 ALL_CHANGED_PKGS=$(echo "$FILE_CHANGED_PKGS" | grep -v '^$' || true)
88
89 if [ -z "$ALL_CHANGED_PKGS" ]; then
90 echo "No package changes detected, will run all tests"
91 echo "changed_packages=" >> "$GITHUB_OUTPUT"
92 else
93 # Build nextest filterset with rdeps for each package
94 FILTERSET=$(echo "$ALL_CHANGED_PKGS" | \
95 sed 's/.*/rdeps(&)/' | \
96 tr '\n' '|' | \
97 sed 's/|$//')
98 echo "Changed packages filterset: $FILTERSET"
99 echo "changed_packages=$FILTERSET" >> "$GITHUB_OUTPUT"
100 fi
101 fi
102
103 check_pattern "run_action_checks" '^\.github/(workflows/|actions/|actionlint.yml)|tooling/xtask|script/' -qP
104 check_pattern "run_docs" '^(docs/|crates/.*\.rs)' -qP
105 check_pattern "run_licenses" '^(Cargo.lock|script/.*licenses)' -qP
106 check_pattern "run_tests" '^(docs/|script/update_top_ranking_issues/|\.github/(ISSUE_TEMPLATE|workflows/(?!run_tests))|extensions/)' -qvP
107 # Detect changed extension directories (excluding extensions/workflows)
108 CHANGED_EXTENSIONS=$(echo "$CHANGED_FILES" | grep -oP '^extensions/[^/]+(?=/)' | sort -u | grep -v '^extensions/workflows$' || true)
109 # Filter out deleted extensions
110 EXISTING_EXTENSIONS=""
111 for ext in $CHANGED_EXTENSIONS; do
112 if [ -f "$ext/extension.toml" ]; then
113 EXISTING_EXTENSIONS=$(printf '%s\n%s' "$EXISTING_EXTENSIONS" "$ext")
114 fi
115 done
116 CHANGED_EXTENSIONS=$(echo "$EXISTING_EXTENSIONS" | sed '/^$/d')
117 if [ -n "$CHANGED_EXTENSIONS" ]; then
118 EXTENSIONS_JSON=$(echo "$CHANGED_EXTENSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
119 else
120 EXTENSIONS_JSON="[]"
121 fi
122 echo "changed_extensions=$EXTENSIONS_JSON" >> "$GITHUB_OUTPUT"
123 outputs:
124 changed_packages: ${{ steps.filter.outputs.changed_packages }}
125 run_action_checks: ${{ steps.filter.outputs.run_action_checks }}
126 run_docs: ${{ steps.filter.outputs.run_docs }}
127 run_licenses: ${{ steps.filter.outputs.run_licenses }}
128 run_tests: ${{ steps.filter.outputs.run_tests }}
129 changed_extensions: ${{ steps.filter.outputs.changed_extensions }}
130 check_style:
131 if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
132 runs-on: namespace-profile-4x8-ubuntu-2204
133 steps:
134 - name: steps::checkout_repo
135 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
136 with:
137 clean: false
138 - name: steps::cache_rust_dependencies_namespace
139 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
140 with:
141 cache: rust
142 path: ~/.rustup
143 - name: steps::setup_pnpm
144 uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
145 with:
146 version: '9'
147 - name: steps::prettier
148 run: ./script/prettier
149 - name: steps::cargo_fmt
150 run: cargo fmt --all -- --check
151 - name: ./script/check-todos
152 run: ./script/check-todos
153 - name: ./script/check-keymaps
154 run: ./script/check-keymaps
155 - name: run_tests::check_style::check_for_typos
156 uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06
157 with:
158 config: ./typos.toml
159 - name: run_tests::fetch_ts_query_ls
160 uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c
161 with:
162 repo: ribru17/ts_query_ls
163 version: tags/v3.15.1
164 file: ts_query_ls-x86_64-unknown-linux-gnu.tar.gz
165 - name: run_tests::run_ts_query_ls
166 run: |-
167 tar -xf "$GITHUB_WORKSPACE/ts_query_ls-x86_64-unknown-linux-gnu.tar.gz" -C "$GITHUB_WORKSPACE"
168 "$GITHUB_WORKSPACE/ts_query_ls" format --check . || {
169 echo "Found unformatted queries, please format them with ts_query_ls."
170 echo "For easy use, install the Tree-sitter query extension:"
171 echo "zed://extension/tree-sitter-query"
172 false
173 }
174 timeout-minutes: 60
175 clippy_windows:
176 needs:
177 - orchestrate
178 if: needs.orchestrate.outputs.run_tests == 'true'
179 runs-on: self-32vcpu-windows-2022
180 steps:
181 - name: steps::checkout_repo
182 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
183 with:
184 clean: false
185 - name: steps::setup_cargo_config
186 run: |
187 New-Item -ItemType Directory -Path "./../.cargo" -Force
188 Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
189 shell: pwsh
190 - name: steps::setup_sccache
191 run: ./script/setup-sccache.ps1
192 shell: pwsh
193 env:
194 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
195 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
196 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
197 SCCACHE_BUCKET: sccache-zed
198 - name: steps::clippy
199 run: ./script/clippy.ps1
200 shell: pwsh
201 - name: steps::show_sccache_stats
202 run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
203 shell: pwsh
204 timeout-minutes: 60
205 clippy_linux:
206 needs:
207 - orchestrate
208 if: needs.orchestrate.outputs.run_tests == 'true'
209 runs-on: namespace-profile-16x32-ubuntu-2204
210 env:
211 CC: clang
212 CXX: clang++
213 steps:
214 - name: steps::checkout_repo
215 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
216 with:
217 clean: false
218 - name: steps::setup_cargo_config
219 run: |
220 mkdir -p ./../.cargo
221 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
222 - name: steps::cache_rust_dependencies_namespace
223 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
224 with:
225 cache: rust
226 path: ~/.rustup
227 - name: steps::setup_linux
228 run: ./script/linux
229 - name: steps::download_wasi_sdk
230 run: ./script/download-wasi-sdk
231 - name: steps::setup_sccache
232 run: ./script/setup-sccache
233 env:
234 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
235 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
236 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
237 SCCACHE_BUCKET: sccache-zed
238 - name: steps::clippy
239 run: ./script/clippy
240 - name: steps::show_sccache_stats
241 run: sccache --show-stats || true
242 timeout-minutes: 60
243 clippy_mac:
244 needs:
245 - orchestrate
246 if: needs.orchestrate.outputs.run_tests == 'true'
247 runs-on: namespace-profile-mac-large
248 steps:
249 - name: steps::checkout_repo
250 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
251 with:
252 clean: false
253 - name: steps::setup_cargo_config
254 run: |
255 mkdir -p ./../.cargo
256 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
257 - name: steps::cache_rust_dependencies_namespace
258 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
259 with:
260 cache: rust
261 path: ~/.rustup
262 - name: steps::setup_sccache
263 run: ./script/setup-sccache
264 env:
265 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
266 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
267 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
268 SCCACHE_BUCKET: sccache-zed
269 - name: steps::clippy
270 run: ./script/clippy
271 - name: steps::show_sccache_stats
272 run: sccache --show-stats || true
273 timeout-minutes: 60
274 clippy_mac_x86_64:
275 needs:
276 - orchestrate
277 if: needs.orchestrate.outputs.run_tests == 'true'
278 runs-on: namespace-profile-mac-large
279 steps:
280 - name: steps::checkout_repo
281 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
282 with:
283 clean: false
284 - name: steps::setup_cargo_config
285 run: |
286 mkdir -p ./../.cargo
287 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
288 - name: steps::cache_rust_dependencies_namespace
289 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
290 with:
291 cache: rust
292 path: ~/.rustup
293 - name: steps::install_rustup_target
294 run: rustup target add x86_64-apple-darwin
295 - name: steps::setup_sccache
296 run: ./script/setup-sccache
297 env:
298 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
299 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
300 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
301 SCCACHE_BUCKET: sccache-zed
302 - name: steps::clippy
303 run: ./script/clippy --target x86_64-apple-darwin
304 - name: steps::show_sccache_stats
305 run: sccache --show-stats || true
306 timeout-minutes: 60
307 run_tests_windows:
308 needs:
309 - orchestrate
310 if: needs.orchestrate.outputs.run_tests == 'true'
311 runs-on: self-32vcpu-windows-2022
312 steps:
313 - name: steps::checkout_repo
314 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
315 with:
316 clean: false
317 - name: steps::setup_cargo_config
318 run: |
319 New-Item -ItemType Directory -Path "./../.cargo" -Force
320 Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
321 shell: pwsh
322 - name: steps::setup_node
323 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
324 with:
325 node-version: '20'
326 - name: steps::clear_target_dir_if_large
327 run: ./script/clear-target-dir-if-larger-than.ps1 250
328 shell: pwsh
329 - name: steps::setup_sccache
330 run: ./script/setup-sccache.ps1
331 shell: pwsh
332 env:
333 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
334 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
335 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
336 SCCACHE_BUCKET: sccache-zed
337 - name: steps::cargo_nextest
338 run: cargo nextest run --workspace --no-fail-fast --no-tests=warn${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
339 shell: pwsh
340 - name: steps::show_sccache_stats
341 run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
342 shell: pwsh
343 - name: steps::cleanup_cargo_config
344 if: always()
345 run: |
346 Remove-Item -Recurse -Path "./../.cargo" -Force -ErrorAction SilentlyContinue
347 shell: pwsh
348 timeout-minutes: 60
349 run_tests_linux:
350 needs:
351 - orchestrate
352 if: needs.orchestrate.outputs.run_tests == 'true'
353 runs-on: namespace-profile-16x32-ubuntu-2204
354 env:
355 CC: clang
356 CXX: clang++
357 steps:
358 - name: steps::checkout_repo
359 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
360 with:
361 clean: false
362 - name: steps::setup_cargo_config
363 run: |
364 mkdir -p ./../.cargo
365 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
366 - name: steps::cache_rust_dependencies_namespace
367 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
368 with:
369 cache: rust
370 path: ~/.rustup
371 - name: steps::setup_linux
372 run: ./script/linux
373 - name: steps::download_wasi_sdk
374 run: ./script/download-wasi-sdk
375 - name: steps::setup_node
376 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
377 with:
378 node-version: '20'
379 - name: steps::cargo_install_nextest
380 uses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c
381 - name: steps::clear_target_dir_if_large
382 run: ./script/clear-target-dir-if-larger-than 250
383 - name: steps::setup_sccache
384 run: ./script/setup-sccache
385 env:
386 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
387 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
388 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
389 SCCACHE_BUCKET: sccache-zed
390 - name: steps::cargo_nextest
391 run: cargo nextest run --workspace --no-fail-fast --no-tests=warn${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
392 - name: steps::show_sccache_stats
393 run: sccache --show-stats || true
394 - name: steps::cleanup_cargo_config
395 if: always()
396 run: |
397 rm -rf ./../.cargo
398 timeout-minutes: 60
399 services:
400 postgres:
401 image: postgres:15
402 env:
403 POSTGRES_HOST_AUTH_METHOD: trust
404 ports:
405 - 5432:5432
406 options: --health-cmd pg_isready --health-interval 500ms --health-timeout 5s --health-retries 10
407 run_tests_mac:
408 needs:
409 - orchestrate
410 if: needs.orchestrate.outputs.run_tests == 'true'
411 runs-on: namespace-profile-mac-large
412 steps:
413 - name: steps::checkout_repo
414 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
415 with:
416 clean: false
417 - name: steps::setup_cargo_config
418 run: |
419 mkdir -p ./../.cargo
420 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
421 - name: steps::cache_rust_dependencies_namespace
422 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
423 with:
424 cache: rust
425 path: ~/.rustup
426 - name: steps::setup_node
427 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
428 with:
429 node-version: '20'
430 - name: steps::cargo_install_nextest
431 uses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c
432 - name: steps::clear_target_dir_if_large
433 run: ./script/clear-target-dir-if-larger-than 300
434 - name: steps::setup_sccache
435 run: ./script/setup-sccache
436 env:
437 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
438 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
439 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
440 SCCACHE_BUCKET: sccache-zed
441 - name: steps::cargo_nextest
442 run: cargo nextest run --workspace --no-fail-fast --no-tests=warn${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
443 - name: steps::show_sccache_stats
444 run: sccache --show-stats || true
445 - name: steps::cleanup_cargo_config
446 if: always()
447 run: |
448 rm -rf ./../.cargo
449 timeout-minutes: 60
450 doctests:
451 needs:
452 - orchestrate
453 if: needs.orchestrate.outputs.run_tests == 'true'
454 runs-on: namespace-profile-16x32-ubuntu-2204
455 env:
456 CC: clang
457 CXX: clang++
458 steps:
459 - name: steps::checkout_repo
460 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
461 with:
462 clean: false
463 - name: steps::cache_rust_dependencies_namespace
464 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
465 with:
466 cache: rust
467 path: ~/.rustup
468 - name: steps::setup_linux
469 run: ./script/linux
470 - name: steps::download_wasi_sdk
471 run: ./script/download-wasi-sdk
472 - name: steps::setup_cargo_config
473 run: |
474 mkdir -p ./../.cargo
475 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
476 - name: steps::setup_sccache
477 run: ./script/setup-sccache
478 env:
479 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
480 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
481 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
482 SCCACHE_BUCKET: sccache-zed
483 - id: run_doctests
484 name: run_tests::doctests::run_doctests
485 run: |
486 cargo test --workspace --doc --no-fail-fast
487 - name: steps::show_sccache_stats
488 run: sccache --show-stats || true
489 - name: steps::cleanup_cargo_config
490 if: always()
491 run: |
492 rm -rf ./../.cargo
493 timeout-minutes: 60
494 check_workspace_binaries:
495 needs:
496 - orchestrate
497 if: needs.orchestrate.outputs.run_tests == 'true'
498 runs-on: namespace-profile-8x16-ubuntu-2204
499 env:
500 CC: clang
501 CXX: clang++
502 steps:
503 - name: steps::checkout_repo
504 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
505 with:
506 clean: false
507 - name: steps::setup_cargo_config
508 run: |
509 mkdir -p ./../.cargo
510 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
511 - name: steps::cache_rust_dependencies_namespace
512 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
513 with:
514 cache: rust
515 path: ~/.rustup
516 - name: steps::setup_linux
517 run: ./script/linux
518 - name: steps::download_wasi_sdk
519 run: ./script/download-wasi-sdk
520 - name: steps::setup_sccache
521 run: ./script/setup-sccache
522 env:
523 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
524 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
525 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
526 SCCACHE_BUCKET: sccache-zed
527 - name: cargo build -p collab
528 run: cargo build -p collab
529 - name: cargo build --workspace --bins --examples
530 run: cargo build --workspace --bins --examples
531 - name: steps::show_sccache_stats
532 run: sccache --show-stats || true
533 - name: steps::cleanup_cargo_config
534 if: always()
535 run: |
536 rm -rf ./../.cargo
537 timeout-minutes: 60
538 check_wasm:
539 needs:
540 - orchestrate
541 if: needs.orchestrate.outputs.run_tests == 'true'
542 runs-on: namespace-profile-8x16-ubuntu-2204
543 steps:
544 - name: steps::checkout_repo
545 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
546 with:
547 clean: false
548 - name: steps::setup_cargo_config
549 run: |
550 mkdir -p ./../.cargo
551 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
552 - name: steps::cache_rust_dependencies_namespace
553 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
554 with:
555 cache: rust
556 path: ~/.rustup
557 - name: run_tests::check_wasm::install_nightly_wasm_toolchain
558 run: rustup toolchain install nightly --component rust-src --target wasm32-unknown-unknown
559 - name: steps::setup_sccache
560 run: ./script/setup-sccache
561 env:
562 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
563 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
564 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
565 SCCACHE_BUCKET: sccache-zed
566 - name: run_tests::check_wasm::cargo_check_wasm
567 run: cargo +nightly -Zbuild-std=std,panic_abort check --target wasm32-unknown-unknown -p gpui_platform
568 env:
569 CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS: -C target-feature=+atomics,+bulk-memory,+mutable-globals
570 - name: steps::show_sccache_stats
571 run: sccache --show-stats || true
572 - name: steps::cleanup_cargo_config
573 if: always()
574 run: |
575 rm -rf ./../.cargo
576 timeout-minutes: 60
577 check_dependencies:
578 needs:
579 - orchestrate
580 if: needs.orchestrate.outputs.run_tests == 'true'
581 runs-on: namespace-profile-2x4-ubuntu-2404
582 env:
583 CC: clang
584 CXX: clang++
585 steps:
586 - name: steps::checkout_repo
587 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
588 with:
589 clean: false
590 - name: steps::cache_rust_dependencies_namespace
591 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
592 with:
593 cache: rust
594 path: ~/.rustup
595 - name: run_tests::check_dependencies::install_cargo_machete
596 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
597 with:
598 command: install
599 args: cargo-machete@0.7.0
600 - name: run_tests::check_dependencies::run_cargo_machete
601 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
602 with:
603 command: machete
604 - name: run_tests::check_dependencies::check_cargo_lock
605 run: cargo update --locked --workspace
606 - name: run_tests::check_dependencies::check_vulnerable_dependencies
607 if: github.event_name == 'pull_request'
608 uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8
609 with:
610 license-check: false
611 timeout-minutes: 60
612 check_docs:
613 needs:
614 - orchestrate
615 if: needs.orchestrate.outputs.run_docs == 'true'
616 runs-on: namespace-profile-8x16-ubuntu-2204
617 env:
618 CC: clang
619 CXX: clang++
620 steps:
621 - name: steps::checkout_repo
622 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
623 with:
624 clean: false
625 - name: steps::setup_cargo_config
626 run: |
627 mkdir -p ./../.cargo
628 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
629 - name: steps::cache_rust_dependencies_namespace
630 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
631 with:
632 cache: rust
633 path: ~/.rustup
634 - name: run_tests::check_docs::lychee_link_check
635 uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
636 with:
637 args: --no-progress --exclude '^http' './docs/src/**/*'
638 fail: true
639 jobSummary: false
640 - name: steps::setup_linux
641 run: ./script/linux
642 - name: steps::download_wasi_sdk
643 run: ./script/download-wasi-sdk
644 - name: ./script/generate-action-metadata
645 run: ./script/generate-action-metadata
646 - name: run_tests::check_docs::install_mdbook
647 uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08
648 with:
649 mdbook-version: 0.4.37
650 - name: run_tests::check_docs::build_docs
651 run: |
652 mkdir -p target/deploy
653 mdbook build ./docs --dest-dir=../target/deploy/docs/
654 - name: run_tests::check_docs::lychee_link_check
655 uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
656 with:
657 args: --no-progress --exclude '^http' 'target/deploy/docs'
658 fail: true
659 jobSummary: false
660 timeout-minutes: 60
661 check_licenses:
662 needs:
663 - orchestrate
664 if: needs.orchestrate.outputs.run_licenses == 'true'
665 runs-on: namespace-profile-2x4-ubuntu-2404
666 steps:
667 - name: steps::checkout_repo
668 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
669 with:
670 clean: false
671 - name: steps::cache_rust_dependencies_namespace
672 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
673 with:
674 cache: rust
675 path: ~/.rustup
676 - name: ./script/check-licenses
677 run: ./script/check-licenses
678 - name: ./script/generate-licenses
679 run: ./script/generate-licenses
680 check_scripts:
681 needs:
682 - orchestrate
683 if: needs.orchestrate.outputs.run_action_checks == 'true'
684 runs-on: namespace-profile-2x4-ubuntu-2404
685 steps:
686 - name: steps::checkout_repo
687 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
688 with:
689 clean: false
690 - name: run_tests::check_scripts::run_shellcheck
691 run: ./script/shellcheck-scripts error
692 - id: get_actionlint
693 name: run_tests::check_scripts::download_actionlint
694 run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
695 - name: run_tests::check_scripts::run_actionlint
696 run: '"$ACTIONLINT_BIN" -color'
697 env:
698 ACTIONLINT_BIN: ${{ steps.get_actionlint.outputs.executable }}
699 - name: steps::cache_rust_dependencies_namespace
700 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
701 with:
702 cache: rust
703 path: ~/.rustup
704 - name: run_tests::check_scripts::check_xtask_workflows
705 run: |
706 cargo xtask workflows
707 if ! git diff --exit-code .github; then
708 echo "Error: .github directory has uncommitted changes after running 'cargo xtask workflows'"
709 echo "Please run 'cargo xtask workflows' locally and commit the changes"
710 exit 1
711 fi
712 timeout-minutes: 60
713 check_postgres_and_protobuf_migrations:
714 needs:
715 - orchestrate
716 if: needs.orchestrate.outputs.run_tests == 'true'
717 runs-on: namespace-profile-16x32-ubuntu-2204
718 env:
719 GIT_AUTHOR_NAME: Protobuf Action
720 GIT_AUTHOR_EMAIL: ci@zed.dev
721 GIT_COMMITTER_NAME: Protobuf Action
722 GIT_COMMITTER_EMAIL: ci@zed.dev
723 steps:
724 - name: steps::checkout_repo
725 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
726 with:
727 clean: false
728 fetch-depth: 0
729 - name: run_tests::check_postgres_and_protobuf_migrations::ensure_fresh_merge
730 run: |
731 if [ -z "$GITHUB_BASE_REF" ];
732 then
733 echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> "$GITHUB_ENV"
734 else
735 git checkout -B temp
736 git merge -q "origin/$GITHUB_BASE_REF" -m "merge main into temp"
737 echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> "$GITHUB_ENV"
738 fi
739 - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_setup_action
740 uses: bufbuild/buf-setup-action@v1
741 with:
742 version: v1.29.0
743 github_token: ${{ secrets.GITHUB_TOKEN }}
744 - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_breaking_action
745 uses: bufbuild/buf-breaking-action@v1
746 with:
747 input: crates/proto/proto/
748 against: https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/
749 - name: run_tests::check_postgres_and_protobuf_migrations::buf_lint
750 run: buf lint crates/proto/proto
751 - name: run_tests::check_postgres_and_protobuf_migrations::check_protobuf_formatting
752 run: buf format --diff --exit-code crates/proto/proto
753 timeout-minutes: 60
754 extension_tests:
755 needs:
756 - orchestrate
757 if: needs.orchestrate.outputs.changed_extensions != '[]'
758 permissions:
759 contents: read
760 strategy:
761 matrix:
762 extension: ${{ fromJson(needs.orchestrate.outputs.changed_extensions) }}
763 fail-fast: false
764 max-parallel: 1
765 uses: ./.github/workflows/extension_tests.yml
766 with:
767 working-directory: ${{ matrix.extension }}
768 tests_pass:
769 needs:
770 - orchestrate
771 - check_style
772 - clippy_windows
773 - clippy_linux
774 - clippy_mac
775 - clippy_mac_x86_64
776 - run_tests_windows
777 - run_tests_linux
778 - run_tests_mac
779 - doctests
780 - check_workspace_binaries
781 - check_wasm
782 - check_dependencies
783 - check_docs
784 - check_licenses
785 - check_scripts
786 - extension_tests
787 if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') && always()
788 runs-on: namespace-profile-2x4-ubuntu-2404
789 steps:
790 - name: run_tests::tests_pass
791 run: |
792 set +x
793 EXIT_CODE=0
794
795 check_result() {
796 echo "* $1: $2"
797 if [[ "$2" != "skipped" && "$2" != "success" ]]; then EXIT_CODE=1; fi
798 }
799
800 check_result "orchestrate" "$RESULT_ORCHESTRATE"
801 check_result "check_style" "$RESULT_CHECK_STYLE"
802 check_result "clippy_windows" "$RESULT_CLIPPY_WINDOWS"
803 check_result "clippy_linux" "$RESULT_CLIPPY_LINUX"
804 check_result "clippy_mac" "$RESULT_CLIPPY_MAC"
805 check_result "clippy_mac_x86_64" "$RESULT_CLIPPY_MAC_X86_64"
806 check_result "run_tests_windows" "$RESULT_RUN_TESTS_WINDOWS"
807 check_result "run_tests_linux" "$RESULT_RUN_TESTS_LINUX"
808 check_result "run_tests_mac" "$RESULT_RUN_TESTS_MAC"
809 check_result "doctests" "$RESULT_DOCTESTS"
810 check_result "check_workspace_binaries" "$RESULT_CHECK_WORKSPACE_BINARIES"
811 check_result "check_wasm" "$RESULT_CHECK_WASM"
812 check_result "check_dependencies" "$RESULT_CHECK_DEPENDENCIES"
813 check_result "check_docs" "$RESULT_CHECK_DOCS"
814 check_result "check_licenses" "$RESULT_CHECK_LICENSES"
815 check_result "check_scripts" "$RESULT_CHECK_SCRIPTS"
816 check_result "extension_tests" "$RESULT_EXTENSION_TESTS"
817
818 exit $EXIT_CODE
819 env:
820 RESULT_ORCHESTRATE: ${{ needs.orchestrate.result }}
821 RESULT_CHECK_STYLE: ${{ needs.check_style.result }}
822 RESULT_CLIPPY_WINDOWS: ${{ needs.clippy_windows.result }}
823 RESULT_CLIPPY_LINUX: ${{ needs.clippy_linux.result }}
824 RESULT_CLIPPY_MAC: ${{ needs.clippy_mac.result }}
825 RESULT_CLIPPY_MAC_X86_64: ${{ needs.clippy_mac_x86_64.result }}
826 RESULT_RUN_TESTS_WINDOWS: ${{ needs.run_tests_windows.result }}
827 RESULT_RUN_TESTS_LINUX: ${{ needs.run_tests_linux.result }}
828 RESULT_RUN_TESTS_MAC: ${{ needs.run_tests_mac.result }}
829 RESULT_DOCTESTS: ${{ needs.doctests.result }}
830 RESULT_CHECK_WORKSPACE_BINARIES: ${{ needs.check_workspace_binaries.result }}
831 RESULT_CHECK_WASM: ${{ needs.check_wasm.result }}
832 RESULT_CHECK_DEPENDENCIES: ${{ needs.check_dependencies.result }}
833 RESULT_CHECK_DOCS: ${{ needs.check_docs.result }}
834 RESULT_CHECK_LICENSES: ${{ needs.check_licenses.result }}
835 RESULT_CHECK_SCRIPTS: ${{ needs.check_scripts.result }}
836 RESULT_EXTENSION_TESTS: ${{ needs.extension_tests.result }}
837concurrency:
838 group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
839 cancel-in-progress: true
840defaults:
841 run:
842 shell: bash -euxo pipefail {0}