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