ci.yml

  1name: CI
  2
  3on:
  4  push:
  5    branches:
  6      - main
  7      - "v[0-9]+.[0-9]+.x"
  8    tags:
  9      - "v*"
 10
 11  pull_request:
 12    branches:
 13      - "**"
 14
 15concurrency:
 16  # Allow only one workflow per any non-`main` branch.
 17  group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
 18  cancel-in-progress: true
 19
 20env:
 21  CARGO_TERM_COLOR: always
 22  CARGO_INCREMENTAL: 0
 23  RUST_BACKTRACE: 1
 24
 25jobs:
 26  job_spec:
 27    name: Decide which jobs to run
 28    if: github.repository_owner == 'zed-industries'
 29    outputs:
 30      run_tests: ${{ steps.filter.outputs.run_tests }}
 31      run_license: ${{ steps.filter.outputs.run_license }}
 32    runs-on:
 33      - ubuntu-latest
 34    steps:
 35      - name: Checkout repo
 36        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 37        with:
 38          # 350 is arbitrary; ~10days of history on main (5secs); full history is ~25secs
 39          fetch-depth: ${{ github.ref == 'refs/heads/main' && 2 || 350 }}
 40      - name: Fetch git history and generate output filters
 41        id: filter
 42        run: |
 43          if [ -z "$GITHUB_BASE_REF" ]; then
 44            echo "Not in a PR context (i.e., push to main/stable/preview)"
 45            COMPARE_REV=$(git rev-parse HEAD~1)
 46          else
 47            echo "In a PR context comparing to pull_request.base.ref"
 48            git fetch origin "$GITHUB_BASE_REF" --depth=350
 49            COMPARE_REV=$(git merge-base "origin/${GITHUB_BASE_REF}" HEAD)
 50          fi
 51          # Specify anything which should skip full CI in this regex:
 52          # - docs/
 53          # - .github/ISSUE_TEMPLATE/
 54          # - .github/workflows/  (except .github/workflows/ci.yml)
 55          SKIP_REGEX='^(docs/|\.github/(ISSUE_TEMPLATE|workflows/(?!ci)))'
 56          if [[ $(git diff --name-only $COMPARE_REV ${{ github.sha }} | grep -vP "$SKIP_REGEX") ]]; then
 57            echo "run_tests=true" >> $GITHUB_OUTPUT
 58          else
 59            echo "run_tests=false" >> $GITHUB_OUTPUT
 60          fi
 61          if [[ $(git diff --name-only $COMPARE_REV ${{ github.sha }} | grep '^Cargo.lock') ]]; then
 62            echo "run_license=true" >> $GITHUB_OUTPUT
 63          else
 64            echo "run_license=false" >> $GITHUB_OUTPUT
 65          fi
 66
 67  migration_checks:
 68    name: Check Postgres and Protobuf migrations, mergability
 69    needs: [job_spec]
 70    if: |
 71      github.repository_owner == 'zed-industries' &&
 72      needs.job_spec.outputs.run_tests == 'true'
 73    timeout-minutes: 60
 74    runs-on:
 75      - self-hosted
 76      - test
 77    steps:
 78      - name: Checkout repo
 79        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 80        with:
 81          clean: false
 82          fetch-depth: 0 # fetch full history
 83
 84      - name: Remove untracked files
 85        run: git clean -df
 86
 87      - name: Find modified migrations
 88        shell: bash -euxo pipefail {0}
 89        run: |
 90          export SQUAWK_GITHUB_TOKEN=${{ github.token }}
 91          . ./script/squawk
 92
 93      - name: Ensure fresh merge
 94        shell: bash -euxo pipefail {0}
 95        run: |
 96          if [ -z "$GITHUB_BASE_REF" ];
 97          then
 98            echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> $GITHUB_ENV
 99          else
100            git checkout -B temp
101            git merge -q origin/$GITHUB_BASE_REF -m "merge main into temp"
102            echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> $GITHUB_ENV
103          fi
104
105      - uses: bufbuild/buf-setup-action@v1
106        with:
107          version: v1.29.0
108      - uses: bufbuild/buf-breaking-action@v1
109        with:
110          input: "crates/proto/proto/"
111          against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/"
112
113  workspace_hack:
114    timeout-minutes: 60
115    name: Check workspace-hack crate
116    needs: [job_spec]
117    if: |
118      github.repository_owner == 'zed-industries' &&
119      needs.job_spec.outputs.run_tests == 'true'
120    runs-on:
121      - buildjet-8vcpu-ubuntu-2204
122    steps:
123      - name: Checkout repo
124        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
125      - name: Add Rust to the PATH
126        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
127      - name: Install cargo-hakari
128        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
129        with:
130          command: install
131          args: cargo-hakari@0.9.35
132
133      - name: Check workspace-hack Cargo.toml is up-to-date
134        run: |
135          cargo hakari generate --diff || {
136            echo "To fix, run script/update-workspace-hack or script/update-workspace-hack.ps1";
137            false
138          }
139      - name: Check all crates depend on workspace-hack
140        run: |
141          cargo hakari manage-deps --dry-run || {
142            echo "To fix, run script/update-workspace-hack or script/update-workspace-hack.ps1"
143            false
144          }
145
146  style:
147    timeout-minutes: 60
148    name: Check formatting and spelling
149    needs: [job_spec]
150    if: github.repository_owner == 'zed-industries'
151    runs-on:
152      - buildjet-8vcpu-ubuntu-2204
153    steps:
154      - name: Checkout repo
155        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
156
157      - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
158        with:
159          version: 9
160
161      - name: Prettier Check on /docs
162        working-directory: ./docs
163        run: |
164          pnpm dlx prettier@${PRETTIER_VERSION} . --check || {
165            echo "To fix, run from the root of the zed repo:"
166            echo "  cd docs && pnpm dlx prettier@${PRETTIER_VERSION} . --write && cd .."
167            false
168          }
169        env:
170          PRETTIER_VERSION: 3.5.0
171
172      # To support writing comments that they will certainly be revisited.
173      - name: Check for todo! and FIXME comments
174        run: script/check-todos
175
176      - name: Run style checks
177        uses: ./.github/actions/check_style
178
179      - name: Check for typos
180        uses: crate-ci/typos@8e6a4285bcbde632c5d79900a7779746e8b7ea3f # v1.24.6
181        with:
182          config: ./typos.toml
183
184  macos_tests:
185    timeout-minutes: 60
186    name: (macOS) Run Clippy and tests
187    needs: [job_spec]
188    if: |
189      github.repository_owner == 'zed-industries' &&
190      needs.job_spec.outputs.run_tests == 'true'
191    runs-on:
192      - self-hosted
193      - test
194    steps:
195      - name: Checkout repo
196        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
197        with:
198          clean: false
199
200      - name: Configure CI
201        run: |
202          mkdir -p ./../.cargo
203          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
204
205      - name: cargo clippy
206        run: ./script/clippy
207
208      - name: Install cargo-machete
209        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
210        with:
211          command: install
212          args: cargo-machete@0.7.0
213
214      - name: Check unused dependencies
215        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
216        with:
217          command: machete
218
219      - name: Check licenses
220        run: |
221          script/check-licenses
222          if [[ "${{ needs.job_spec.outputs.run_license }}" == "true" ]]; then
223            script/generate-licenses /tmp/zed_licenses_output
224          fi
225
226      - name: Check for new vulnerable dependencies
227        if: github.event_name == 'pull_request'
228        uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8 # v4
229        with:
230          license-check: false
231
232      - name: Run tests
233        uses: ./.github/actions/run_tests
234
235      - name: Build collab
236        run: cargo build -p collab
237
238      - name: Build other binaries and features
239        run: |
240          cargo build --workspace --bins --all-features
241          cargo check -p gpui --features "macos-blade"
242          cargo check -p workspace
243          cargo build -p remote_server
244          cargo check -p gpui --examples
245
246      # Since the macOS runners are stateful, so we need to remove the config file to prevent potential bug.
247      - name: Clean CI config file
248        if: always()
249        run: rm -rf ./../.cargo
250
251  linux_tests:
252    timeout-minutes: 60
253    name: (Linux) Run Clippy and tests
254    needs: [job_spec]
255    if: |
256      github.repository_owner == 'zed-industries' &&
257      needs.job_spec.outputs.run_tests == 'true'
258    runs-on:
259      - buildjet-16vcpu-ubuntu-2204
260    steps:
261      - name: Add Rust to the PATH
262        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
263
264      - name: Checkout repo
265        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
266        with:
267          clean: false
268
269      - name: Cache dependencies
270        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
271        with:
272          save-if: ${{ github.ref == 'refs/heads/main' }}
273          cache-provider: "buildjet"
274
275      - name: Install Linux dependencies
276        run: ./script/linux
277
278      - name: Configure CI
279        run: |
280          mkdir -p ./../.cargo
281          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
282
283      - name: cargo clippy
284        run: ./script/clippy
285
286      - name: Run tests
287        uses: ./.github/actions/run_tests
288
289      - name: Build other binaries and features
290        run: |
291          cargo build -p zed
292          cargo check -p workspace
293          cargo check -p gpui --examples
294
295      # Even the Linux runner is not stateful, in theory there is no need to do this cleanup.
296      # But, to avoid potential issues in the future if we choose to use a stateful Linux runner and forget to add code
297      # to clean up the config file, I’ve included the cleanup code here as a precaution.
298      # While it’s not strictly necessary at this moment, I believe it’s better to err on the side of caution.
299      - name: Clean CI config file
300        if: always()
301        run: rm -rf ./../.cargo
302
303  build_remote_server:
304    timeout-minutes: 60
305    name: (Linux) Build Remote Server
306    needs: [job_spec]
307    if: |
308      github.repository_owner == 'zed-industries' &&
309      needs.job_spec.outputs.run_tests == 'true'
310    runs-on:
311      - buildjet-8vcpu-ubuntu-2204
312    steps:
313      - name: Add Rust to the PATH
314        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
315
316      - name: Checkout repo
317        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
318        with:
319          clean: false
320
321      - name: Cache dependencies
322        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
323        with:
324          save-if: ${{ github.ref == 'refs/heads/main' }}
325          cache-provider: "buildjet"
326
327      - name: Install Clang & Mold
328        run: ./script/remote-server && ./script/install-mold 2.34.0
329
330      - name: Configure CI
331        run: |
332          mkdir -p ./../.cargo
333          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
334
335      - name: Build Remote Server
336        run: cargo build -p remote_server
337
338      - name: Clean CI config file
339        if: always()
340        run: rm -rf ./../.cargo
341
342  windows_clippy:
343    timeout-minutes: 60
344    name: (Windows) Run Clippy
345    needs: [job_spec]
346    if: |
347      github.repository_owner == 'zed-industries' &&
348      needs.job_spec.outputs.run_tests == 'true'
349    runs-on: windows-2025-16
350    steps:
351      # more info here:- https://github.com/rust-lang/cargo/issues/13020
352      - name: Enable longer pathnames for git
353        run: git config --system core.longpaths true
354
355      - name: Checkout repo
356        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
357        with:
358          clean: false
359
360      - name: Create Dev Drive using ReFS
361        run: ./script/setup-dev-driver.ps1
362
363      # actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
364      - name: Copy Git Repo to Dev Drive
365        run: |
366          Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.ZED_WORKSPACE }}" -Recurse
367
368      - name: Cache dependencies
369        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
370        with:
371          save-if: ${{ github.ref == 'refs/heads/main' }}
372          workspaces: ${{ env.ZED_WORKSPACE }}
373          cache-provider: "github"
374
375      - name: Configure CI
376        run: |
377          mkdir -p ${{ env.CARGO_HOME }} -ErrorAction Ignore
378          cp ./.cargo/ci-config.toml ${{ env.CARGO_HOME }}/config.toml
379
380      - name: cargo clippy
381        working-directory: ${{ env.ZED_WORKSPACE }}
382        run: ./script/clippy.ps1
383
384      - name: Check dev drive space
385        working-directory: ${{ env.ZED_WORKSPACE }}
386        # `setup-dev-driver.ps1` creates a 100GB drive, with CI taking up ~45GB of the drive.
387        run: ./script/exit-ci-if-dev-drive-is-full.ps1 95
388
389      # Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
390      - name: Clean CI config file
391        if: always()
392        run: |
393          if (Test-Path "${{ env.CARGO_HOME }}/config.toml") {
394            Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml"  -Force
395          }
396
397  # Windows CI takes twice as long as our other platforms and fast github hosted runners are expensive.
398  # But we still want to do CI, so let's only run tests on main and come back to this when we're
399  # ready to self host our Windows CI (e.g. during the push for full Windows support)
400  windows_tests:
401    timeout-minutes: 60
402    name: (Windows) Run Tests
403    needs: [job_spec]
404    if: |
405      github.repository_owner == 'zed-industries' &&
406      needs.job_spec.outputs.run_tests == 'true'
407    # Use bigger runners for PRs (speed); smaller for async (cost)
408    runs-on: ${{ github.event_name == 'pull_request' && 'windows-2025-32' || 'windows-2025-16' }}
409    steps:
410      # more info here:- https://github.com/rust-lang/cargo/issues/13020
411      - name: Enable longer pathnames for git
412        run: git config --system core.longpaths true
413
414      - name: Checkout repo
415        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
416        with:
417          clean: false
418
419      - name: Create Dev Drive using ReFS
420        run: ./script/setup-dev-driver.ps1
421
422      # actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
423      - name: Copy Git Repo to Dev Drive
424        run: |
425          Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.ZED_WORKSPACE }}" -Recurse
426
427      - name: Cache dependencies
428        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
429        with:
430          save-if: ${{ github.ref == 'refs/heads/main' }}
431          workspaces: ${{ env.ZED_WORKSPACE }}
432          cache-provider: "github"
433
434      - name: Configure CI
435        run: |
436          mkdir -p ${{ env.CARGO_HOME }} -ErrorAction Ignore
437          cp ./.cargo/ci-config.toml ${{ env.CARGO_HOME }}/config.toml
438
439      - name: Run tests
440        uses: ./.github/actions/run_tests_windows
441        with:
442          working-directory: ${{ env.ZED_WORKSPACE }}
443
444      - name: Build Zed
445        working-directory: ${{ env.ZED_WORKSPACE }}
446        run: cargo build
447
448      - name: Check dev drive space
449        working-directory: ${{ env.ZED_WORKSPACE }}
450        # `setup-dev-driver.ps1` creates a 100GB drive, with CI taking up ~45GB of the drive.
451        run: ./script/exit-ci-if-dev-drive-is-full.ps1 95
452
453      # Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
454      - name: Clean CI config file
455        if: always()
456        run: |
457          if (Test-Path "${{ env.CARGO_HOME }}/config.toml") {
458            Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml"  -Force
459          }
460
461  tests_pass:
462    name: Tests Pass
463    runs-on: ubuntu-latest
464    needs:
465      - job_spec
466      - style
467      - migration_checks
468      # run_tests: If adding required tests, add them here and to script below.
469      - workspace_hack
470      - linux_tests
471      - build_remote_server
472      - macos_tests
473      - windows_clippy
474      - windows_tests
475    if: always()
476    steps:
477      - name: Check all tests passed
478        run: |
479          # Check dependent jobs...
480          RET_CODE=0
481          # Always check style
482          [[ "${{ needs.style.result }}" != 'success' ]] && { RET_CODE=1; echo "style tests failed"; }
483
484          # Only check test jobs if they were supposed to run
485          if [[ "${{ needs.job_spec.outputs.run_tests }}" == "true" ]]; then
486            [[ "${{ needs.workspace_hack.result }}"       != 'success' ]] && { RET_CODE=1; echo "Workspace Hack failed"; }
487            [[ "${{ needs.macos_tests.result }}"          != 'success' ]] && { RET_CODE=1; echo "macOS tests failed"; }
488            [[ "${{ needs.linux_tests.result }}"          != 'success' ]] && { RET_CODE=1; echo "Linux tests failed"; }
489            [[ "${{ needs.windows_tests.result }}"        != 'success' ]] && { RET_CODE=1; echo "Windows tests failed"; }
490            [[ "${{ needs.windows_clippy.result }}"       != 'success' ]] && { RET_CODE=1; echo "Windows clippy failed"; }
491            [[ "${{ needs.build_remote_server.result }}"  != 'success' ]] && { RET_CODE=1; echo "Remote server build failed"; }
492            # This check is intentionally disabled. See: https://github.com/zed-industries/zed/pull/28431
493            # [[ "${{ needs.migration_checks.result }}"     != 'success' ]] && { RET_CODE=1; echo "Migration Checks failed"; }
494          fi
495          if [[ "$RET_CODE" -eq 0 ]]; then
496            echo "All tests passed successfully!"
497          fi
498          exit $RET_CODE
499
500  bundle-mac:
501    timeout-minutes: 120
502    name: Create a macOS bundle
503    runs-on:
504      - self-hosted
505      - bundle
506    if: |
507      startsWith(github.ref, 'refs/tags/v')
508      || contains(github.event.pull_request.labels.*.name, 'run-bundling')
509    needs: [macos_tests]
510    env:
511      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
512      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
513      APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
514      APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
515      APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
516      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
517      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
518      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
519      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
520    steps:
521      - name: Install Node
522        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
523        with:
524          node-version: "18"
525
526      - name: Checkout repo
527        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
528        with:
529          # We need to fetch more than one commit so that `script/draft-release-notes`
530          # is able to diff between the current and previous tag.
531          #
532          # 25 was chosen arbitrarily.
533          fetch-depth: 25
534          clean: false
535          ref: ${{ github.ref }}
536
537      - name: Limit target directory size
538        run: script/clear-target-dir-if-larger-than 100
539
540      - name: Determine version and release channel
541        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
542        run: |
543          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
544          script/determine-release-channel
545
546      - name: Draft release notes
547        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
548        run: |
549          mkdir -p target/
550          # Ignore any errors that occur while drafting release notes to not fail the build.
551          script/draft-release-notes "$RELEASE_VERSION" "$RELEASE_CHANNEL" > target/release-notes.md || true
552          script/create-draft-release target/release-notes.md
553        env:
554          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
555
556      - name: Create macOS app bundle
557        run: script/bundle-mac
558
559      - name: Rename binaries
560        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
561        run: |
562          mv target/aarch64-apple-darwin/release/Zed.dmg target/aarch64-apple-darwin/release/Zed-aarch64.dmg
563          mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg
564
565      - name: Upload app bundle (aarch64) to workflow run if main branch or specific label
566        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
567        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
568        with:
569          name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
570          path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg
571
572      - name: Upload app bundle (x86_64) to workflow run if main branch or specific label
573        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
574        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
575        with:
576          name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
577          path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg
578
579      - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
580        name: Upload app bundle to release
581        if: ${{ env.RELEASE_CHANNEL == 'preview' || env.RELEASE_CHANNEL == 'stable' }}
582        with:
583          draft: true
584          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
585          files: |
586            target/zed-remote-server-macos-x86_64.gz
587            target/zed-remote-server-macos-aarch64.gz
588            target/aarch64-apple-darwin/release/Zed-aarch64.dmg
589            target/x86_64-apple-darwin/release/Zed-x86_64.dmg
590        env:
591          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
592
593  bundle-linux-x86_x64:
594    timeout-minutes: 60
595    name: Linux x86_x64 release bundle
596    runs-on:
597      - buildjet-16vcpu-ubuntu-2004 # ubuntu 20.04 for minimal glibc
598    if: |
599      startsWith(github.ref, 'refs/tags/v')
600      || contains(github.event.pull_request.labels.*.name, 'run-bundling')
601    needs: [linux_tests]
602    env:
603      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
604      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
605      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
606      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
607    steps:
608      - name: Checkout repo
609        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
610        with:
611          clean: false
612
613      - name: Install Linux dependencies
614        run: ./script/linux && ./script/install-mold 2.34.0
615
616      - name: Determine version and release channel
617        if: startsWith(github.ref, 'refs/tags/v')
618        run: |
619          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
620          script/determine-release-channel
621
622      - name: Create Linux .tar.gz bundle
623        run: script/bundle-linux
624
625      - name: Upload Artifact to Workflow - zed (run-bundling)
626        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
627        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
628        with:
629          name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz
630          path: target/release/zed-*.tar.gz
631
632      - name: Upload Artifact to Workflow - zed-remote-server (run-bundling)
633        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
634        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
635        with:
636          name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.gz
637          path: target/zed-remote-server-linux-x86_64.gz
638
639      - name: Upload Artifacts to release
640        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
641        if: ${{ !(contains(github.event.pull_request.labels.*.name, 'run-bundling')) }}
642        with:
643          draft: true
644          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
645          files: |
646            target/zed-remote-server-linux-x86_64.gz
647            target/release/zed-linux-x86_64.tar.gz
648        env:
649          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
650
651  bundle-linux-aarch64: # this runs on ubuntu22.04
652    timeout-minutes: 60
653    name: Linux arm64 release bundle
654    runs-on:
655      - buildjet-16vcpu-ubuntu-2204-arm
656    if: |
657      startsWith(github.ref, 'refs/tags/v')
658      || contains(github.event.pull_request.labels.*.name, 'run-bundling')
659    needs: [linux_tests]
660    env:
661      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
662      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
663      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
664      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
665    steps:
666      - name: Checkout repo
667        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
668        with:
669          clean: false
670
671      - name: Install Linux dependencies
672        run: ./script/linux
673
674      - name: Determine version and release channel
675        if: startsWith(github.ref, 'refs/tags/v')
676        run: |
677          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
678          script/determine-release-channel
679
680      - name: Create and upload Linux .tar.gz bundles
681        run: script/bundle-linux
682
683      - name: Upload Artifact to Workflow - zed (run-bundling)
684        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
685        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
686        with:
687          name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz
688          path: target/release/zed-*.tar.gz
689
690      - name: Upload Artifact to Workflow - zed-remote-server (run-bundling)
691        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
692        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
693        with:
694          name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.gz
695          path: target/zed-remote-server-linux-aarch64.gz
696
697      - name: Upload Artifacts to release
698        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
699        if: ${{ !(contains(github.event.pull_request.labels.*.name, 'run-bundling')) }}
700        with:
701          draft: true
702          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
703          files: |
704            target/zed-remote-server-linux-aarch64.gz
705            target/release/zed-linux-aarch64.tar.gz
706        env:
707          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
708
709  nix-build:
710    timeout-minutes: 60
711    name: Nix Build
712    continue-on-error: true
713    if: github.repository_owner == 'zed-industries' && contains(github.event.pull_request.labels.*.name, 'run-nix')
714    strategy:
715      fail-fast: false
716      matrix:
717        system:
718          - os: x86 Linux
719            runner: buildjet-16vcpu-ubuntu-2204
720            install_nix: true
721          - os: arm Mac
722            runner: [macOS, ARM64, test]
723            install_nix: false
724    runs-on: ${{ matrix.system.runner }}
725    env:
726      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
727      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
728      GIT_LFS_SKIP_SMUDGE: 1 # breaks the livekit rust sdk examples which we don't actually depend on
729    steps:
730      - name: Checkout repo
731        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
732        with:
733          clean: false
734      - name: Set path
735        if: ${{ ! matrix.system.install_nix }}
736        run: |
737          echo "/nix/var/nix/profiles/default/bin" >> $GITHUB_PATH
738          echo "/Users/administrator/.nix-profile/bin" >> $GITHUB_PATH
739
740      - uses: cachix/install-nix-action@d1ca217b388ee87b2507a9a93bf01368bde7cec2 # v31
741        if: ${{ matrix.system.install_nix }}
742        with:
743          github_access_token: ${{ secrets.GITHUB_TOKEN }}
744
745      - uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
746        with:
747          name: zed-industries
748          authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
749          skipPush: true
750      - run: nix build .#debug
751      - name: Limit /nix/store to 50GB
752        run: "[ $(du -sm /nix/store | cut -f1) -gt 50000 ] && nix-collect-garbage -d"
753
754  auto-release-preview:
755    name: Auto release preview
756    if: |
757      startsWith(github.ref, 'refs/tags/v')
758      && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre')
759    needs: [bundle-mac, bundle-linux-x86_x64, bundle-linux-aarch64]
760    runs-on:
761      - self-hosted
762      - bundle
763    steps:
764      - name: gh release
765        run: gh release edit $GITHUB_REF_NAME --draft=true
766        env:
767          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}