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