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