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