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