run_tests.yml

  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@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 for changes that require full rebuild (no filter)
 50        # Direct pushes to main/stable/preview always run full suite
 51        if [ -z "$GITHUB_BASE_REF" ]; then
 52          echo "Not a PR, running full test suite"
 53          echo "changed_packages=" >> "$GITHUB_OUTPUT"
 54        elif echo "$CHANGED_FILES" | grep -qP '^(rust-toolchain\.toml|\.cargo/|\.github/)'; then
 55          echo "Toolchain, .github or cargo config changed, will run all tests"
 56          echo "changed_packages=" >> "$GITHUB_OUTPUT"
 57        else
 58          # Extract changed packages from file paths
 59          FILE_CHANGED_PKGS=$(echo "$CHANGED_FILES" | \
 60            grep -oP '^(crates|tooling)/\K[^/]+' | \
 61            sort -u || true)
 62
 63          # If assets/ changed, add crates that depend on those assets
 64          if echo "$CHANGED_FILES" | grep -qP '^assets/'; then
 65            FILE_CHANGED_PKGS=$(printf '%s\n%s\n%s\n%s' "$FILE_CHANGED_PKGS" "settings" "storybook" "assets" | sort -u)
 66          fi
 67
 68          # Parse Cargo.toml and Cargo.lock for changed dependencies
 69          CARGO_CHANGED_DEPS=""
 70          if echo "$CHANGED_FILES" | grep -qP '^Cargo\.(toml|lock)$'; then
 71            echo "Cargo files changed, analyzing..."
 72            CARGO_CHANGED_DEPS=$(./script/diff-cargo-deps "$COMPARE_REV" || true)
 73          fi
 74
 75          # Combine all changed packages
 76          ALL_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$CARGO_CHANGED_DEPS" | sort -u | grep -v '^$' || true)
 77
 78          if [ -z "$ALL_CHANGED_PKGS" ]; then
 79            echo "No package changes detected, will run all tests"
 80            echo "changed_packages=" >> "$GITHUB_OUTPUT"
 81          else
 82            # Build nextest filterset with rdeps for each package
 83            FILTERSET=$(echo "$ALL_CHANGED_PKGS" | \
 84              sed 's/.*/rdeps(&)/' | \
 85              tr '\n' '|' | \
 86              sed 's/|$//')
 87            echo "Changed packages filterset: $FILTERSET"
 88            echo "changed_packages=$FILTERSET" >> "$GITHUB_OUTPUT"
 89          fi
 90        fi
 91
 92        check_pattern "run_action_checks" '^\.github/(workflows/|actions/|actionlint.yml)|tooling/xtask|script/' -qP
 93        check_pattern "run_docs" '^(docs/|crates/.*\.rs)' -qP
 94        check_pattern "run_licenses" '^(Cargo.lock|script/.*licenses)' -qP
 95        check_pattern "run_nix" '^(nix/|flake\.|Cargo\.|rust-toolchain.toml|\.cargo/config.toml)' -qP
 96        check_pattern "run_tests" '^(docs/|script/update_top_ranking_issues/|\.github/(ISSUE_TEMPLATE|workflows/(?!run_tests)))' -qvP
 97    outputs:
 98      changed_packages: ${{ steps.filter.outputs.changed_packages }}
 99      run_action_checks: ${{ steps.filter.outputs.run_action_checks }}
100      run_docs: ${{ steps.filter.outputs.run_docs }}
101      run_licenses: ${{ steps.filter.outputs.run_licenses }}
102      run_nix: ${{ steps.filter.outputs.run_nix }}
103      run_tests: ${{ steps.filter.outputs.run_tests }}
104  check_style:
105    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
106    runs-on: namespace-profile-4x8-ubuntu-2204
107    steps:
108    - name: steps::checkout_repo
109      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
110      with:
111        clean: false
112    - name: steps::cache_rust_dependencies_namespace
113      uses: namespacelabs/nscloud-cache-action@v1
114      with:
115        cache: rust
116        path: ~/.rustup
117    - name: steps::setup_pnpm
118      uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
119      with:
120        version: '9'
121    - name: steps::prettier
122      run: ./script/prettier
123    - name: steps::cargo_fmt
124      run: cargo fmt --all -- --check
125    - name: ./script/check-todos
126      run: ./script/check-todos
127    - name: ./script/check-keymaps
128      run: ./script/check-keymaps
129    - name: run_tests::check_style::check_for_typos
130      uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06
131      with:
132        config: ./typos.toml
133    timeout-minutes: 60
134  clippy_windows:
135    needs:
136    - orchestrate
137    if: needs.orchestrate.outputs.run_tests == 'true'
138    runs-on: self-32vcpu-windows-2022
139    steps:
140    - name: steps::checkout_repo
141      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
142      with:
143        clean: false
144    - name: steps::setup_cargo_config
145      run: |
146        New-Item -ItemType Directory -Path "./../.cargo" -Force
147        Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
148      shell: pwsh
149    - name: steps::clippy
150      run: ./script/clippy.ps1
151      shell: pwsh
152    timeout-minutes: 60
153  clippy_linux:
154    needs:
155    - orchestrate
156    if: needs.orchestrate.outputs.run_tests == 'true'
157    runs-on: namespace-profile-16x32-ubuntu-2204
158    steps:
159    - name: steps::checkout_repo
160      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
161      with:
162        clean: false
163    - name: steps::setup_cargo_config
164      run: |
165        mkdir -p ./../.cargo
166        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
167    - name: steps::cache_rust_dependencies_namespace
168      uses: namespacelabs/nscloud-cache-action@v1
169      with:
170        cache: rust
171        path: ~/.rustup
172    - name: steps::setup_linux
173      run: ./script/linux
174    - name: steps::install_mold
175      run: ./script/install-mold
176    - name: steps::download_wasi_sdk
177      run: ./script/download-wasi-sdk
178    - name: steps::clippy
179      run: ./script/clippy
180    timeout-minutes: 60
181  clippy_mac:
182    needs:
183    - orchestrate
184    if: needs.orchestrate.outputs.run_tests == 'true'
185    runs-on: namespace-profile-mac-large
186    steps:
187    - name: steps::checkout_repo
188      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
189      with:
190        clean: false
191    - name: steps::setup_cargo_config
192      run: |
193        mkdir -p ./../.cargo
194        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
195    - name: steps::cache_rust_dependencies_namespace
196      uses: namespacelabs/nscloud-cache-action@v1
197      with:
198        cache: rust
199        path: ~/.rustup
200    - name: steps::clippy
201      run: ./script/clippy
202    timeout-minutes: 60
203  run_tests_windows:
204    needs:
205    - orchestrate
206    if: needs.orchestrate.outputs.run_tests == 'true'
207    runs-on: self-32vcpu-windows-2022
208    steps:
209    - name: steps::checkout_repo
210      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
211      with:
212        clean: false
213    - name: steps::setup_cargo_config
214      run: |
215        New-Item -ItemType Directory -Path "./../.cargo" -Force
216        Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
217      shell: pwsh
218    - name: steps::setup_node
219      uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
220      with:
221        node-version: '20'
222    - name: steps::clear_target_dir_if_large
223      run: ./script/clear-target-dir-if-larger-than.ps1 250
224      shell: pwsh
225    - name: steps::cargo_nextest
226      run: cargo nextest run --workspace --no-fail-fast${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
227      shell: pwsh
228    - name: steps::cleanup_cargo_config
229      if: always()
230      run: |
231        Remove-Item -Recurse -Path "./../.cargo" -Force -ErrorAction SilentlyContinue
232      shell: pwsh
233    timeout-minutes: 60
234  run_tests_linux:
235    needs:
236    - orchestrate
237    if: needs.orchestrate.outputs.run_tests == 'true'
238    runs-on: namespace-profile-16x32-ubuntu-2204
239    steps:
240    - name: steps::checkout_repo
241      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
242      with:
243        clean: false
244    - name: steps::setup_cargo_config
245      run: |
246        mkdir -p ./../.cargo
247        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
248    - name: steps::cache_rust_dependencies_namespace
249      uses: namespacelabs/nscloud-cache-action@v1
250      with:
251        cache: rust
252        path: ~/.rustup
253    - name: steps::setup_linux
254      run: ./script/linux
255    - name: steps::install_mold
256      run: ./script/install-mold
257    - name: steps::download_wasi_sdk
258      run: ./script/download-wasi-sdk
259    - name: steps::setup_node
260      uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
261      with:
262        node-version: '20'
263    - name: steps::cargo_install_nextest
264      uses: taiki-e/install-action@nextest
265    - name: steps::clear_target_dir_if_large
266      run: ./script/clear-target-dir-if-larger-than 250
267    - name: steps::cargo_nextest
268      run: cargo nextest run --workspace --no-fail-fast${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
269    - name: steps::cleanup_cargo_config
270      if: always()
271      run: |
272        rm -rf ./../.cargo
273    timeout-minutes: 60
274    services:
275      postgres:
276        image: postgres:15
277        env:
278          POSTGRES_HOST_AUTH_METHOD: trust
279        ports:
280        - 5432:5432
281        options: --health-cmd pg_isready --health-interval 500ms --health-timeout 5s --health-retries 10
282  run_tests_mac:
283    needs:
284    - orchestrate
285    if: needs.orchestrate.outputs.run_tests == 'true'
286    runs-on: namespace-profile-mac-large
287    steps:
288    - name: steps::checkout_repo
289      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
290      with:
291        clean: false
292    - name: steps::setup_cargo_config
293      run: |
294        mkdir -p ./../.cargo
295        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
296    - name: steps::cache_rust_dependencies_namespace
297      uses: namespacelabs/nscloud-cache-action@v1
298      with:
299        cache: rust
300        path: ~/.rustup
301    - name: steps::setup_node
302      uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
303      with:
304        node-version: '20'
305    - name: steps::cargo_install_nextest
306      uses: taiki-e/install-action@nextest
307    - name: steps::clear_target_dir_if_large
308      run: ./script/clear-target-dir-if-larger-than 300
309    - name: steps::cargo_nextest
310      run: cargo nextest run --workspace --no-fail-fast${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
311    - name: steps::cleanup_cargo_config
312      if: always()
313      run: |
314        rm -rf ./../.cargo
315    timeout-minutes: 60
316  doctests:
317    needs:
318    - orchestrate
319    if: needs.orchestrate.outputs.run_tests == 'true'
320    runs-on: namespace-profile-16x32-ubuntu-2204
321    steps:
322    - name: steps::checkout_repo
323      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
324      with:
325        clean: false
326    - name: steps::cache_rust_dependencies_namespace
327      uses: namespacelabs/nscloud-cache-action@v1
328      with:
329        cache: rust
330        path: ~/.rustup
331    - name: steps::setup_linux
332      run: ./script/linux
333    - name: steps::install_mold
334      run: ./script/install-mold
335    - name: steps::download_wasi_sdk
336      run: ./script/download-wasi-sdk
337    - name: steps::setup_cargo_config
338      run: |
339        mkdir -p ./../.cargo
340        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
341    - id: run_doctests
342      name: run_tests::doctests::run_doctests
343      run: |
344        cargo test --workspace --doc --no-fail-fast
345    - name: steps::cleanup_cargo_config
346      if: always()
347      run: |
348        rm -rf ./../.cargo
349    timeout-minutes: 60
350  check_workspace_binaries:
351    needs:
352    - orchestrate
353    if: needs.orchestrate.outputs.run_tests == 'true'
354    runs-on: namespace-profile-8x16-ubuntu-2204
355    steps:
356    - name: steps::checkout_repo
357      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
358      with:
359        clean: false
360    - name: steps::setup_cargo_config
361      run: |
362        mkdir -p ./../.cargo
363        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
364    - name: steps::cache_rust_dependencies_namespace
365      uses: namespacelabs/nscloud-cache-action@v1
366      with:
367        cache: rust
368        path: ~/.rustup
369    - name: steps::setup_linux
370      run: ./script/linux
371    - name: steps::install_mold
372      run: ./script/install-mold
373    - name: steps::download_wasi_sdk
374      run: ./script/download-wasi-sdk
375    - name: cargo build -p collab
376      run: cargo build -p collab
377    - name: cargo build --workspace --bins --examples
378      run: cargo build --workspace --bins --examples
379    - name: steps::cleanup_cargo_config
380      if: always()
381      run: |
382        rm -rf ./../.cargo
383    timeout-minutes: 60
384  check_dependencies:
385    needs:
386    - orchestrate
387    if: needs.orchestrate.outputs.run_tests == 'true'
388    runs-on: namespace-profile-2x4-ubuntu-2404
389    steps:
390    - name: steps::checkout_repo
391      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
392      with:
393        clean: false
394    - name: steps::cache_rust_dependencies_namespace
395      uses: namespacelabs/nscloud-cache-action@v1
396      with:
397        cache: rust
398        path: ~/.rustup
399    - name: run_tests::check_dependencies::install_cargo_machete
400      uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
401      with:
402        command: install
403        args: cargo-machete@0.7.0
404    - name: run_tests::check_dependencies::run_cargo_machete
405      uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
406      with:
407        command: machete
408    - name: run_tests::check_dependencies::check_cargo_lock
409      run: cargo update --locked --workspace
410    - name: run_tests::check_dependencies::check_vulnerable_dependencies
411      if: github.event_name == 'pull_request'
412      uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8
413      with:
414        license-check: false
415    timeout-minutes: 60
416  check_docs:
417    needs:
418    - orchestrate
419    if: needs.orchestrate.outputs.run_docs == 'true'
420    runs-on: namespace-profile-8x16-ubuntu-2204
421    steps:
422    - name: steps::checkout_repo
423      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
424      with:
425        clean: false
426    - name: steps::setup_cargo_config
427      run: |
428        mkdir -p ./../.cargo
429        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
430    - name: steps::cache_rust_dependencies_namespace
431      uses: namespacelabs/nscloud-cache-action@v1
432      with:
433        cache: rust
434        path: ~/.rustup
435    - name: run_tests::check_docs::lychee_link_check
436      uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
437      with:
438        args: --no-progress --exclude '^http' './docs/src/**/*'
439        fail: true
440        jobSummary: false
441    - name: steps::setup_linux
442      run: ./script/linux
443    - name: steps::install_mold
444      run: ./script/install-mold
445    - name: steps::download_wasi_sdk
446      run: ./script/download-wasi-sdk
447    - name: ./script/generate-action-metadata
448      run: ./script/generate-action-metadata
449    - name: run_tests::check_docs::install_mdbook
450      uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08
451      with:
452        mdbook-version: 0.4.37
453    - name: run_tests::check_docs::build_docs
454      run: |
455        mkdir -p target/deploy
456        mdbook build ./docs --dest-dir=../target/deploy/docs/
457    - name: run_tests::check_docs::lychee_link_check
458      uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
459      with:
460        args: --no-progress --exclude '^http' 'target/deploy/docs'
461        fail: true
462        jobSummary: false
463    timeout-minutes: 60
464  check_licenses:
465    needs:
466    - orchestrate
467    if: needs.orchestrate.outputs.run_licenses == 'true'
468    runs-on: namespace-profile-2x4-ubuntu-2404
469    steps:
470    - name: steps::checkout_repo
471      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
472      with:
473        clean: false
474    - name: steps::cache_rust_dependencies_namespace
475      uses: namespacelabs/nscloud-cache-action@v1
476      with:
477        cache: rust
478        path: ~/.rustup
479    - name: ./script/check-licenses
480      run: ./script/check-licenses
481    - name: ./script/generate-licenses
482      run: ./script/generate-licenses
483  check_scripts:
484    needs:
485    - orchestrate
486    if: needs.orchestrate.outputs.run_action_checks == 'true'
487    runs-on: namespace-profile-2x4-ubuntu-2404
488    steps:
489    - name: steps::checkout_repo
490      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
491      with:
492        clean: false
493    - name: run_tests::check_scripts::run_shellcheck
494      run: ./script/shellcheck-scripts error
495    - id: get_actionlint
496      name: run_tests::check_scripts::download_actionlint
497      run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
498    - name: run_tests::check_scripts::run_actionlint
499      run: |
500        ${{ steps.get_actionlint.outputs.executable }} -color
501    - name: run_tests::check_scripts::check_xtask_workflows
502      run: |
503        cargo xtask workflows
504        if ! git diff --exit-code .github; then
505          echo "Error: .github directory has uncommitted changes after running 'cargo xtask workflows'"
506          echo "Please run 'cargo xtask workflows' locally and commit the changes"
507          exit 1
508        fi
509    timeout-minutes: 60
510  build_nix_linux_x86_64:
511    needs:
512    - orchestrate
513    if: needs.orchestrate.outputs.run_nix == 'true'
514    runs-on: namespace-profile-32x64-ubuntu-2004
515    env:
516      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
517      ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }}
518      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
519      GIT_LFS_SKIP_SMUDGE: '1'
520    steps:
521    - name: steps::checkout_repo
522      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
523      with:
524        clean: false
525    - name: steps::cache_nix_dependencies_namespace
526      uses: namespacelabs/nscloud-cache-action@v1
527      with:
528        cache: nix
529    - name: nix_build::build_nix::install_nix
530      uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f
531      with:
532        github_access_token: ${{ secrets.GITHUB_TOKEN }}
533    - name: nix_build::build_nix::cachix_action
534      uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad
535      with:
536        name: zed
537        authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
538        cachixArgs: -v
539        pushFilter: -zed-editor-[0-9.]*-nightly
540    - name: nix_build::build_nix::build
541      run: nix build .#debug -L --accept-flake-config
542    timeout-minutes: 60
543    continue-on-error: true
544  build_nix_mac_aarch64:
545    needs:
546    - orchestrate
547    if: needs.orchestrate.outputs.run_nix == 'true'
548    runs-on: namespace-profile-mac-large
549    env:
550      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
551      ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }}
552      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
553      GIT_LFS_SKIP_SMUDGE: '1'
554    steps:
555    - name: steps::checkout_repo
556      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
557      with:
558        clean: false
559    - name: steps::cache_nix_store_macos
560      uses: namespacelabs/nscloud-cache-action@v1
561      with:
562        path: ~/nix-cache
563    - name: nix_build::build_nix::install_nix
564      uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f
565      with:
566        github_access_token: ${{ secrets.GITHUB_TOKEN }}
567    - name: nix_build::build_nix::configure_local_nix_cache
568      run: |
569        mkdir -p ~/nix-cache
570        echo "extra-substituters = file://$HOME/nix-cache?priority=10" | sudo tee -a /etc/nix/nix.conf
571        echo "require-sigs = false" | sudo tee -a /etc/nix/nix.conf
572        sudo launchctl kickstart -k system/org.nixos.nix-daemon
573    - name: nix_build::build_nix::cachix_action
574      uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad
575      with:
576        name: zed
577        authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
578        cachixArgs: -v
579        pushFilter: -zed-editor-[0-9.]*-nightly
580    - name: nix_build::build_nix::build
581      run: nix build .#debug -L --accept-flake-config
582    - name: nix_build::build_nix::export_to_local_nix_cache
583      if: always()
584      run: |
585        if [ -L result ]; then
586          echo "Copying build closure to local binary cache..."
587          nix copy --to "file://$HOME/nix-cache" ./result || echo "Warning: nix copy to local cache failed"
588        else
589          echo "No build result found, skipping cache export."
590        fi
591    timeout-minutes: 60
592    continue-on-error: true
593  check_postgres_and_protobuf_migrations:
594    needs:
595    - orchestrate
596    if: needs.orchestrate.outputs.run_tests == 'true'
597    runs-on: namespace-profile-16x32-ubuntu-2204
598    env:
599      GIT_AUTHOR_NAME: Protobuf Action
600      GIT_AUTHOR_EMAIL: ci@zed.dev
601      GIT_COMMITTER_NAME: Protobuf Action
602      GIT_COMMITTER_EMAIL: ci@zed.dev
603    steps:
604    - name: steps::checkout_repo
605      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
606      with:
607        fetch-depth: 0
608    - name: run_tests::check_postgres_and_protobuf_migrations::remove_untracked_files
609      run: git clean -df
610    - name: run_tests::check_postgres_and_protobuf_migrations::ensure_fresh_merge
611      run: |
612        if [ -z "$GITHUB_BASE_REF" ];
613        then
614          echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> "$GITHUB_ENV"
615        else
616          git checkout -B temp
617          git merge -q "origin/$GITHUB_BASE_REF" -m "merge main into temp"
618          echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> "$GITHUB_ENV"
619        fi
620    - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_setup_action
621      uses: bufbuild/buf-setup-action@v1
622      with:
623        version: v1.29.0
624        github_token: ${{ secrets.GITHUB_TOKEN }}
625    - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_breaking_action
626      uses: bufbuild/buf-breaking-action@v1
627      with:
628        input: crates/proto/proto/
629        against: https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/
630    timeout-minutes: 60
631  tests_pass:
632    needs:
633    - orchestrate
634    - check_style
635    - clippy_windows
636    - clippy_linux
637    - clippy_mac
638    - run_tests_windows
639    - run_tests_linux
640    - run_tests_mac
641    - doctests
642    - check_workspace_binaries
643    - check_dependencies
644    - check_docs
645    - check_licenses
646    - check_scripts
647    - build_nix_linux_x86_64
648    - build_nix_mac_aarch64
649    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') && always()
650    runs-on: namespace-profile-2x4-ubuntu-2404
651    steps:
652    - name: run_tests::tests_pass
653      run: |
654        set +x
655        EXIT_CODE=0
656
657        check_result() {
658          echo "* $1: $2"
659          if [[ "$2" != "skipped" && "$2" != "success" ]]; then EXIT_CODE=1; fi
660        }
661
662        check_result "orchestrate" "${{ needs.orchestrate.result }}"
663        check_result "check_style" "${{ needs.check_style.result }}"
664        check_result "clippy_windows" "${{ needs.clippy_windows.result }}"
665        check_result "clippy_linux" "${{ needs.clippy_linux.result }}"
666        check_result "clippy_mac" "${{ needs.clippy_mac.result }}"
667        check_result "run_tests_windows" "${{ needs.run_tests_windows.result }}"
668        check_result "run_tests_linux" "${{ needs.run_tests_linux.result }}"
669        check_result "run_tests_mac" "${{ needs.run_tests_mac.result }}"
670        check_result "doctests" "${{ needs.doctests.result }}"
671        check_result "check_workspace_binaries" "${{ needs.check_workspace_binaries.result }}"
672        check_result "check_dependencies" "${{ needs.check_dependencies.result }}"
673        check_result "check_docs" "${{ needs.check_docs.result }}"
674        check_result "check_licenses" "${{ needs.check_licenses.result }}"
675        check_result "check_scripts" "${{ needs.check_scripts.result }}"
676        check_result "build_nix_linux_x86_64" "${{ needs.build_nix_linux_x86_64.result }}"
677        check_result "build_nix_mac_aarch64" "${{ needs.build_nix_mac_aarch64.result }}"
678
679        exit $EXIT_CODE
680concurrency:
681  group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
682  cancel-in-progress: true
683defaults:
684  run:
685    shell: bash -euxo pipefail {0}