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