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'
19 runs-on: namespace-profile-2x4-ubuntu-2404
20 steps:
21 - name: steps::checkout_repo
22 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
23 with:
24 clean: false
25 fetch-depth: ${{ github.ref == 'refs/heads/main' && 2 || 350 }}
26 - id: filter
27 name: filter
28 run: |
29 if [ -z "$GITHUB_BASE_REF" ]; then
30 echo "Not in a PR context (i.e., push to main/stable/preview)"
31 COMPARE_REV="$(git rev-parse HEAD~1)"
32 else
33 echo "In a PR context comparing to pull_request.base.ref"
34 git fetch origin "$GITHUB_BASE_REF" --depth=350
35 COMPARE_REV="$(git merge-base "origin/${GITHUB_BASE_REF}" HEAD)"
36 fi
37 CHANGED_FILES="$(git diff --name-only "$COMPARE_REV" ${{ github.sha }})"
38
39 check_pattern() {
40 local output_name="$1"
41 local pattern="$2"
42 local grep_arg="$3"
43
44 echo "$CHANGED_FILES" | grep "$grep_arg" "$pattern" && \
45 echo "${output_name}=true" >> "$GITHUB_OUTPUT" || \
46 echo "${output_name}=false" >> "$GITHUB_OUTPUT"
47 }
48
49 check_pattern "run_action_checks" '^\.github/(workflows/|actions/|actionlint.yml)|tooling/xtask|script/' -qP
50 check_pattern "run_docs" '^docs/' -qP
51 check_pattern "run_licenses" '^(Cargo.lock|script/.*licenses)' -qP
52 check_pattern "run_nix" '^(nix/|flake\.|Cargo\.|rust-toolchain.toml|\.cargo/config.toml)' -qP
53 check_pattern "run_tests" '^(docs/|script/update_top_ranking_issues/|\.github/(ISSUE_TEMPLATE|workflows/(?!run_tests)))' -qvP
54 shell: bash -euxo pipefail {0}
55 outputs:
56 run_action_checks: ${{ steps.filter.outputs.run_action_checks }}
57 run_docs: ${{ steps.filter.outputs.run_docs }}
58 run_licenses: ${{ steps.filter.outputs.run_licenses }}
59 run_nix: ${{ steps.filter.outputs.run_nix }}
60 run_tests: ${{ steps.filter.outputs.run_tests }}
61 check_style:
62 if: github.repository_owner == 'zed-industries'
63 runs-on: namespace-profile-4x8-ubuntu-2204
64 steps:
65 - name: steps::checkout_repo
66 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
67 with:
68 clean: false
69 - name: steps::cache_rust_dependencies_namespace
70 uses: namespacelabs/nscloud-cache-action@v1
71 with:
72 cache: rust
73 - name: steps::setup_pnpm
74 uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
75 with:
76 version: '9'
77 - name: ./script/prettier
78 run: ./script/prettier
79 shell: bash -euxo pipefail {0}
80 - name: ./script/check-todos
81 run: ./script/check-todos
82 shell: bash -euxo pipefail {0}
83 - name: ./script/check-keymaps
84 run: ./script/check-keymaps
85 shell: bash -euxo pipefail {0}
86 - name: run_tests::check_style::check_for_typos
87 uses: crate-ci/typos@80c8a4945eec0f6d464eaf9e65ed98ef085283d1
88 with:
89 config: ./typos.toml
90 - name: steps::cargo_fmt
91 run: cargo fmt --all -- --check
92 shell: bash -euxo pipefail {0}
93 timeout-minutes: 60
94 run_tests_windows:
95 needs:
96 - orchestrate
97 if: needs.orchestrate.outputs.run_tests == 'true'
98 runs-on: self-32vcpu-windows-2022
99 steps:
100 - name: steps::checkout_repo
101 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
102 with:
103 clean: false
104 - name: steps::setup_cargo_config
105 run: |
106 New-Item -ItemType Directory -Path "./../.cargo" -Force
107 Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
108 shell: pwsh
109 - name: steps::setup_node
110 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
111 with:
112 node-version: '20'
113 - name: steps::clippy
114 run: ./script/clippy.ps1
115 shell: pwsh
116 - name: steps::cargo_install_nextest
117 run: cargo install cargo-nextest --locked
118 shell: pwsh
119 - name: steps::clear_target_dir_if_large
120 run: ./script/clear-target-dir-if-larger-than.ps1 250
121 shell: pwsh
122 - name: steps::cargo_nextest
123 run: cargo nextest run --workspace --no-fail-fast --failure-output immediate-final
124 shell: pwsh
125 - name: steps::cleanup_cargo_config
126 if: always()
127 run: |
128 Remove-Item -Recurse -Path "./../.cargo" -Force -ErrorAction SilentlyContinue
129 shell: pwsh
130 timeout-minutes: 60
131 run_tests_linux:
132 needs:
133 - orchestrate
134 if: needs.orchestrate.outputs.run_tests == 'true'
135 runs-on: namespace-profile-16x32-ubuntu-2204
136 steps:
137 - name: steps::checkout_repo
138 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
139 with:
140 clean: false
141 - name: steps::setup_cargo_config
142 run: |
143 mkdir -p ./../.cargo
144 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
145 shell: bash -euxo pipefail {0}
146 - name: steps::setup_linux
147 run: ./script/linux
148 shell: bash -euxo pipefail {0}
149 - name: steps::install_mold
150 run: ./script/install-mold
151 shell: bash -euxo pipefail {0}
152 - name: steps::cache_rust_dependencies_namespace
153 uses: namespacelabs/nscloud-cache-action@v1
154 with:
155 cache: rust
156 - name: steps::setup_node
157 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
158 with:
159 node-version: '20'
160 - name: steps::clippy
161 run: ./script/clippy
162 shell: bash -euxo pipefail {0}
163 - name: steps::cargo_install_nextest
164 run: cargo install cargo-nextest --locked
165 shell: bash -euxo pipefail {0}
166 - name: steps::clear_target_dir_if_large
167 run: ./script/clear-target-dir-if-larger-than 250
168 shell: bash -euxo pipefail {0}
169 - name: steps::cargo_nextest
170 run: cargo nextest run --workspace --no-fail-fast --failure-output immediate-final
171 shell: bash -euxo pipefail {0}
172 - name: steps::cleanup_cargo_config
173 if: always()
174 run: |
175 rm -rf ./../.cargo
176 shell: bash -euxo pipefail {0}
177 timeout-minutes: 60
178 run_tests_mac:
179 needs:
180 - orchestrate
181 if: needs.orchestrate.outputs.run_tests == 'true'
182 runs-on: self-mini-macos
183 steps:
184 - name: steps::checkout_repo
185 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
186 with:
187 clean: false
188 - name: steps::setup_cargo_config
189 run: |
190 mkdir -p ./../.cargo
191 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
192 shell: bash -euxo pipefail {0}
193 - name: steps::setup_node
194 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
195 with:
196 node-version: '20'
197 - name: steps::clippy
198 run: ./script/clippy
199 shell: bash -euxo pipefail {0}
200 - name: steps::cargo_install_nextest
201 run: cargo install cargo-nextest --locked
202 shell: bash -euxo pipefail {0}
203 - name: steps::clear_target_dir_if_large
204 run: ./script/clear-target-dir-if-larger-than 300
205 shell: bash -euxo pipefail {0}
206 - name: steps::cargo_nextest
207 run: cargo nextest run --workspace --no-fail-fast --failure-output immediate-final
208 shell: bash -euxo pipefail {0}
209 - name: steps::cleanup_cargo_config
210 if: always()
211 run: |
212 rm -rf ./../.cargo
213 shell: bash -euxo pipefail {0}
214 timeout-minutes: 60
215 doctests:
216 needs:
217 - orchestrate
218 if: needs.orchestrate.outputs.run_tests == 'true'
219 runs-on: namespace-profile-16x32-ubuntu-2204
220 steps:
221 - name: steps::checkout_repo
222 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
223 with:
224 clean: false
225 - name: steps::cache_rust_dependencies_namespace
226 uses: namespacelabs/nscloud-cache-action@v1
227 with:
228 cache: rust
229 - name: steps::setup_linux
230 run: ./script/linux
231 shell: bash -euxo pipefail {0}
232 - name: steps::install_mold
233 run: ./script/install-mold
234 shell: bash -euxo pipefail {0}
235 - name: steps::setup_cargo_config
236 run: |
237 mkdir -p ./../.cargo
238 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
239 shell: bash -euxo pipefail {0}
240 - id: run_doctests
241 name: run_tests::doctests::run_doctests
242 run: |
243 cargo test --workspace --doc --no-fail-fast
244 shell: bash -euxo pipefail {0}
245 - name: steps::cleanup_cargo_config
246 if: always()
247 run: |
248 rm -rf ./../.cargo
249 shell: bash -euxo pipefail {0}
250 timeout-minutes: 60
251 check_workspace_binaries:
252 needs:
253 - orchestrate
254 if: needs.orchestrate.outputs.run_tests == 'true'
255 runs-on: namespace-profile-8x16-ubuntu-2204
256 steps:
257 - name: steps::checkout_repo
258 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
259 with:
260 clean: false
261 - name: steps::setup_cargo_config
262 run: |
263 mkdir -p ./../.cargo
264 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
265 shell: bash -euxo pipefail {0}
266 - name: steps::setup_linux
267 run: ./script/linux
268 shell: bash -euxo pipefail {0}
269 - name: steps::install_mold
270 run: ./script/install-mold
271 shell: bash -euxo pipefail {0}
272 - name: steps::cache_rust_dependencies_namespace
273 uses: namespacelabs/nscloud-cache-action@v1
274 with:
275 cache: rust
276 - name: cargo build -p collab
277 run: cargo build -p collab
278 shell: bash -euxo pipefail {0}
279 - name: cargo build --workspace --bins --examples
280 run: cargo build --workspace --bins --examples
281 shell: bash -euxo pipefail {0}
282 - name: steps::cleanup_cargo_config
283 if: always()
284 run: |
285 rm -rf ./../.cargo
286 shell: bash -euxo pipefail {0}
287 timeout-minutes: 60
288 check_dependencies:
289 needs:
290 - orchestrate
291 if: needs.orchestrate.outputs.run_tests == 'true'
292 runs-on: namespace-profile-2x4-ubuntu-2404
293 steps:
294 - name: steps::checkout_repo
295 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
296 with:
297 clean: false
298 - name: steps::cache_rust_dependencies_namespace
299 uses: namespacelabs/nscloud-cache-action@v1
300 with:
301 cache: rust
302 - name: run_tests::check_dependencies::install_cargo_machete
303 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
304 with:
305 command: install
306 args: cargo-machete@0.7.0
307 - name: run_tests::check_dependencies::run_cargo_machete
308 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
309 with:
310 command: machete
311 - name: run_tests::check_dependencies::check_cargo_lock
312 run: cargo update --locked --workspace
313 shell: bash -euxo pipefail {0}
314 - name: run_tests::check_dependencies::check_vulnerable_dependencies
315 if: github.event_name == 'pull_request'
316 uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8
317 with:
318 license-check: false
319 timeout-minutes: 60
320 check_docs:
321 needs:
322 - orchestrate
323 if: needs.orchestrate.outputs.run_docs == 'true'
324 runs-on: namespace-profile-8x16-ubuntu-2204
325 steps:
326 - name: steps::checkout_repo
327 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
328 with:
329 clean: false
330 - name: steps::setup_cargo_config
331 run: |
332 mkdir -p ./../.cargo
333 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
334 shell: bash -euxo pipefail {0}
335 - name: steps::cache_rust_dependencies_namespace
336 uses: namespacelabs/nscloud-cache-action@v1
337 with:
338 cache: rust
339 - name: run_tests::check_docs::lychee_link_check
340 uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
341 with:
342 args: --no-progress --exclude '^http' './docs/src/**/*'
343 fail: true
344 jobSummary: false
345 - name: steps::setup_linux
346 run: ./script/linux
347 shell: bash -euxo pipefail {0}
348 - name: steps::install_mold
349 run: ./script/install-mold
350 shell: bash -euxo pipefail {0}
351 - name: run_tests::check_docs::install_mdbook
352 uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08
353 with:
354 mdbook-version: 0.4.37
355 - name: run_tests::check_docs::build_docs
356 run: |
357 mkdir -p target/deploy
358 mdbook build ./docs --dest-dir=../target/deploy/docs/
359 shell: bash -euxo pipefail {0}
360 - name: run_tests::check_docs::lychee_link_check
361 uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
362 with:
363 args: --no-progress --exclude '^http' 'target/deploy/docs'
364 fail: true
365 jobSummary: false
366 timeout-minutes: 60
367 check_licenses:
368 needs:
369 - orchestrate
370 if: needs.orchestrate.outputs.run_licenses == 'true'
371 runs-on: namespace-profile-2x4-ubuntu-2404
372 steps:
373 - name: steps::checkout_repo
374 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
375 with:
376 clean: false
377 - name: steps::cache_rust_dependencies_namespace
378 uses: namespacelabs/nscloud-cache-action@v1
379 with:
380 cache: rust
381 - name: ./script/check-licenses
382 run: ./script/check-licenses
383 shell: bash -euxo pipefail {0}
384 - name: ./script/generate-licenses
385 run: ./script/generate-licenses
386 shell: bash -euxo pipefail {0}
387 check_scripts:
388 needs:
389 - orchestrate
390 if: needs.orchestrate.outputs.run_action_checks == 'true'
391 runs-on: namespace-profile-2x4-ubuntu-2404
392 steps:
393 - name: steps::checkout_repo
394 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
395 with:
396 clean: false
397 - name: run_tests::check_scripts::run_shellcheck
398 run: ./script/shellcheck-scripts error
399 shell: bash -euxo pipefail {0}
400 - id: get_actionlint
401 name: run_tests::check_scripts::download_actionlint
402 run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
403 shell: bash -euxo pipefail {0}
404 - name: run_tests::check_scripts::run_actionlint
405 run: |
406 ${{ steps.get_actionlint.outputs.executable }} -color
407 shell: bash -euxo pipefail {0}
408 - name: run_tests::check_scripts::check_xtask_workflows
409 run: |
410 cargo xtask workflows
411 if ! git diff --exit-code .github; then
412 echo "Error: .github directory has uncommitted changes after running 'cargo xtask workflows'"
413 echo "Please run 'cargo xtask workflows' locally and commit the changes"
414 exit 1
415 fi
416 shell: bash -euxo pipefail {0}
417 timeout-minutes: 60
418 build_nix_linux_x86_64:
419 needs:
420 - orchestrate
421 if: needs.orchestrate.outputs.run_nix == 'true'
422 runs-on: namespace-profile-32x64-ubuntu-2004
423 env:
424 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
425 ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }}
426 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
427 GIT_LFS_SKIP_SMUDGE: '1'
428 steps:
429 - name: steps::checkout_repo
430 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
431 with:
432 clean: false
433 - name: nix_build::build_nix::install_nix
434 uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f
435 with:
436 github_access_token: ${{ secrets.GITHUB_TOKEN }}
437 - name: nix_build::build_nix::cachix_action
438 uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad
439 with:
440 name: zed
441 authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
442 cachixArgs: -v
443 pushFilter: -zed-editor-[0-9.]*-nightly
444 - name: nix_build::build_nix::build
445 run: nix build .#debug -L --accept-flake-config
446 shell: bash -euxo pipefail {0}
447 timeout-minutes: 60
448 continue-on-error: true
449 build_nix_mac_aarch64:
450 needs:
451 - orchestrate
452 if: needs.orchestrate.outputs.run_nix == 'true'
453 runs-on: self-mini-macos
454 env:
455 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
456 ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }}
457 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
458 GIT_LFS_SKIP_SMUDGE: '1'
459 steps:
460 - name: steps::checkout_repo
461 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
462 with:
463 clean: false
464 - name: nix_build::build_nix::set_path
465 run: |
466 echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
467 echo "/Users/administrator/.nix-profile/bin" >> "$GITHUB_PATH"
468 shell: bash -euxo pipefail {0}
469 - name: nix_build::build_nix::cachix_action
470 uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad
471 with:
472 name: zed
473 authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
474 cachixArgs: -v
475 pushFilter: -zed-editor-[0-9.]*-nightly
476 - name: nix_build::build_nix::build
477 run: nix build .#debug -L --accept-flake-config
478 shell: bash -euxo pipefail {0}
479 - name: nix_build::build_nix::limit_store
480 run: |-
481 if [ "$(du -sm /nix/store | cut -f1)" -gt 50000 ]; then
482 nix-collect-garbage -d || true
483 fi
484 shell: bash -euxo pipefail {0}
485 timeout-minutes: 60
486 continue-on-error: true
487 check_postgres_and_protobuf_migrations:
488 needs:
489 - orchestrate
490 if: needs.orchestrate.outputs.run_tests == 'true'
491 runs-on: self-mini-macos
492 steps:
493 - name: steps::checkout_repo
494 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
495 with:
496 fetch-depth: 0
497 - name: run_tests::check_postgres_and_protobuf_migrations::remove_untracked_files
498 run: git clean -df
499 shell: bash -euxo pipefail {0}
500 - name: run_tests::check_postgres_and_protobuf_migrations::ensure_fresh_merge
501 run: |
502 if [ -z "$GITHUB_BASE_REF" ];
503 then
504 echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> "$GITHUB_ENV"
505 else
506 git checkout -B temp
507 git merge -q "origin/$GITHUB_BASE_REF" -m "merge main into temp"
508 echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> "$GITHUB_ENV"
509 fi
510 shell: bash -euxo pipefail {0}
511 - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_setup_action
512 uses: bufbuild/buf-setup-action@v1
513 with:
514 version: v1.29.0
515 - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_breaking_action
516 uses: bufbuild/buf-breaking-action@v1
517 with:
518 input: crates/proto/proto/
519 against: https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/
520 timeout-minutes: 60
521 tests_pass:
522 needs:
523 - orchestrate
524 - check_style
525 - run_tests_windows
526 - run_tests_linux
527 - run_tests_mac
528 - doctests
529 - check_workspace_binaries
530 - check_dependencies
531 - check_docs
532 - check_licenses
533 - check_scripts
534 - build_nix_linux_x86_64
535 - build_nix_mac_aarch64
536 if: github.repository_owner == 'zed-industries' && always()
537 runs-on: namespace-profile-2x4-ubuntu-2404
538 steps:
539 - name: run_tests::tests_pass
540 run: |
541 set +x
542 EXIT_CODE=0
543
544 check_result() {
545 echo "* $1: $2"
546 if [[ "$2" != "skipped" && "$2" != "success" ]]; then EXIT_CODE=1; fi
547 }
548
549 check_result "orchestrate" "${{ needs.orchestrate.result }}"
550 check_result "check_style" "${{ needs.check_style.result }}"
551 check_result "run_tests_windows" "${{ needs.run_tests_windows.result }}"
552 check_result "run_tests_linux" "${{ needs.run_tests_linux.result }}"
553 check_result "run_tests_mac" "${{ needs.run_tests_mac.result }}"
554 check_result "doctests" "${{ needs.doctests.result }}"
555 check_result "check_workspace_binaries" "${{ needs.check_workspace_binaries.result }}"
556 check_result "check_dependencies" "${{ needs.check_dependencies.result }}"
557 check_result "check_docs" "${{ needs.check_docs.result }}"
558 check_result "check_licenses" "${{ needs.check_licenses.result }}"
559 check_result "check_scripts" "${{ needs.check_scripts.result }}"
560 check_result "build_nix_linux_x86_64" "${{ needs.build_nix_linux_x86_64.result }}"
561 check_result "build_nix_mac_aarch64" "${{ needs.build_nix_mac_aarch64.result }}"
562
563 exit $EXIT_CODE
564 shell: bash -euxo pipefail {0}
565concurrency:
566 group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
567 cancel-in-progress: true