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 build_visual_tests_binary:
539 needs:
540 - orchestrate
541 if: needs.orchestrate.outputs.run_tests == 'true'
542 runs-on: namespace-profile-mac-large
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::build_visual_tests_binary::cargo_build_visual_tests
558 run: cargo build -p zed --bin zed_visual_test_runner --features visual-tests
559 - name: steps::cleanup_cargo_config
560 if: always()
561 run: |
562 rm -rf ./../.cargo
563 check_wasm:
564 needs:
565 - orchestrate
566 if: needs.orchestrate.outputs.run_tests == 'true'
567 runs-on: namespace-profile-8x16-ubuntu-2204
568 steps:
569 - name: steps::checkout_repo
570 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
571 with:
572 clean: false
573 - name: steps::setup_cargo_config
574 run: |
575 mkdir -p ./../.cargo
576 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
577 - name: steps::cache_rust_dependencies_namespace
578 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
579 with:
580 cache: rust
581 path: ~/.rustup
582 - name: run_tests::check_wasm::install_nightly_wasm_toolchain
583 run: rustup toolchain install nightly --component rust-src --target wasm32-unknown-unknown
584 - name: steps::setup_sccache
585 run: ./script/setup-sccache
586 env:
587 R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
588 R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
589 R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
590 SCCACHE_BUCKET: sccache-zed
591 - name: run_tests::check_wasm::cargo_check_wasm
592 run: cargo +nightly -Zbuild-std=std,panic_abort check --target wasm32-unknown-unknown -p gpui_platform
593 env:
594 CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS: -C target-feature=+atomics,+bulk-memory,+mutable-globals
595 - name: steps::show_sccache_stats
596 run: sccache --show-stats || true
597 - name: steps::cleanup_cargo_config
598 if: always()
599 run: |
600 rm -rf ./../.cargo
601 timeout-minutes: 60
602 check_dependencies:
603 needs:
604 - orchestrate
605 if: needs.orchestrate.outputs.run_tests == 'true'
606 runs-on: namespace-profile-2x4-ubuntu-2404
607 env:
608 CC: clang
609 CXX: clang++
610 steps:
611 - name: steps::checkout_repo
612 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
613 with:
614 clean: false
615 - name: steps::cache_rust_dependencies_namespace
616 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
617 with:
618 cache: rust
619 path: ~/.rustup
620 - name: run_tests::check_dependencies::install_cargo_machete
621 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
622 with:
623 command: install
624 args: cargo-machete@0.7.0
625 - name: run_tests::check_dependencies::run_cargo_machete
626 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
627 with:
628 command: machete
629 - name: run_tests::check_dependencies::check_cargo_lock
630 run: cargo update --locked --workspace
631 - name: run_tests::check_dependencies::check_vulnerable_dependencies
632 if: github.event_name == 'pull_request'
633 uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8
634 with:
635 license-check: false
636 timeout-minutes: 60
637 check_docs:
638 needs:
639 - orchestrate
640 if: needs.orchestrate.outputs.run_docs == 'true'
641 runs-on: namespace-profile-8x16-ubuntu-2204
642 env:
643 CC: clang
644 CXX: clang++
645 steps:
646 - name: steps::checkout_repo
647 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
648 with:
649 clean: false
650 - name: steps::setup_cargo_config
651 run: |
652 mkdir -p ./../.cargo
653 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
654 - name: steps::cache_rust_dependencies_namespace
655 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
656 with:
657 cache: rust
658 path: ~/.rustup
659 - name: run_tests::check_docs::lychee_link_check
660 uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
661 with:
662 args: --no-progress --exclude '^http' './docs/src/**/*'
663 fail: true
664 jobSummary: false
665 - name: steps::setup_linux
666 run: ./script/linux
667 - name: steps::download_wasi_sdk
668 run: ./script/download-wasi-sdk
669 - name: ./script/generate-action-metadata
670 run: ./script/generate-action-metadata
671 - name: run_tests::check_docs::install_mdbook
672 uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08
673 with:
674 mdbook-version: 0.4.37
675 - name: run_tests::check_docs::build_docs
676 run: |
677 mkdir -p target/deploy
678 mdbook build ./docs --dest-dir=../target/deploy/docs/
679 - name: run_tests::check_docs::lychee_link_check
680 uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
681 with:
682 args: --no-progress --exclude '^http' 'target/deploy/docs'
683 fail: true
684 jobSummary: false
685 timeout-minutes: 60
686 check_licenses:
687 needs:
688 - orchestrate
689 if: needs.orchestrate.outputs.run_licenses == 'true'
690 runs-on: namespace-profile-2x4-ubuntu-2404
691 steps:
692 - name: steps::checkout_repo
693 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
694 with:
695 clean: false
696 - name: steps::cache_rust_dependencies_namespace
697 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
698 with:
699 cache: rust
700 path: ~/.rustup
701 - name: ./script/check-licenses
702 run: ./script/check-licenses
703 - name: ./script/generate-licenses
704 run: ./script/generate-licenses
705 check_scripts:
706 needs:
707 - orchestrate
708 if: needs.orchestrate.outputs.run_action_checks == 'true'
709 runs-on: namespace-profile-2x4-ubuntu-2404
710 steps:
711 - name: steps::checkout_repo
712 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
713 with:
714 clean: false
715 - name: run_tests::check_scripts::run_shellcheck
716 run: ./script/shellcheck-scripts error
717 - id: get_actionlint
718 name: run_tests::check_scripts::download_actionlint
719 run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
720 - name: run_tests::check_scripts::run_actionlint
721 run: '"$ACTIONLINT_BIN" -color'
722 env:
723 ACTIONLINT_BIN: ${{ steps.get_actionlint.outputs.executable }}
724 - name: steps::cache_rust_dependencies_namespace
725 uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
726 with:
727 cache: rust
728 path: ~/.rustup
729 - name: run_tests::check_scripts::check_xtask_workflows
730 run: |
731 cargo xtask workflows
732 if ! git diff --exit-code .github; then
733 echo "Error: .github directory has uncommitted changes after running 'cargo xtask workflows'"
734 echo "Please run 'cargo xtask workflows' locally and commit the changes"
735 exit 1
736 fi
737 timeout-minutes: 60
738 check_postgres_and_protobuf_migrations:
739 needs:
740 - orchestrate
741 if: needs.orchestrate.outputs.run_tests == 'true'
742 runs-on: namespace-profile-16x32-ubuntu-2204
743 env:
744 GIT_AUTHOR_NAME: Protobuf Action
745 GIT_AUTHOR_EMAIL: ci@zed.dev
746 GIT_COMMITTER_NAME: Protobuf Action
747 GIT_COMMITTER_EMAIL: ci@zed.dev
748 steps:
749 - name: steps::checkout_repo
750 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
751 with:
752 clean: false
753 fetch-depth: 0
754 - name: run_tests::check_postgres_and_protobuf_migrations::ensure_fresh_merge
755 run: |
756 if [ -z "$GITHUB_BASE_REF" ];
757 then
758 echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> "$GITHUB_ENV"
759 else
760 git checkout -B temp
761 git merge -q "origin/$GITHUB_BASE_REF" -m "merge main into temp"
762 echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> "$GITHUB_ENV"
763 fi
764 - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_setup_action
765 uses: bufbuild/buf-setup-action@v1
766 with:
767 version: v1.29.0
768 github_token: ${{ secrets.GITHUB_TOKEN }}
769 - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_breaking_action
770 uses: bufbuild/buf-breaking-action@v1
771 with:
772 input: crates/proto/proto/
773 against: https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/
774 - name: run_tests::check_postgres_and_protobuf_migrations::buf_lint
775 run: buf lint crates/proto/proto
776 - name: run_tests::check_postgres_and_protobuf_migrations::check_protobuf_formatting
777 run: buf format --diff --exit-code crates/proto/proto
778 timeout-minutes: 60
779 extension_tests:
780 needs:
781 - orchestrate
782 if: needs.orchestrate.outputs.changed_extensions != '[]'
783 permissions:
784 contents: read
785 strategy:
786 matrix:
787 extension: ${{ fromJson(needs.orchestrate.outputs.changed_extensions) }}
788 fail-fast: false
789 max-parallel: 1
790 uses: ./.github/workflows/extension_tests.yml
791 with:
792 working-directory: ${{ matrix.extension }}
793 tests_pass:
794 needs:
795 - orchestrate
796 - check_style
797 - clippy_windows
798 - clippy_linux
799 - clippy_mac
800 - clippy_mac_x86_64
801 - run_tests_windows
802 - run_tests_linux
803 - run_tests_mac
804 - doctests
805 - check_workspace_binaries
806 - build_visual_tests_binary
807 - check_wasm
808 - check_dependencies
809 - check_docs
810 - check_licenses
811 - check_scripts
812 - extension_tests
813 if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') && always()
814 runs-on: namespace-profile-2x4-ubuntu-2404
815 steps:
816 - name: run_tests::tests_pass
817 run: |
818 set +x
819 EXIT_CODE=0
820
821 check_result() {
822 echo "* $1: $2"
823 if [[ "$2" != "skipped" && "$2" != "success" ]]; then EXIT_CODE=1; fi
824 }
825
826 check_result "orchestrate" "$RESULT_ORCHESTRATE"
827 check_result "check_style" "$RESULT_CHECK_STYLE"
828 check_result "clippy_windows" "$RESULT_CLIPPY_WINDOWS"
829 check_result "clippy_linux" "$RESULT_CLIPPY_LINUX"
830 check_result "clippy_mac" "$RESULT_CLIPPY_MAC"
831 check_result "clippy_mac_x86_64" "$RESULT_CLIPPY_MAC_X86_64"
832 check_result "run_tests_windows" "$RESULT_RUN_TESTS_WINDOWS"
833 check_result "run_tests_linux" "$RESULT_RUN_TESTS_LINUX"
834 check_result "run_tests_mac" "$RESULT_RUN_TESTS_MAC"
835 check_result "doctests" "$RESULT_DOCTESTS"
836 check_result "check_workspace_binaries" "$RESULT_CHECK_WORKSPACE_BINARIES"
837 check_result "build_visual_tests_binary" "$RESULT_BUILD_VISUAL_TESTS_BINARY"
838 check_result "check_wasm" "$RESULT_CHECK_WASM"
839 check_result "check_dependencies" "$RESULT_CHECK_DEPENDENCIES"
840 check_result "check_docs" "$RESULT_CHECK_DOCS"
841 check_result "check_licenses" "$RESULT_CHECK_LICENSES"
842 check_result "check_scripts" "$RESULT_CHECK_SCRIPTS"
843 check_result "extension_tests" "$RESULT_EXTENSION_TESTS"
844
845 exit $EXIT_CODE
846 env:
847 RESULT_ORCHESTRATE: ${{ needs.orchestrate.result }}
848 RESULT_CHECK_STYLE: ${{ needs.check_style.result }}
849 RESULT_CLIPPY_WINDOWS: ${{ needs.clippy_windows.result }}
850 RESULT_CLIPPY_LINUX: ${{ needs.clippy_linux.result }}
851 RESULT_CLIPPY_MAC: ${{ needs.clippy_mac.result }}
852 RESULT_CLIPPY_MAC_X86_64: ${{ needs.clippy_mac_x86_64.result }}
853 RESULT_RUN_TESTS_WINDOWS: ${{ needs.run_tests_windows.result }}
854 RESULT_RUN_TESTS_LINUX: ${{ needs.run_tests_linux.result }}
855 RESULT_RUN_TESTS_MAC: ${{ needs.run_tests_mac.result }}
856 RESULT_DOCTESTS: ${{ needs.doctests.result }}
857 RESULT_CHECK_WORKSPACE_BINARIES: ${{ needs.check_workspace_binaries.result }}
858 RESULT_BUILD_VISUAL_TESTS_BINARY: ${{ needs.build_visual_tests_binary.result }}
859 RESULT_CHECK_WASM: ${{ needs.check_wasm.result }}
860 RESULT_CHECK_DEPENDENCIES: ${{ needs.check_dependencies.result }}
861 RESULT_CHECK_DOCS: ${{ needs.check_docs.result }}
862 RESULT_CHECK_LICENSES: ${{ needs.check_licenses.result }}
863 RESULT_CHECK_SCRIPTS: ${{ needs.check_scripts.result }}
864 RESULT_EXTENSION_TESTS: ${{ needs.extension_tests.result }}
865concurrency:
866 group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
867 cancel-in-progress: true
868defaults:
869 run:
870 shell: bash -euxo pipefail {0}