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