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