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