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