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