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