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@93cb6efe18208431cddfb8368fd83d5badbf9bfd
 23      with:
 24        clean: false
 25        fetch-depth: ${{ github.ref == 'refs/heads/main' && 2 || 350 }}
 26    - id: filter
 27      name: filter
 28      run: |
 29        set -euo pipefail
 30        if [ -z "$GITHUB_BASE_REF" ]; then
 31          echo "Not in a PR context (i.e., push to main/stable/preview)"
 32          COMPARE_REV="$(git rev-parse HEAD~1)"
 33        else
 34          echo "In a PR context comparing to pull_request.base.ref"
 35          git fetch origin "$GITHUB_BASE_REF" --depth=350
 36          COMPARE_REV="$(git merge-base "origin/${GITHUB_BASE_REF}" HEAD)"
 37        fi
 38        CHANGED_FILES="$(git diff --name-only "$COMPARE_REV" "$GITHUB_SHA")"
 39
 40        check_pattern() {
 41          local output_name="$1"
 42          local pattern="$2"
 43          local grep_arg="$3"
 44
 45          echo "$CHANGED_FILES" | grep "$grep_arg" "$pattern" && \
 46            echo "${output_name}=true" >> "$GITHUB_OUTPUT" || \
 47            echo "${output_name}=false" >> "$GITHUB_OUTPUT"
 48        }
 49
 50        # Check for changes that require full rebuild (no filter)
 51        # Direct pushes to main/stable/preview always run full suite
 52        if [ -z "$GITHUB_BASE_REF" ]; then
 53          echo "Not a PR, running full test suite"
 54          echo "changed_packages=" >> "$GITHUB_OUTPUT"
 55        elif echo "$CHANGED_FILES" | grep -qP '^(rust-toolchain\.toml|\.cargo/|\.github/|Cargo\.(toml|lock)$)'; then
 56          echo "Toolchain, cargo config, or root Cargo files changed, will run all tests"
 57          echo "changed_packages=" >> "$GITHUB_OUTPUT"
 58        else
 59          # Extract changed directories from file paths
 60          CHANGED_DIRS=$(echo "$CHANGED_FILES" | \
 61            grep -oP '^(crates|tooling)/\K[^/]+' | \
 62            sort -u || true)
 63
 64          # Build directory-to-package mapping using cargo metadata
 65          DIR_TO_PKG=$(cargo metadata --format-version=1 --no-deps 2>/dev/null | \
 66            jq -r '.packages[] | select(.manifest_path | test("crates/|tooling/")) | "\(.manifest_path | capture("(crates|tooling)/(?<dir>[^/]+)") | .dir)=\(.name)"')
 67
 68          # Map directory names to package names
 69          FILE_CHANGED_PKGS=""
 70          for dir in $CHANGED_DIRS; do
 71            pkg=$(echo "$DIR_TO_PKG" | grep "^${dir}=" | cut -d= -f2 | head -1)
 72            if [ -n "$pkg" ]; then
 73              FILE_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$pkg")
 74            else
 75              # Fall back to directory name if no mapping found
 76              FILE_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$dir")
 77            fi
 78          done
 79          FILE_CHANGED_PKGS=$(echo "$FILE_CHANGED_PKGS" | grep -v '^$' | sort -u || true)
 80
 81          # If assets/ changed, add crates that depend on those assets
 82          if echo "$CHANGED_FILES" | grep -qP '^assets/'; then
 83            FILE_CHANGED_PKGS=$(printf '%s\n%s\n%s\n%s' "$FILE_CHANGED_PKGS" "settings" "storybook" "assets" | sort -u)
 84          fi
 85
 86          # Combine all changed packages
 87          ALL_CHANGED_PKGS=$(echo "$FILE_CHANGED_PKGS" | grep -v '^$' || true)
 88
 89          if [ -z "$ALL_CHANGED_PKGS" ]; then
 90            echo "No package changes detected, will run all tests"
 91            echo "changed_packages=" >> "$GITHUB_OUTPUT"
 92          else
 93            # Build nextest filterset with rdeps for each package
 94            FILTERSET=$(echo "$ALL_CHANGED_PKGS" | \
 95              sed 's/.*/rdeps(&)/' | \
 96              tr '\n' '|' | \
 97              sed 's/|$//')
 98            echo "Changed packages filterset: $FILTERSET"
 99            echo "changed_packages=$FILTERSET" >> "$GITHUB_OUTPUT"
100          fi
101        fi
102
103        check_pattern "run_action_checks" '^\.github/(workflows/|actions/|actionlint.yml)|tooling/xtask|script/' -qP
104        check_pattern "run_docs" '^(docs/|crates/.*\.rs)' -qP
105        check_pattern "run_licenses" '^(Cargo.lock|script/.*licenses)' -qP
106        check_pattern "run_tests" '^(docs/|script/update_top_ranking_issues/|\.github/(ISSUE_TEMPLATE|workflows/(?!run_tests))|extensions/)' -qvP
107        # Detect changed extension directories (excluding extensions/workflows)
108        CHANGED_EXTENSIONS=$(echo "$CHANGED_FILES" | grep -oP '^extensions/[^/]+(?=/)' | sort -u | grep -v '^extensions/workflows$' || true)
109        # Filter out deleted extensions
110        EXISTING_EXTENSIONS=""
111        for ext in $CHANGED_EXTENSIONS; do
112            if [ -f "$ext/extension.toml" ]; then
113                EXISTING_EXTENSIONS=$(printf '%s\n%s' "$EXISTING_EXTENSIONS" "$ext")
114            fi
115        done
116        CHANGED_EXTENSIONS=$(echo "$EXISTING_EXTENSIONS" | sed '/^$/d')
117        if [ -n "$CHANGED_EXTENSIONS" ]; then
118            EXTENSIONS_JSON=$(echo "$CHANGED_EXTENSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
119        else
120            EXTENSIONS_JSON="[]"
121        fi
122        echo "changed_extensions=$EXTENSIONS_JSON" >> "$GITHUB_OUTPUT"
123    outputs:
124      changed_packages: ${{ steps.filter.outputs.changed_packages }}
125      run_action_checks: ${{ steps.filter.outputs.run_action_checks }}
126      run_docs: ${{ steps.filter.outputs.run_docs }}
127      run_licenses: ${{ steps.filter.outputs.run_licenses }}
128      run_tests: ${{ steps.filter.outputs.run_tests }}
129      changed_extensions: ${{ steps.filter.outputs.changed_extensions }}
130  check_style:
131    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
132    runs-on: namespace-profile-4x8-ubuntu-2204
133    steps:
134    - name: steps::checkout_repo
135      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
136      with:
137        clean: false
138    - name: steps::cache_rust_dependencies_namespace
139      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
140      with:
141        cache: rust
142        path: ~/.rustup
143    - name: steps::setup_pnpm
144      uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
145      with:
146        version: '9'
147    - name: steps::prettier
148      run: ./script/prettier
149    - name: steps::cargo_fmt
150      run: cargo fmt --all -- --check
151    - name: ./script/check-todos
152      run: ./script/check-todos
153    - name: ./script/check-keymaps
154      run: ./script/check-keymaps
155    - name: run_tests::check_style::check_for_typos
156      uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06
157      with:
158        config: ./typos.toml
159    - name: run_tests::fetch_ts_query_ls
160      uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c
161      with:
162        repo: ribru17/ts_query_ls
163        version: tags/v3.15.1
164        file: ts_query_ls-x86_64-unknown-linux-gnu.tar.gz
165    - name: run_tests::run_ts_query_ls
166      run: |-
167        tar -xf "$GITHUB_WORKSPACE/ts_query_ls-x86_64-unknown-linux-gnu.tar.gz" -C "$GITHUB_WORKSPACE"
168        "$GITHUB_WORKSPACE/ts_query_ls" format --check . || {
169            echo "Found unformatted queries, please format them with ts_query_ls."
170            echo "For easy use, install the Tree-sitter query extension:"
171            echo "zed://extension/tree-sitter-query"
172            false
173        }
174    timeout-minutes: 60
175  clippy_windows:
176    needs:
177    - orchestrate
178    if: needs.orchestrate.outputs.run_tests == 'true'
179    runs-on: self-32vcpu-windows-2022
180    steps:
181    - name: steps::checkout_repo
182      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
183      with:
184        clean: false
185    - name: steps::setup_cargo_config
186      run: |
187        New-Item -ItemType Directory -Path "./../.cargo" -Force
188        Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
189      shell: pwsh
190    - name: steps::setup_sccache
191      run: ./script/setup-sccache.ps1
192      shell: pwsh
193      env:
194        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
195        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
196        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
197        SCCACHE_BUCKET: sccache-zed
198    - name: steps::clippy
199      run: ./script/clippy.ps1
200      shell: pwsh
201    - name: steps::show_sccache_stats
202      run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
203      shell: pwsh
204    timeout-minutes: 60
205  clippy_linux:
206    needs:
207    - orchestrate
208    if: needs.orchestrate.outputs.run_tests == 'true'
209    runs-on: namespace-profile-16x32-ubuntu-2204
210    env:
211      CC: clang
212      CXX: clang++
213    steps:
214    - name: steps::checkout_repo
215      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
216      with:
217        clean: false
218    - name: steps::setup_cargo_config
219      run: |
220        mkdir -p ./../.cargo
221        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
222    - name: steps::cache_rust_dependencies_namespace
223      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
224      with:
225        cache: rust
226        path: ~/.rustup
227    - name: steps::setup_linux
228      run: ./script/linux
229    - name: steps::download_wasi_sdk
230      run: ./script/download-wasi-sdk
231    - name: steps::setup_sccache
232      run: ./script/setup-sccache
233      env:
234        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
235        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
236        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
237        SCCACHE_BUCKET: sccache-zed
238    - name: steps::clippy
239      run: ./script/clippy
240    - name: steps::show_sccache_stats
241      run: sccache --show-stats || true
242    timeout-minutes: 60
243  clippy_mac:
244    needs:
245    - orchestrate
246    if: needs.orchestrate.outputs.run_tests == 'true'
247    runs-on: namespace-profile-mac-large
248    steps:
249    - name: steps::checkout_repo
250      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
251      with:
252        clean: false
253    - name: steps::setup_cargo_config
254      run: |
255        mkdir -p ./../.cargo
256        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
257    - name: steps::cache_rust_dependencies_namespace
258      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
259      with:
260        cache: rust
261        path: ~/.rustup
262    - name: steps::setup_sccache
263      run: ./script/setup-sccache
264      env:
265        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
266        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
267        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
268        SCCACHE_BUCKET: sccache-zed
269    - name: steps::clippy
270      run: ./script/clippy
271    - name: steps::show_sccache_stats
272      run: sccache --show-stats || true
273    timeout-minutes: 60
274  clippy_mac_x86_64:
275    needs:
276    - orchestrate
277    if: needs.orchestrate.outputs.run_tests == 'true'
278    runs-on: namespace-profile-mac-large
279    steps:
280    - name: steps::checkout_repo
281      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
282      with:
283        clean: false
284    - name: steps::setup_cargo_config
285      run: |
286        mkdir -p ./../.cargo
287        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
288    - name: steps::cache_rust_dependencies_namespace
289      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
290      with:
291        cache: rust
292        path: ~/.rustup
293    - name: steps::install_rustup_target
294      run: rustup target add x86_64-apple-darwin
295    - name: steps::setup_sccache
296      run: ./script/setup-sccache
297      env:
298        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
299        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
300        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
301        SCCACHE_BUCKET: sccache-zed
302    - name: steps::clippy
303      run: ./script/clippy --target x86_64-apple-darwin
304    - name: steps::show_sccache_stats
305      run: sccache --show-stats || true
306    timeout-minutes: 60
307  run_tests_windows:
308    needs:
309    - orchestrate
310    if: needs.orchestrate.outputs.run_tests == 'true'
311    runs-on: self-32vcpu-windows-2022
312    steps:
313    - name: steps::checkout_repo
314      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
315      with:
316        clean: false
317    - name: steps::setup_cargo_config
318      run: |
319        New-Item -ItemType Directory -Path "./../.cargo" -Force
320        Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
321      shell: pwsh
322    - name: steps::setup_node
323      uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
324      with:
325        node-version: '20'
326    - name: steps::clear_target_dir_if_large
327      run: ./script/clear-target-dir-if-larger-than.ps1 250
328      shell: pwsh
329    - name: steps::setup_sccache
330      run: ./script/setup-sccache.ps1
331      shell: pwsh
332      env:
333        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
334        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
335        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
336        SCCACHE_BUCKET: sccache-zed
337    - name: steps::cargo_nextest
338      run: cargo nextest run --workspace --no-fail-fast --no-tests=warn${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
339      shell: pwsh
340    - name: steps::show_sccache_stats
341      run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
342      shell: pwsh
343    - name: steps::cleanup_cargo_config
344      if: always()
345      run: |
346        Remove-Item -Recurse -Path "./../.cargo" -Force -ErrorAction SilentlyContinue
347      shell: pwsh
348    timeout-minutes: 60
349  run_tests_linux:
350    needs:
351    - orchestrate
352    if: needs.orchestrate.outputs.run_tests == 'true'
353    runs-on: namespace-profile-16x32-ubuntu-2204
354    env:
355      CC: clang
356      CXX: clang++
357    steps:
358    - name: steps::checkout_repo
359      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
360      with:
361        clean: false
362    - name: steps::setup_cargo_config
363      run: |
364        mkdir -p ./../.cargo
365        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
366    - name: steps::cache_rust_dependencies_namespace
367      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
368      with:
369        cache: rust
370        path: ~/.rustup
371    - name: steps::setup_linux
372      run: ./script/linux
373    - name: steps::download_wasi_sdk
374      run: ./script/download-wasi-sdk
375    - name: steps::setup_node
376      uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
377      with:
378        node-version: '20'
379    - name: steps::cargo_install_nextest
380      uses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c
381    - name: steps::clear_target_dir_if_large
382      run: ./script/clear-target-dir-if-larger-than 250
383    - name: steps::setup_sccache
384      run: ./script/setup-sccache
385      env:
386        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
387        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
388        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
389        SCCACHE_BUCKET: sccache-zed
390    - name: steps::cargo_nextest
391      run: cargo nextest run --workspace --no-fail-fast --no-tests=warn${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
392    - name: steps::show_sccache_stats
393      run: sccache --show-stats || true
394    - name: steps::cleanup_cargo_config
395      if: always()
396      run: |
397        rm -rf ./../.cargo
398    timeout-minutes: 60
399    services:
400      postgres:
401        image: postgres:15
402        env:
403          POSTGRES_HOST_AUTH_METHOD: trust
404        ports:
405        - 5432:5432
406        options: --health-cmd pg_isready --health-interval 500ms --health-timeout 5s --health-retries 10
407  run_tests_mac:
408    needs:
409    - orchestrate
410    if: needs.orchestrate.outputs.run_tests == 'true'
411    runs-on: namespace-profile-mac-large
412    steps:
413    - name: steps::checkout_repo
414      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
415      with:
416        clean: false
417    - name: steps::setup_cargo_config
418      run: |
419        mkdir -p ./../.cargo
420        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
421    - name: steps::cache_rust_dependencies_namespace
422      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
423      with:
424        cache: rust
425        path: ~/.rustup
426    - name: steps::setup_node
427      uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
428      with:
429        node-version: '20'
430    - name: steps::cargo_install_nextest
431      uses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c
432    - name: steps::clear_target_dir_if_large
433      run: ./script/clear-target-dir-if-larger-than 300
434    - name: steps::setup_sccache
435      run: ./script/setup-sccache
436      env:
437        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
438        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
439        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
440        SCCACHE_BUCKET: sccache-zed
441    - name: steps::cargo_nextest
442      run: cargo nextest run --workspace --no-fail-fast --no-tests=warn${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
443    - name: steps::cargo_build_visual_tests
444      run: cargo build -p zed --bin zed_visual_test_runner --features visual-tests
445    - name: steps::show_sccache_stats
446      run: sccache --show-stats || true
447    - name: steps::cleanup_cargo_config
448      if: always()
449      run: |
450        rm -rf ./../.cargo
451    timeout-minutes: 60
452  doctests:
453    needs:
454    - orchestrate
455    if: needs.orchestrate.outputs.run_tests == 'true'
456    runs-on: namespace-profile-16x32-ubuntu-2204
457    env:
458      CC: clang
459      CXX: clang++
460    steps:
461    - name: steps::checkout_repo
462      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
463      with:
464        clean: false
465    - name: steps::cache_rust_dependencies_namespace
466      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
467      with:
468        cache: rust
469        path: ~/.rustup
470    - name: steps::setup_linux
471      run: ./script/linux
472    - name: steps::download_wasi_sdk
473      run: ./script/download-wasi-sdk
474    - name: steps::setup_cargo_config
475      run: |
476        mkdir -p ./../.cargo
477        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
478    - name: steps::setup_sccache
479      run: ./script/setup-sccache
480      env:
481        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
482        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
483        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
484        SCCACHE_BUCKET: sccache-zed
485    - id: run_doctests
486      name: run_tests::doctests::run_doctests
487      run: |
488        cargo test --workspace --doc --no-fail-fast
489    - name: steps::show_sccache_stats
490      run: sccache --show-stats || true
491    - name: steps::cleanup_cargo_config
492      if: always()
493      run: |
494        rm -rf ./../.cargo
495    timeout-minutes: 60
496  check_workspace_binaries:
497    needs:
498    - orchestrate
499    if: needs.orchestrate.outputs.run_tests == 'true'
500    runs-on: namespace-profile-8x16-ubuntu-2204
501    env:
502      CC: clang
503      CXX: clang++
504    steps:
505    - name: steps::checkout_repo
506      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
507      with:
508        clean: false
509    - name: steps::setup_cargo_config
510      run: |
511        mkdir -p ./../.cargo
512        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
513    - name: steps::cache_rust_dependencies_namespace
514      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
515      with:
516        cache: rust
517        path: ~/.rustup
518    - name: steps::setup_linux
519      run: ./script/linux
520    - name: steps::download_wasi_sdk
521      run: ./script/download-wasi-sdk
522    - name: steps::setup_sccache
523      run: ./script/setup-sccache
524      env:
525        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
526        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
527        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
528        SCCACHE_BUCKET: sccache-zed
529    - name: cargo build -p collab
530      run: cargo build -p collab
531    - name: cargo build --workspace --bins --examples
532      run: cargo build --workspace --bins --examples
533    - name: steps::show_sccache_stats
534      run: sccache --show-stats || true
535    - name: steps::cleanup_cargo_config
536      if: always()
537      run: |
538        rm -rf ./../.cargo
539    timeout-minutes: 60
540  check_wasm:
541    needs:
542    - orchestrate
543    if: needs.orchestrate.outputs.run_tests == 'true'
544    runs-on: namespace-profile-8x16-ubuntu-2204
545    steps:
546    - name: steps::checkout_repo
547      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
548      with:
549        clean: false
550    - name: steps::setup_cargo_config
551      run: |
552        mkdir -p ./../.cargo
553        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
554    - name: steps::cache_rust_dependencies_namespace
555      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
556      with:
557        cache: rust
558        path: ~/.rustup
559    - name: run_tests::check_wasm::install_nightly_wasm_toolchain
560      run: rustup toolchain install nightly --component rust-src --target wasm32-unknown-unknown
561    - name: steps::setup_sccache
562      run: ./script/setup-sccache
563      env:
564        R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
565        R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
566        R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
567        SCCACHE_BUCKET: sccache-zed
568    - name: run_tests::check_wasm::cargo_check_wasm
569      run: cargo +nightly -Zbuild-std=std,panic_abort check --target wasm32-unknown-unknown -p gpui_platform
570      env:
571        CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS: -C target-feature=+atomics,+bulk-memory,+mutable-globals
572    - name: steps::show_sccache_stats
573      run: sccache --show-stats || true
574    - name: steps::cleanup_cargo_config
575      if: always()
576      run: |
577        rm -rf ./../.cargo
578    timeout-minutes: 60
579  check_dependencies:
580    needs:
581    - orchestrate
582    if: needs.orchestrate.outputs.run_tests == 'true'
583    runs-on: namespace-profile-2x4-ubuntu-2404
584    env:
585      CC: clang
586      CXX: clang++
587    steps:
588    - name: steps::checkout_repo
589      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
590      with:
591        clean: false
592    - name: steps::cache_rust_dependencies_namespace
593      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
594      with:
595        cache: rust
596        path: ~/.rustup
597    - name: run_tests::check_dependencies::install_cargo_machete
598      uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
599      with:
600        command: install
601        args: cargo-machete@0.7.0
602    - name: run_tests::check_dependencies::run_cargo_machete
603      uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
604      with:
605        command: machete
606    - name: run_tests::check_dependencies::check_cargo_lock
607      run: cargo update --locked --workspace
608    - name: run_tests::check_dependencies::check_vulnerable_dependencies
609      if: github.event_name == 'pull_request'
610      uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8
611      with:
612        license-check: false
613    timeout-minutes: 60
614  check_docs:
615    needs:
616    - orchestrate
617    if: needs.orchestrate.outputs.run_docs == 'true'
618    runs-on: namespace-profile-8x16-ubuntu-2204
619    env:
620      CC: clang
621      CXX: clang++
622    steps:
623    - name: steps::checkout_repo
624      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
625      with:
626        clean: false
627    - name: steps::setup_cargo_config
628      run: |
629        mkdir -p ./../.cargo
630        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
631    - name: steps::cache_rust_dependencies_namespace
632      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
633      with:
634        cache: rust
635        path: ~/.rustup
636    - name: run_tests::check_docs::lychee_link_check
637      uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
638      with:
639        args: --no-progress --exclude '^http' './docs/src/**/*'
640        fail: true
641        jobSummary: false
642    - name: steps::setup_linux
643      run: ./script/linux
644    - name: steps::download_wasi_sdk
645      run: ./script/download-wasi-sdk
646    - name: ./script/generate-action-metadata
647      run: ./script/generate-action-metadata
648    - name: run_tests::check_docs::install_mdbook
649      uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08
650      with:
651        mdbook-version: 0.4.37
652    - name: run_tests::check_docs::build_docs
653      run: |
654        mkdir -p target/deploy
655        mdbook build ./docs --dest-dir=../target/deploy/docs/
656    - name: run_tests::check_docs::lychee_link_check
657      uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
658      with:
659        args: --no-progress --exclude '^http' 'target/deploy/docs'
660        fail: true
661        jobSummary: false
662    timeout-minutes: 60
663  check_licenses:
664    needs:
665    - orchestrate
666    if: needs.orchestrate.outputs.run_licenses == 'true'
667    runs-on: namespace-profile-2x4-ubuntu-2404
668    steps:
669    - name: steps::checkout_repo
670      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
671      with:
672        clean: false
673    - name: steps::cache_rust_dependencies_namespace
674      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
675      with:
676        cache: rust
677        path: ~/.rustup
678    - name: ./script/check-licenses
679      run: ./script/check-licenses
680    - name: ./script/generate-licenses
681      run: ./script/generate-licenses
682  check_scripts:
683    needs:
684    - orchestrate
685    if: needs.orchestrate.outputs.run_action_checks == 'true'
686    runs-on: namespace-profile-2x4-ubuntu-2404
687    steps:
688    - name: steps::checkout_repo
689      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
690      with:
691        clean: false
692    - name: run_tests::check_scripts::run_shellcheck
693      run: ./script/shellcheck-scripts error
694    - id: get_actionlint
695      name: run_tests::check_scripts::download_actionlint
696      run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
697    - name: run_tests::check_scripts::run_actionlint
698      run: '"$ACTIONLINT_BIN" -color'
699      env:
700        ACTIONLINT_BIN: ${{ steps.get_actionlint.outputs.executable }}
701    - name: steps::cache_rust_dependencies_namespace
702      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
703      with:
704        cache: rust
705        path: ~/.rustup
706    - name: run_tests::check_scripts::check_xtask_workflows
707      run: |
708        cargo xtask workflows
709        if ! git diff --exit-code .github; then
710          echo "Error: .github directory has uncommitted changes after running 'cargo xtask workflows'"
711          echo "Please run 'cargo xtask workflows' locally and commit the changes"
712          exit 1
713        fi
714    timeout-minutes: 60
715  check_postgres_and_protobuf_migrations:
716    needs:
717    - orchestrate
718    if: needs.orchestrate.outputs.run_tests == 'true'
719    runs-on: namespace-profile-16x32-ubuntu-2204
720    env:
721      GIT_AUTHOR_NAME: Protobuf Action
722      GIT_AUTHOR_EMAIL: ci@zed.dev
723      GIT_COMMITTER_NAME: Protobuf Action
724      GIT_COMMITTER_EMAIL: ci@zed.dev
725    steps:
726    - name: steps::checkout_repo
727      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
728      with:
729        clean: false
730        fetch-depth: 0
731    - name: run_tests::check_postgres_and_protobuf_migrations::ensure_fresh_merge
732      run: |
733        if [ -z "$GITHUB_BASE_REF" ];
734        then
735          echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> "$GITHUB_ENV"
736        else
737          git checkout -B temp
738          git merge -q "origin/$GITHUB_BASE_REF" -m "merge main into temp"
739          echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> "$GITHUB_ENV"
740        fi
741    - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_setup_action
742      uses: bufbuild/buf-setup-action@v1
743      with:
744        version: v1.29.0
745        github_token: ${{ secrets.GITHUB_TOKEN }}
746    - name: run_tests::check_postgres_and_protobuf_migrations::bufbuild_breaking_action
747      uses: bufbuild/buf-breaking-action@v1
748      with:
749        input: crates/proto/proto/
750        against: https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/
751    - name: run_tests::check_postgres_and_protobuf_migrations::buf_lint
752      run: buf lint crates/proto/proto
753    - name: run_tests::check_postgres_and_protobuf_migrations::check_protobuf_formatting
754      run: buf format --diff --exit-code crates/proto/proto
755    timeout-minutes: 60
756  extension_tests:
757    needs:
758    - orchestrate
759    if: needs.orchestrate.outputs.changed_extensions != '[]'
760    permissions:
761      contents: read
762    strategy:
763      matrix:
764        extension: ${{ fromJson(needs.orchestrate.outputs.changed_extensions) }}
765      fail-fast: false
766      max-parallel: 1
767    uses: ./.github/workflows/extension_tests.yml
768    with:
769      working-directory: ${{ matrix.extension }}
770  tests_pass:
771    needs:
772    - orchestrate
773    - check_style
774    - clippy_windows
775    - clippy_linux
776    - clippy_mac
777    - clippy_mac_x86_64
778    - run_tests_windows
779    - run_tests_linux
780    - run_tests_mac
781    - doctests
782    - check_workspace_binaries
783    - check_wasm
784    - check_dependencies
785    - check_docs
786    - check_licenses
787    - check_scripts
788    - extension_tests
789    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') && always()
790    runs-on: namespace-profile-2x4-ubuntu-2404
791    steps:
792    - name: run_tests::tests_pass
793      run: |
794        set +x
795        EXIT_CODE=0
796
797        check_result() {
798          echo "* $1: $2"
799          if [[ "$2" != "skipped" && "$2" != "success" ]]; then EXIT_CODE=1; fi
800        }
801
802        check_result "orchestrate" "$RESULT_ORCHESTRATE"
803        check_result "check_style" "$RESULT_CHECK_STYLE"
804        check_result "clippy_windows" "$RESULT_CLIPPY_WINDOWS"
805        check_result "clippy_linux" "$RESULT_CLIPPY_LINUX"
806        check_result "clippy_mac" "$RESULT_CLIPPY_MAC"
807        check_result "clippy_mac_x86_64" "$RESULT_CLIPPY_MAC_X86_64"
808        check_result "run_tests_windows" "$RESULT_RUN_TESTS_WINDOWS"
809        check_result "run_tests_linux" "$RESULT_RUN_TESTS_LINUX"
810        check_result "run_tests_mac" "$RESULT_RUN_TESTS_MAC"
811        check_result "doctests" "$RESULT_DOCTESTS"
812        check_result "check_workspace_binaries" "$RESULT_CHECK_WORKSPACE_BINARIES"
813        check_result "check_wasm" "$RESULT_CHECK_WASM"
814        check_result "check_dependencies" "$RESULT_CHECK_DEPENDENCIES"
815        check_result "check_docs" "$RESULT_CHECK_DOCS"
816        check_result "check_licenses" "$RESULT_CHECK_LICENSES"
817        check_result "check_scripts" "$RESULT_CHECK_SCRIPTS"
818        check_result "extension_tests" "$RESULT_EXTENSION_TESTS"
819
820        exit $EXIT_CODE
821      env:
822        RESULT_ORCHESTRATE: ${{ needs.orchestrate.result }}
823        RESULT_CHECK_STYLE: ${{ needs.check_style.result }}
824        RESULT_CLIPPY_WINDOWS: ${{ needs.clippy_windows.result }}
825        RESULT_CLIPPY_LINUX: ${{ needs.clippy_linux.result }}
826        RESULT_CLIPPY_MAC: ${{ needs.clippy_mac.result }}
827        RESULT_CLIPPY_MAC_X86_64: ${{ needs.clippy_mac_x86_64.result }}
828        RESULT_RUN_TESTS_WINDOWS: ${{ needs.run_tests_windows.result }}
829        RESULT_RUN_TESTS_LINUX: ${{ needs.run_tests_linux.result }}
830        RESULT_RUN_TESTS_MAC: ${{ needs.run_tests_mac.result }}
831        RESULT_DOCTESTS: ${{ needs.doctests.result }}
832        RESULT_CHECK_WORKSPACE_BINARIES: ${{ needs.check_workspace_binaries.result }}
833        RESULT_CHECK_WASM: ${{ needs.check_wasm.result }}
834        RESULT_CHECK_DEPENDENCIES: ${{ needs.check_dependencies.result }}
835        RESULT_CHECK_DOCS: ${{ needs.check_docs.result }}
836        RESULT_CHECK_LICENSES: ${{ needs.check_licenses.result }}
837        RESULT_CHECK_SCRIPTS: ${{ needs.check_scripts.result }}
838        RESULT_EXTENSION_TESTS: ${{ needs.extension_tests.result }}
839concurrency:
840  group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
841  cancel-in-progress: true
842defaults:
843  run:
844    shell: bash -euxo pipefail {0}