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