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