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