ci.yml

  1name: CI
  2
  3on:
  4  push:
  5    tags:
  6      - "v*"
  7      - "!v00.00.00-test" # todo! remove
  8
  9concurrency:
 10  # Allow only one workflow per any non-`main` branch.
 11  group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
 12  cancel-in-progress: true
 13
 14env:
 15  CARGO_TERM_COLOR: always
 16  CARGO_INCREMENTAL: 0
 17  RUST_BACKTRACE: 1
 18  DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
 19  DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
 20  ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
 21  ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }}
 22
 23jobs:
 24  job_spec:
 25    name: Decide which jobs to run
 26    if: github.repository_owner == 'zed-industries'
 27    outputs:
 28      run_tests: ${{ steps.filter.outputs.run_tests }}
 29      run_license: ${{ steps.filter.outputs.run_license }}
 30      run_docs: ${{ steps.filter.outputs.run_docs }}
 31      run_nix: ${{ steps.filter.outputs.run_nix }}
 32      run_actionlint: ${{ steps.filter.outputs.run_actionlint }}
 33    runs-on:
 34      - namespace-profile-2x4-ubuntu-2404
 35    steps:
 36      - name: Checkout repo
 37        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 38        with:
 39          # 350 is arbitrary; ~10days of history on main (5secs); full history is ~25secs
 40          fetch-depth: ${{ github.ref == 'refs/heads/main' && 2 || 350 }}
 41      - name: Fetch git history and generate output filters
 42        id: filter
 43        run: |
 44          if [ -z "$GITHUB_BASE_REF" ]; then
 45            echo "Not in a PR context (i.e., push to main/stable/preview)"
 46            COMPARE_REV="$(git rev-parse HEAD~1)"
 47          else
 48            echo "In a PR context comparing to pull_request.base.ref"
 49            git fetch origin "$GITHUB_BASE_REF" --depth=350
 50            COMPARE_REV="$(git merge-base "origin/${GITHUB_BASE_REF}" HEAD)"
 51          fi
 52          CHANGED_FILES="$(git diff --name-only "$COMPARE_REV" ${{ github.sha }})"
 53
 54          # Specify anything which should potentially skip full test suite in this regex:
 55          # - docs/
 56          # - script/update_top_ranking_issues/
 57          # - .github/ISSUE_TEMPLATE/
 58          # - .github/workflows/  (except .github/workflows/ci.yml)
 59          SKIP_REGEX='^(docs/|script/update_top_ranking_issues/|\.github/(ISSUE_TEMPLATE|workflows/(?!ci)))'
 60
 61          echo "$CHANGED_FILES" | grep -qvP "$SKIP_REGEX" && \
 62            echo "run_tests=true" >> "$GITHUB_OUTPUT" || \
 63            echo "run_tests=false" >> "$GITHUB_OUTPUT"
 64
 65          echo "$CHANGED_FILES" | grep -qP '^docs/' && \
 66            echo "run_docs=true" >> "$GITHUB_OUTPUT" || \
 67            echo "run_docs=false" >> "$GITHUB_OUTPUT"
 68
 69          echo "$CHANGED_FILES" | grep -qP '^\.github/(workflows/|actions/|actionlint.yml)' && \
 70            echo "run_actionlint=true" >> "$GITHUB_OUTPUT" || \
 71            echo "run_actionlint=false" >> "$GITHUB_OUTPUT"
 72
 73          echo "$CHANGED_FILES" | grep -qP '^(Cargo.lock|script/.*licenses)' && \
 74            echo "run_license=true" >> "$GITHUB_OUTPUT" || \
 75            echo "run_license=false" >> "$GITHUB_OUTPUT"
 76
 77          echo "$CHANGED_FILES" | grep -qP '^(nix/|flake\.|Cargo\.|rust-toolchain.toml|\.cargo/config.toml)' && \
 78            echo "$GITHUB_REF_NAME" | grep -qvP '^v[0-9]+\.[0-9]+\.[0-9x](-pre)?$' && \
 79            echo "run_nix=true" >> "$GITHUB_OUTPUT" || \
 80            echo "run_nix=false" >> "$GITHUB_OUTPUT"
 81
 82  migration_checks:
 83    name: Check Postgres and Protobuf migrations, mergability
 84    needs: [job_spec]
 85    if: |
 86      github.repository_owner == 'zed-industries' &&
 87      needs.job_spec.outputs.run_tests == 'true'
 88    timeout-minutes: 60
 89    runs-on:
 90      - self-mini-macos
 91    steps:
 92      - name: Checkout repo
 93        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 94        with:
 95          clean: false
 96          fetch-depth: 0 # fetch full history
 97
 98      - name: Remove untracked files
 99        run: git clean -df
100
101      - name: Find modified migrations
102        shell: bash -euxo pipefail {0}
103        run: |
104          export SQUAWK_GITHUB_TOKEN=${{ github.token }}
105          . ./script/squawk
106
107      - name: Ensure fresh merge
108        shell: bash -euxo pipefail {0}
109        run: |
110          if [ -z "$GITHUB_BASE_REF" ];
111          then
112            echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> "$GITHUB_ENV"
113          else
114            git checkout -B temp
115            git merge -q "origin/$GITHUB_BASE_REF" -m "merge main into temp"
116            echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> "$GITHUB_ENV"
117          fi
118
119      - uses: bufbuild/buf-setup-action@v1
120        with:
121          version: v1.29.0
122      - uses: bufbuild/buf-breaking-action@v1
123        with:
124          input: "crates/proto/proto/"
125          against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/"
126
127  style:
128    timeout-minutes: 60
129    name: Check formatting and spelling
130    needs: [job_spec]
131    if: github.repository_owner == 'zed-industries'
132    runs-on:
133      - namespace-profile-4x8-ubuntu-2204
134    steps:
135      - name: Checkout repo
136        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
137
138      - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
139        with:
140          version: 9
141
142      - name: Prettier Check on /docs
143        working-directory: ./docs
144        run: |
145          pnpm dlx "prettier@${PRETTIER_VERSION}" . --check || {
146            echo "To fix, run from the root of the Zed repo:"
147            echo "  cd docs && pnpm dlx prettier@${PRETTIER_VERSION} . --write && cd .."
148            false
149          }
150        env:
151          PRETTIER_VERSION: 3.5.0
152
153      - name: Prettier Check on default.json
154        run: |
155          pnpm dlx "prettier@${PRETTIER_VERSION}" assets/settings/default.json --check || {
156            echo "To fix, run from the root of the Zed repo:"
157            echo "  pnpm dlx prettier@${PRETTIER_VERSION} assets/settings/default.json --write"
158            false
159          }
160        env:
161          PRETTIER_VERSION: 3.5.0
162
163      # To support writing comments that they will certainly be revisited.
164      - name: Check for todo! and FIXME comments
165        run: script/check-todos
166
167      - name: Check modifier use in keymaps
168        run: script/check-keymaps
169
170      - name: Run style checks
171        uses: ./.github/actions/check_style
172
173      - name: Check for typos
174        uses: crate-ci/typos@80c8a4945eec0f6d464eaf9e65ed98ef085283d1 # v1.38.1
175        with:
176          config: ./typos.toml
177
178  check_docs:
179    timeout-minutes: 60
180    name: Check docs
181    needs: [job_spec]
182    if: |
183      github.repository_owner == 'zed-industries' &&
184      (needs.job_spec.outputs.run_tests == 'true' || needs.job_spec.outputs.run_docs == 'true')
185    runs-on:
186      - namespace-profile-8x16-ubuntu-2204
187    steps:
188      - name: Checkout repo
189        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
190        with:
191          clean: false
192
193      - name: Configure CI
194        run: |
195          mkdir -p ./../.cargo
196          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
197
198      - name: Build docs
199        uses: ./.github/actions/build_docs
200
201  actionlint:
202    runs-on: namespace-profile-2x4-ubuntu-2404
203    if: github.repository_owner == 'zed-industries' && needs.job_spec.outputs.run_actionlint == 'true'
204    needs: [job_spec]
205    steps:
206      - uses: actions/checkout@v4
207      - name: Download actionlint
208        id: get_actionlint
209        run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
210        shell: bash
211      - name: Check workflow files
212        run: ${{ steps.get_actionlint.outputs.executable }} -color
213        shell: bash
214
215  macos_tests:
216    timeout-minutes: 60
217    name: (macOS) Run Clippy and tests
218    needs: [job_spec]
219    if: |
220      github.repository_owner == 'zed-industries' &&
221      needs.job_spec.outputs.run_tests == 'true'
222    runs-on:
223      - self-mini-macos
224    steps:
225      - name: Checkout repo
226        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
227        with:
228          clean: false
229
230      - name: Configure CI
231        run: |
232          mkdir -p ./../.cargo
233          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
234
235      - name: Check that Cargo.lock is up to date
236        run: |
237          cargo update --locked --workspace
238
239      - name: cargo clippy
240        run: ./script/clippy
241
242      - name: Install cargo-machete
243        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
244        with:
245          command: install
246          args: cargo-machete@0.7.0
247
248      - name: Check unused dependencies
249        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
250        with:
251          command: machete
252
253      - name: Check licenses
254        run: |
255          script/check-licenses
256          if [[ "${{ needs.job_spec.outputs.run_license }}" == "true" ]]; then
257            script/generate-licenses /tmp/zed_licenses_output
258          fi
259
260      - name: Check for new vulnerable dependencies
261        if: github.event_name == 'pull_request'
262        uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8 # v4
263        with:
264          license-check: false
265
266      - name: Run tests
267        uses: ./.github/actions/run_tests
268
269      - name: Build collab
270        # we should do this on a linux x86 machinge
271        run: cargo build -p collab
272
273      - name: Build other binaries and features
274        run: |
275          cargo build --workspace --bins --examples
276
277      # Since the macOS runners are stateful, so we need to remove the config file to prevent potential bug.
278      - name: Clean CI config file
279        if: always()
280        run: rm -rf ./../.cargo
281
282  linux_tests:
283    timeout-minutes: 60
284    name: (Linux) Run Clippy and tests
285    needs: [job_spec]
286    if: |
287      github.repository_owner == 'zed-industries' &&
288      needs.job_spec.outputs.run_tests == 'true'
289    runs-on:
290      - namespace-profile-16x32-ubuntu-2204
291    steps:
292      - name: Add Rust to the PATH
293        run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
294
295      - name: Checkout repo
296        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
297        with:
298          clean: false
299
300      - name: Cache dependencies
301        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
302        with:
303          save-if: ${{ github.ref == 'refs/heads/main' }}
304          # cache-provider: "buildjet"
305
306      - name: Install Linux dependencies
307        run: ./script/linux
308
309      - name: Configure CI
310        run: |
311          mkdir -p ./../.cargo
312          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
313
314      - name: cargo clippy
315        run: ./script/clippy
316
317      - name: Run tests
318        uses: ./.github/actions/run_tests
319
320      - name: Build other binaries and features
321        run: |
322          cargo build -p zed
323          cargo check -p workspace
324          cargo check -p gpui --examples
325
326      # Even the Linux runner is not stateful, in theory there is no need to do this cleanup.
327      # But, to avoid potential issues in the future if we choose to use a stateful Linux runner and forget to add code
328      # to clean up the config file, I’ve included the cleanup code here as a precaution.
329      # While it’s not strictly necessary at this moment, I believe it’s better to err on the side of caution.
330      - name: Clean CI config file
331        if: always()
332        run: rm -rf ./../.cargo
333
334  doctests:
335    # Nextest currently doesn't support doctests, so run them separately and in parallel.
336    timeout-minutes: 60
337    name: (Linux) Run doctests
338    needs: [job_spec]
339    if: |
340      github.repository_owner == 'zed-industries' &&
341      needs.job_spec.outputs.run_tests == 'true'
342    runs-on:
343      - namespace-profile-16x32-ubuntu-2204
344    steps:
345      - name: Add Rust to the PATH
346        run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
347
348      - name: Checkout repo
349        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
350        with:
351          clean: false
352
353      - name: Cache dependencies
354        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
355        with:
356          save-if: ${{ github.ref == 'refs/heads/main' }}
357          # cache-provider: "buildjet"
358
359      - name: Install Linux dependencies
360        run: ./script/linux
361
362      - name: Configure CI
363        run: |
364          mkdir -p ./../.cargo
365          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
366
367      - name: Run doctests
368        run: cargo test --workspace --doc --no-fail-fast
369
370      - name: Clean CI config file
371        if: always()
372        run: rm -rf ./../.cargo
373
374  build_remote_server:
375    timeout-minutes: 60
376    name: (Linux) Build Remote Server
377    needs: [job_spec]
378    if: |
379      github.repository_owner == 'zed-industries' &&
380      needs.job_spec.outputs.run_tests == 'true'
381    runs-on:
382      - namespace-profile-16x32-ubuntu-2204
383    steps:
384      - name: Add Rust to the PATH
385        run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
386
387      - name: Checkout repo
388        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
389        with:
390          clean: false
391
392      - name: Cache dependencies
393        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
394        with:
395          save-if: ${{ github.ref == 'refs/heads/main' }}
396          # cache-provider: "buildjet"
397
398      - name: Install Clang & Mold
399        run: ./script/remote-server && ./script/install-mold 2.34.0
400
401      - name: Configure CI
402        run: |
403          mkdir -p ./../.cargo
404          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
405
406      - name: Build Remote Server
407        run: cargo build -p remote_server
408
409      - name: Clean CI config file
410        if: always()
411        run: rm -rf ./../.cargo
412
413  windows_tests:
414    timeout-minutes: 60
415    name: (Windows) Run Clippy and tests
416    needs: [job_spec]
417    if: |
418      github.repository_owner == 'zed-industries' &&
419      needs.job_spec.outputs.run_tests == 'true'
420    runs-on: [self-32vcpu-windows-2022]
421    steps:
422      - name: Environment Setup
423        run: |
424          $RunnerDir = Split-Path -Parent $env:RUNNER_WORKSPACE
425          Write-Output `
426            "RUSTUP_HOME=$RunnerDir\.rustup" `
427            "CARGO_HOME=$RunnerDir\.cargo" `
428            "PATH=$RunnerDir\.cargo\bin;$env:PATH" `
429          >> $env:GITHUB_ENV
430
431      - name: Checkout repo
432        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
433        with:
434          clean: false
435
436      - name: Configure CI
437        run: |
438          New-Item -ItemType Directory -Path "./../.cargo" -Force
439          Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
440
441      - name: cargo clippy
442        run: |
443          .\script\clippy.ps1
444
445      - name: Run tests
446        uses: ./.github/actions/run_tests_windows
447
448      - name: Build Zed
449        run: cargo build
450
451      - name: Limit target directory size
452        run: ./script/clear-target-dir-if-larger-than.ps1 250
453
454      - name: Clean CI config file
455        if: always()
456        run: Remove-Item -Recurse -Path "./../.cargo" -Force -ErrorAction SilentlyContinue
457
458  tests_pass:
459    name: Tests Pass
460    runs-on: namespace-profile-2x4-ubuntu-2404
461    needs:
462      - job_spec
463      - style
464      - check_docs
465      - actionlint
466      - migration_checks
467      # run_tests: If adding required tests, add them here and to script below.
468      - linux_tests
469      - build_remote_server
470      - macos_tests
471      - windows_tests
472    if: |
473      github.repository_owner == 'zed-industries' &&
474      always()
475    steps:
476      - name: Check all tests passed
477        run: |
478          # Check dependent jobs...
479          RET_CODE=0
480          # Always check style
481          [[ "${{ needs.style.result }}"      != 'success' ]] && { RET_CODE=1; echo "style tests failed"; }
482
483          if [[ "${{ needs.job_spec.outputs.run_docs }}" == "true" ]]; then
484            [[ "${{ needs.check_docs.result }}" != 'success' ]] && { RET_CODE=1; echo "docs checks failed"; }
485          fi
486
487          if [[ "${{ needs.job_spec.outputs.run_actionlint }}" == "true" ]]; then
488            [[ "${{ needs.actionlint.result }}" != 'success' ]] && { RET_CODE=1; echo "actionlint checks failed"; }
489          fi
490
491          # Only check test jobs if they were supposed to run
492          if [[ "${{ needs.job_spec.outputs.run_tests }}" == "true" ]]; then
493            [[ "${{ needs.macos_tests.result }}"          != 'success' ]] && { RET_CODE=1; echo "macOS tests failed"; }
494            [[ "${{ needs.linux_tests.result }}"          != 'success' ]] && { RET_CODE=1; echo "Linux tests failed"; }
495            [[ "${{ needs.windows_tests.result }}"        != 'success' ]] && { RET_CODE=1; echo "Windows tests failed"; }
496            [[ "${{ needs.build_remote_server.result }}"  != 'success' ]] && { RET_CODE=1; echo "Remote server build failed"; }
497            # This check is intentionally disabled. See: https://github.com/zed-industries/zed/pull/28431
498            # [[ "${{ needs.migration_checks.result }}"     != 'success' ]] && { RET_CODE=1; echo "Migration Checks failed"; }
499          fi
500          if [[ "$RET_CODE" -eq 0 ]]; then
501            echo "All tests passed successfully!"
502          fi
503          exit $RET_CODE
504
505  bundle-mac:
506    timeout-minutes: 120
507    name: Create a macOS bundle
508    runs-on:
509      - self-mini-macos
510    if: startsWith(github.ref, 'refs/tags/v')
511    needs: [macos_tests]
512    env:
513      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
514      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
515      APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
516      APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
517      APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
518    steps:
519      - name: Install Node
520        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
521        with:
522          node-version: "18"
523
524      - name: Setup Sentry CLI
525        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
526        with:
527          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
528
529      - name: Checkout repo
530        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
531        with:
532          # We need to fetch more than one commit so that `script/draft-release-notes`
533          # is able to diff between the current and previous tag.
534          #
535          # 25 was chosen arbitrarily.
536          fetch-depth: 25
537          clean: false
538          ref: ${{ github.ref }}
539
540      - name: Limit target directory size
541        run: script/clear-target-dir-if-larger-than 300
542
543      - name: Determine version and release channel
544        run: |
545          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
546          script/determine-release-channel
547
548      - name: Draft release notes
549        run: |
550          mkdir -p target/
551          # Ignore any errors that occur while drafting release notes to not fail the build.
552          script/draft-release-notes "$RELEASE_VERSION" "$RELEASE_CHANNEL" > target/release-notes.md || true
553          script/create-draft-release target/release-notes.md
554        env:
555          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
556
557      - name: Create macOS app bundle (aarch64)
558        run: script/bundle-mac aarch64-apple-darwin
559
560      - name: Create macOS app bundle (x64)
561        run: script/bundle-mac x86_64-apple-darwin
562
563      - name: Rename binaries
564        run: |
565          mv target/aarch64-apple-darwin/release/Zed.dmg target/aarch64-apple-darwin/release/Zed-aarch64.dmg
566          mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg
567
568      - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
569        name: Upload app bundle to release
570        if: ${{ env.RELEASE_CHANNEL == 'preview' || env.RELEASE_CHANNEL == 'stable' }}
571        with:
572          draft: true
573          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
574          files: |
575            target/zed-remote-server-macos-x86_64.gz
576            target/zed-remote-server-macos-aarch64.gz
577            target/aarch64-apple-darwin/release/Zed-aarch64.dmg
578            target/x86_64-apple-darwin/release/Zed-x86_64.dmg
579        env:
580          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
581
582  bundle-linux-x86_x64:
583    timeout-minutes: 60
584    name: Linux x86_x64 release bundle
585    runs-on:
586      - namespace-profile-16x32-ubuntu-2004 # ubuntu 20.04 for minimal glibc
587    if: |
588      ( startsWith(github.ref, 'refs/tags/v') )
589    needs: [linux_tests]
590    steps:
591      - name: Checkout repo
592        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
593        with:
594          clean: false
595
596      - name: Install Linux dependencies
597        run: ./script/linux && ./script/install-mold 2.34.0
598
599      - name: Setup Sentry CLI
600        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
601        with:
602          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
603
604      - name: Determine version and release channel
605        run: |
606          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
607          script/determine-release-channel
608
609      - name: Create Linux .tar.gz bundle
610        run: script/bundle-linux
611
612      - name: Upload Artifacts to release
613        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
614        with:
615          draft: true
616          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
617          files: |
618            target/zed-remote-server-linux-x86_64.gz
619            target/release/zed-linux-x86_64.tar.gz
620        env:
621          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
622
623  bundle-linux-aarch64: # this runs on ubuntu22.04
624    timeout-minutes: 60
625    name: Linux arm64 release bundle
626    runs-on:
627      - namespace-profile-8x32-ubuntu-2004-arm-m4 # ubuntu 20.04 for minimal glibc
628    if: |
629      startsWith(github.ref, 'refs/tags/v')
630    needs: [linux_tests]
631    steps:
632      - name: Checkout repo
633        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
634        with:
635          clean: false
636
637      - name: Install Linux dependencies
638        run: ./script/linux
639
640      - name: Setup Sentry CLI
641        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
642        with:
643          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
644
645      - name: Determine version and release channel
646        run: |
647          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
648          script/determine-release-channel
649
650      - name: Create and upload Linux .tar.gz bundles
651        run: script/bundle-linux
652
653      - name: Upload Artifacts to release
654        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
655        with:
656          draft: true
657          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
658          files: |
659            target/zed-remote-server-linux-aarch64.gz
660            target/release/zed-linux-aarch64.tar.gz
661        env:
662          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
663
664  freebsd:
665    timeout-minutes: 60
666    runs-on: github-8vcpu-ubuntu-2404
667    if: |
668      false && ( startsWith(github.ref, 'refs/tags/v') )
669    needs: [linux_tests]
670    name: Build Zed on FreeBSD
671    steps:
672      - uses: actions/checkout@v4
673      - name: Build FreeBSD remote-server
674        id: freebsd-build
675        uses: vmactions/freebsd-vm@c3ae29a132c8ef1924775414107a97cac042aad5 # v1.2.0
676        with:
677          usesh: true
678          release: 13.5
679          copyback: true
680          prepare: |
681            pkg install -y \
682              bash curl jq git \
683              rustup-init cmake-core llvm-devel-lite pkgconf protobuf # ibx11 alsa-lib rust-bindgen-cli
684          run: |
685            freebsd-version
686            sysctl hw.model
687            sysctl hw.ncpu
688            sysctl hw.physmem
689            sysctl hw.usermem
690            git config --global --add safe.directory /home/runner/work/zed/zed
691            rustup-init --profile minimal --default-toolchain none -y
692            . "$HOME/.cargo/env"
693            ./script/bundle-freebsd
694            mkdir -p out/
695            mv "target/zed-remote-server-freebsd-x86_64.gz" out/
696            rm -rf target/
697            cargo clean
698
699      - name: Upload Artifact to Workflow - zed-remote-server (run-bundling)
700        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
701        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
702        with:
703          name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-freebsd.gz
704          path: out/zed-remote-server-freebsd-x86_64.gz
705
706      - name: Upload Artifacts to release
707        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
708        if: ${{ !(contains(github.event.pull_request.labels.*.name, 'run-bundling')) }}
709        with:
710          draft: true
711          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
712          files: |
713            out/zed-remote-server-freebsd-x86_64.gz
714        env:
715          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
716
717  nix-build:
718    name: Build with Nix
719    uses: ./.github/workflows/nix_build.yml
720    needs: [job_spec]
721    if: github.repository_owner == 'zed-industries' &&
722      (contains(github.event.pull_request.labels.*.name, 'run-nix') ||
723      needs.job_spec.outputs.run_nix == 'true')
724    secrets: inherit
725
726  bundle-windows-x64:
727    timeout-minutes: 120
728    name: Create a Windows installer for x86_64
729    runs-on: [self-32vcpu-windows-2022]
730    if: |
731      ( startsWith(github.ref, 'refs/tags/v') )
732    needs: [windows_tests]
733    env:
734      AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
735      AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
736      AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
737      ACCOUNT_NAME: ${{ vars.AZURE_SIGNING_ACCOUNT_NAME }}
738      CERT_PROFILE_NAME: ${{ vars.AZURE_SIGNING_CERT_PROFILE_NAME }}
739      ENDPOINT: ${{ vars.AZURE_SIGNING_ENDPOINT }}
740      FILE_DIGEST: SHA256
741      TIMESTAMP_DIGEST: SHA256
742      TIMESTAMP_SERVER: "http://timestamp.acs.microsoft.com"
743    steps:
744      - name: Checkout repo
745        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
746        with:
747          clean: false
748
749      - name: Setup Sentry CLI
750        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
751        with:
752          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
753
754      - name: Determine version and release channel
755        working-directory: ${{ env.ZED_WORKSPACE }}
756        run: |
757          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
758          script/determine-release-channel.ps1
759
760      - name: Build Zed installer
761        working-directory: ${{ env.ZED_WORKSPACE }}
762        run: script/bundle-windows.ps1
763
764      - name: Upload Artifacts to release
765        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
766        with:
767          draft: true
768          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
769          files: ${{ env.SETUP_PATH }}
770        env:
771          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
772
773  bundle-windows-aarch64:
774    timeout-minutes: 120
775    name: Create a Windows installer for aarch64
776    runs-on: [self-32vcpu-windows-2022]
777    if: |
778      ( startsWith(github.ref, 'refs/tags/v') )
779    needs: [windows_tests]
780    env:
781      AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
782      AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
783      AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
784      ACCOUNT_NAME: ${{ vars.AZURE_SIGNING_ACCOUNT_NAME }}
785      CERT_PROFILE_NAME: ${{ vars.AZURE_SIGNING_CERT_PROFILE_NAME }}
786      ENDPOINT: ${{ vars.AZURE_SIGNING_ENDPOINT }}
787      FILE_DIGEST: SHA256
788      TIMESTAMP_DIGEST: SHA256
789      TIMESTAMP_SERVER: "http://timestamp.acs.microsoft.com"
790    steps:
791      - name: Checkout repo
792        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
793        with:
794          clean: false
795
796      - name: Setup Sentry CLI
797        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
798        with:
799          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
800
801      - name: Determine version and release channel
802        working-directory: ${{ env.ZED_WORKSPACE }}
803        run: |
804          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
805          script/determine-release-channel.ps1
806
807      - name: Build Zed installer
808        working-directory: ${{ env.ZED_WORKSPACE }}
809        run: script/bundle-windows.ps1 -Architecture aarch64
810
811      - name: Upload Artifacts to release
812        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
813        with:
814          draft: true
815          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
816          files: ${{ env.SETUP_PATH }}
817        env:
818          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
819
820  auto-release-preview:
821    name: Auto release preview
822    if: |
823      false
824      && startsWith(github.ref, 'refs/tags/v')
825      && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre')
826    needs: [bundle-mac, bundle-linux-x86_x64, bundle-linux-aarch64, bundle-windows-x64, bundle-windows-aarch64]
827    runs-on:
828      - self-mini-macos
829    steps:
830      - name: gh release
831        run: gh release edit "$GITHUB_REF_NAME" --draft=false
832        env:
833          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
834
835      - name: Create Sentry release
836        uses: getsentry/action-release@526942b68292201ac6bbb99b9a0747d4abee354c # v3
837        env:
838          SENTRY_ORG: zed-dev
839          SENTRY_PROJECT: zed
840          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
841        with:
842          environment: production