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 migration_checks:
27 name: Check Postgres and Protobuf migrations, mergability
28 if: github.repository_owner == 'zed-industries'
29 timeout-minutes: 60
30 runs-on:
31 - self-hosted
32 - test
33 steps:
34 - name: Checkout repo
35 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
36 with:
37 clean: false
38 fetch-depth: 0 # fetch full history
39
40 - name: Remove untracked files
41 run: git clean -df
42
43 - name: Find modified migrations
44 shell: bash -euxo pipefail {0}
45 run: |
46 export SQUAWK_GITHUB_TOKEN=${{ github.token }}
47 . ./script/squawk
48
49 - name: Ensure fresh merge
50 shell: bash -euxo pipefail {0}
51 run: |
52 if [ -z "$GITHUB_BASE_REF" ];
53 then
54 echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> $GITHUB_ENV
55 else
56 git checkout -B temp
57 git merge -q origin/$GITHUB_BASE_REF -m "merge main into temp"
58 echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> $GITHUB_ENV
59 fi
60
61 - uses: bufbuild/buf-setup-action@v1
62 with:
63 version: v1.29.0
64 - uses: bufbuild/buf-breaking-action@v1
65 with:
66 input: "crates/proto/proto/"
67 against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/"
68
69 style:
70 timeout-minutes: 60
71 name: Check formatting and spelling
72 if: github.repository_owner == 'zed-industries'
73 runs-on:
74 - buildjet-8vcpu-ubuntu-2204
75 steps:
76 - name: Checkout repo
77 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
78
79 # To support writing comments that they will certainly be revisited.
80 - name: Check for todo! and FIXME comments
81 run: script/check-todos
82
83 - name: Run style checks
84 uses: ./.github/actions/check_style
85
86 - name: Check for typos
87 uses: crate-ci/typos@8e6a4285bcbde632c5d79900a7779746e8b7ea3f # v1.24.6
88 with:
89 config: ./typos.toml
90
91 macos_tests:
92 timeout-minutes: 60
93 name: (macOS) Run Clippy and tests
94 if: github.repository_owner == 'zed-industries'
95 runs-on:
96 - self-hosted
97 - test
98 steps:
99 - name: Checkout repo
100 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
101 with:
102 clean: false
103
104 - name: Configure CI
105 run: |
106 mkdir -p ./../.cargo
107 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
108
109 - name: cargo clippy
110 run: ./script/clippy
111
112 - name: Install cargo-machete
113 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
114 with:
115 command: install
116 args: cargo-machete@0.7.0
117
118 - name: Check unused dependencies
119 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
120 with:
121 command: machete
122
123 - name: Check licenses
124 run: |
125 script/check-licenses
126 script/generate-licenses /tmp/zed_licenses_output
127
128 - name: Check for new vulnerable dependencies
129 if: github.event_name == 'pull_request'
130 uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4
131 with:
132 license-check: false
133
134 - name: Run tests
135 uses: ./.github/actions/run_tests
136
137 - name: Build collab
138 run: cargo build -p collab
139
140 - name: Build other binaries and features
141 run: |
142 cargo build --workspace --bins --all-features
143 cargo check -p gpui --features "macos-blade"
144 cargo check -p workspace
145 cargo build -p remote_server
146 cargo check -p gpui --examples
147 script/check-rust-livekit-macos
148
149 # Since the macOS runners are stateful, so we need to remove the config file to prevent potential bug.
150 - name: Clean CI config file
151 if: always()
152 run: rm -rf ./../.cargo
153
154 linux_tests:
155 timeout-minutes: 60
156 name: (Linux) Run Clippy and tests
157 if: github.repository_owner == 'zed-industries'
158 runs-on:
159 - buildjet-16vcpu-ubuntu-2204
160 steps:
161 - name: Add Rust to the PATH
162 run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
163
164 - name: Checkout repo
165 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
166 with:
167 clean: false
168
169 - name: Cache dependencies
170 uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
171 with:
172 save-if: ${{ github.ref == 'refs/heads/main' }}
173 cache-provider: "buildjet"
174
175 - name: Install Linux dependencies
176 run: ./script/linux
177
178 - name: Configure CI
179 run: |
180 mkdir -p ./../.cargo
181 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
182
183 - name: cargo clippy
184 run: ./script/clippy
185
186 - name: Run tests
187 uses: ./.github/actions/run_tests
188
189 - name: Build other binaries and features
190 run: |
191 cargo build -p zed
192 cargo check -p workspace
193 cargo check -p gpui --examples
194
195 # Even the Linux runner is not stateful, in theory there is no need to do this cleanup.
196 # But, to avoid potential issues in the future if we choose to use a stateful Linux runner and forget to add code
197 # to clean up the config file, I’ve included the cleanup code here as a precaution.
198 # While it’s not strictly necessary at this moment, I believe it’s better to err on the side of caution.
199 - name: Clean CI config file
200 if: always()
201 run: rm -rf ./../.cargo
202
203 build_remote_server:
204 timeout-minutes: 60
205 name: (Linux) Build Remote Server
206 if: github.repository_owner == 'zed-industries'
207 runs-on:
208 - buildjet-16vcpu-ubuntu-2204
209 steps:
210 - name: Add Rust to the PATH
211 run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
212
213 - name: Checkout repo
214 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
215 with:
216 clean: false
217
218 - name: Cache dependencies
219 uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
220 with:
221 save-if: ${{ github.ref == 'refs/heads/main' }}
222 cache-provider: "buildjet"
223
224 - name: Install Clang & Mold
225 run: ./script/remote-server && ./script/install-mold 2.34.0
226
227 - name: Configure CI
228 run: |
229 mkdir -p ./../.cargo
230 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
231
232 - name: Build Remote Server
233 run: cargo build -p remote_server
234
235 - name: Clean CI config file
236 if: always()
237 run: rm -rf ./../.cargo
238
239 windows_tests:
240 timeout-minutes: 60
241 name: (Windows) Run Clippy and tests
242 if: github.repository_owner == 'zed-industries'
243 runs-on: hosted-windows-1
244 steps:
245 # more info here:- https://github.com/rust-lang/cargo/issues/13020
246 - name: Enable longer pathnames for git
247 run: git config --system core.longpaths true
248
249 - name: Checkout repo
250 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
251 with:
252 clean: false
253
254 - name: Create Dev Drive using ReFS
255 run: ./script/setup-dev-driver.ps1
256
257 # actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
258 - name: Copy Git Repo to Dev Drive
259 run: |
260 Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.ZED_WORKSPACE }}" -Recurse
261
262 - name: Cache dependencies
263 uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
264 with:
265 save-if: ${{ github.ref == 'refs/heads/main' }}
266 workspaces: ${{ env.ZED_WORKSPACE }}
267 cache-provider: "github"
268
269 - name: Configure CI
270 run: |
271 mkdir -p ${{ env.CARGO_HOME }} -ErrorAction Ignore
272 cp ./.cargo/ci-config.toml ${{ env.CARGO_HOME }}/config.toml
273
274 - name: cargo clippy
275 working-directory: ${{ env.ZED_WORKSPACE }}
276 # Windows can't run shell scripts, so we need to use `cargo xtask`.
277 run: cargo xtask clippy
278
279 - name: Run tests
280 uses: ./.github/actions/run_tests_windows
281 with:
282 working-directory: ${{ env.ZED_WORKSPACE }}
283
284 - name: Build Zed
285 working-directory: ${{ env.ZED_WORKSPACE }}
286 run: cargo build
287
288 - name: Check dev drive space
289 working-directory: ${{ env.ZED_WORKSPACE }}
290 # `setup-dev-driver.ps1` creates a 100GB drive, with CI taking up ~45GB of the drive.
291 run: ./script/exit-ci-if-dev-drive-is-full.ps1 95
292
293 # Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
294 - name: Clean CI config file
295 if: always()
296 run: Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml" -Force
297
298 bundle-mac:
299 timeout-minutes: 120
300 name: Create a macOS bundle
301 runs-on:
302 - self-hosted
303 - bundle
304 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
305 needs: [macos_tests]
306 env:
307 MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
308 MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
309 APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
310 APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
311 APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
312 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
313 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
314 DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
315 DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
316 steps:
317 - name: Install Node
318 uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
319 with:
320 node-version: "18"
321
322 - name: Checkout repo
323 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
324 with:
325 # We need to fetch more than one commit so that `script/draft-release-notes`
326 # is able to diff between the current and previous tag.
327 #
328 # 25 was chosen arbitrarily.
329 fetch-depth: 25
330 clean: false
331 ref: ${{ github.ref }}
332
333 - name: Limit target directory size
334 run: script/clear-target-dir-if-larger-than 100
335
336 - name: Determine version and release channel
337 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
338 run: |
339 # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
340 script/determine-release-channel
341
342 - name: Draft release notes
343 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
344 run: |
345 mkdir -p target/
346 # Ignore any errors that occur while drafting release notes to not fail the build.
347 script/draft-release-notes "$RELEASE_VERSION" "$RELEASE_CHANNEL" > target/release-notes.md || true
348 script/create-draft-release target/release-notes.md
349 env:
350 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
351
352 - name: Create macOS app bundle
353 run: script/bundle-mac
354
355 - name: Rename binaries
356 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
357 run: |
358 mv target/aarch64-apple-darwin/release/Zed.dmg target/aarch64-apple-darwin/release/Zed-aarch64.dmg
359 mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg
360
361 - name: Upload app bundle (aarch64) to workflow run if main branch or specific label
362 uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
363 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
364 with:
365 name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
366 path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg
367
368 - name: Upload app bundle (x86_64) to workflow run if main branch or specific label
369 uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
370 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
371 with:
372 name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
373 path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg
374
375 - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
376 name: Upload app bundle to release
377 if: ${{ env.RELEASE_CHANNEL == 'preview' || env.RELEASE_CHANNEL == 'stable' }}
378 with:
379 draft: true
380 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
381 files: |
382 target/zed-remote-server-macos-x86_64.gz
383 target/zed-remote-server-macos-aarch64.gz
384 target/aarch64-apple-darwin/release/Zed-aarch64.dmg
385 target/x86_64-apple-darwin/release/Zed-x86_64.dmg
386 env:
387 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
388
389 bundle-linux-x86_x64:
390 timeout-minutes: 60
391 name: Linux x86_x64 release bundle
392 runs-on:
393 - buildjet-16vcpu-ubuntu-2004
394 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
395 needs: [linux_tests]
396 env:
397 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
398 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
399 DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
400 DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
401 steps:
402 - name: Checkout repo
403 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
404 with:
405 clean: false
406
407 - name: Install Linux dependencies
408 run: ./script/linux && ./script/install-mold 2.34.0
409
410 - name: Determine version and release channel
411 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
412 run: |
413 # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
414 script/determine-release-channel
415
416 - name: Create Linux .tar.gz bundle
417 run: script/bundle-linux
418
419 - name: Upload Linux bundle to workflow run if main branch or specific label
420 uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
421 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
422 with:
423 name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz
424 path: target/release/zed-*.tar.gz
425
426 - name: Upload app bundle to release
427 uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
428 with:
429 draft: true
430 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
431 files: |
432 target/zed-remote-server-linux-x86_64.gz
433 target/release/zed-linux-x86_64.tar.gz
434 env:
435 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
436
437 bundle-linux-aarch64: # this runs on ubuntu22.04
438 timeout-minutes: 60
439 name: Linux arm64 release bundle
440 runs-on:
441 - buildjet-16vcpu-ubuntu-2204-arm
442 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
443 needs: [linux_tests]
444 env:
445 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
446 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
447 DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
448 DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
449 steps:
450 - name: Checkout repo
451 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
452 with:
453 clean: false
454
455 - name: Install Linux dependencies
456 run: ./script/linux
457
458 - name: Determine version and release channel
459 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
460 run: |
461 # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
462 script/determine-release-channel
463
464 - name: Create and upload Linux .tar.gz bundle
465 run: script/bundle-linux
466
467 - name: Upload Linux bundle to workflow run if main branch or specific label
468 uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
469 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
470 with:
471 name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz
472 path: target/release/zed-*.tar.gz
473
474 - name: Upload app bundle to release
475 uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
476 with:
477 draft: true
478 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
479 files: |
480 target/zed-remote-server-linux-aarch64.gz
481 target/release/zed-linux-aarch64.tar.gz
482 env:
483 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
484
485 auto-release-preview:
486 name: Auto release preview
487 if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre') }}
488 needs: [bundle-mac, bundle-linux-x86_x64, bundle-linux-aarch64]
489 runs-on:
490 - self-hosted
491 - bundle
492 steps:
493 - name: gh release
494 run: gh release edit $GITHUB_REF_NAME --draft=true
495 env:
496 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}