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-2
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 run: ./script/clippy.ps1
277
278 - name: Run tests
279 uses: ./.github/actions/run_tests_windows
280 with:
281 working-directory: ${{ env.ZED_WORKSPACE }}
282
283 - name: Build Zed
284 working-directory: ${{ env.ZED_WORKSPACE }}
285 run: cargo build
286
287 - name: Check dev drive space
288 working-directory: ${{ env.ZED_WORKSPACE }}
289 # `setup-dev-driver.ps1` creates a 100GB drive, with CI taking up ~45GB of the drive.
290 run: ./script/exit-ci-if-dev-drive-is-full.ps1 95
291
292 # Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
293 - name: Clean CI config file
294 if: always()
295 run: Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml" -Force
296
297 bundle-mac:
298 timeout-minutes: 120
299 name: Create a macOS bundle
300 runs-on:
301 - self-hosted
302 - bundle
303 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
304 needs: [macos_tests]
305 env:
306 MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
307 MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
308 APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
309 APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
310 APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
311 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
312 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
313 DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
314 DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
315 steps:
316 - name: Install Node
317 uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
318 with:
319 node-version: "18"
320
321 - name: Checkout repo
322 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
323 with:
324 # We need to fetch more than one commit so that `script/draft-release-notes`
325 # is able to diff between the current and previous tag.
326 #
327 # 25 was chosen arbitrarily.
328 fetch-depth: 25
329 clean: false
330 ref: ${{ github.ref }}
331
332 - name: Limit target directory size
333 run: script/clear-target-dir-if-larger-than 100
334
335 - name: Determine version and release channel
336 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
337 run: |
338 # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
339 script/determine-release-channel
340
341 - name: Draft release notes
342 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
343 run: |
344 mkdir -p target/
345 # Ignore any errors that occur while drafting release notes to not fail the build.
346 script/draft-release-notes "$RELEASE_VERSION" "$RELEASE_CHANNEL" > target/release-notes.md || true
347 script/create-draft-release target/release-notes.md
348 env:
349 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
350
351 - name: Create macOS app bundle
352 run: script/bundle-mac
353
354 - name: Rename binaries
355 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
356 run: |
357 mv target/aarch64-apple-darwin/release/Zed.dmg target/aarch64-apple-darwin/release/Zed-aarch64.dmg
358 mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg
359
360 - name: Upload app bundle (aarch64) to workflow run if main branch or specific label
361 uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
362 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
363 with:
364 name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
365 path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg
366
367 - name: Upload app bundle (x86_64) to workflow run if main branch or specific label
368 uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
369 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
370 with:
371 name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
372 path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg
373
374 - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
375 name: Upload app bundle to release
376 if: ${{ env.RELEASE_CHANNEL == 'preview' || env.RELEASE_CHANNEL == 'stable' }}
377 with:
378 draft: true
379 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
380 files: |
381 target/zed-remote-server-macos-x86_64.gz
382 target/zed-remote-server-macos-aarch64.gz
383 target/aarch64-apple-darwin/release/Zed-aarch64.dmg
384 target/x86_64-apple-darwin/release/Zed-x86_64.dmg
385 env:
386 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
387
388 bundle-linux-x86_x64:
389 timeout-minutes: 60
390 name: Linux x86_x64 release bundle
391 runs-on:
392 - buildjet-16vcpu-ubuntu-2004
393 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
394 needs: [linux_tests]
395 env:
396 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
397 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
398 DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
399 DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
400 steps:
401 - name: Checkout repo
402 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
403 with:
404 clean: false
405
406 - name: Install Linux dependencies
407 run: ./script/linux && ./script/install-mold 2.34.0
408
409 - name: Determine version and release channel
410 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
411 run: |
412 # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
413 script/determine-release-channel
414
415 - name: Create Linux .tar.gz bundle
416 run: script/bundle-linux
417
418 - name: Upload Linux bundle to workflow run if main branch or specific label
419 uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
420 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
421 with:
422 name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz
423 path: target/release/zed-*.tar.gz
424
425 - name: Upload app bundle to release
426 uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
427 with:
428 draft: true
429 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
430 files: |
431 target/zed-remote-server-linux-x86_64.gz
432 target/release/zed-linux-x86_64.tar.gz
433 env:
434 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
435
436 bundle-linux-aarch64: # this runs on ubuntu22.04
437 timeout-minutes: 60
438 name: Linux arm64 release bundle
439 runs-on:
440 - buildjet-16vcpu-ubuntu-2204-arm
441 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
442 needs: [linux_tests]
443 env:
444 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
445 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
446 DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
447 DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
448 steps:
449 - name: Checkout repo
450 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
451 with:
452 clean: false
453
454 - name: Install Linux dependencies
455 run: ./script/linux
456
457 - name: Determine version and release channel
458 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
459 run: |
460 # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
461 script/determine-release-channel
462
463 - name: Create and upload Linux .tar.gz bundle
464 run: script/bundle-linux
465
466 - name: Upload Linux bundle to workflow run if main branch or specific label
467 uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
468 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
469 with:
470 name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz
471 path: target/release/zed-*.tar.gz
472
473 - name: Upload app bundle to release
474 uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
475 with:
476 draft: true
477 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
478 files: |
479 target/zed-remote-server-linux-aarch64.gz
480 target/release/zed-linux-aarch64.tar.gz
481 env:
482 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
483
484 auto-release-preview:
485 name: Auto release preview
486 if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre') }}
487 needs: [bundle-mac, bundle-linux-x86_x64, bundle-linux-aarch64]
488 runs-on:
489 - self-hosted
490 - bundle
491 steps:
492 - name: gh release
493 run: gh release edit $GITHUB_REF_NAME --draft=true
494 env:
495 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}