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 --features "livekit-cross-platform"
133 cargo build -p remote_server
134
135 linux_tests:
136 timeout-minutes: 60
137 name: (Linux) Run Clippy and tests
138 if: github.repository_owner == 'zed-industries'
139 runs-on:
140 - buildjet-16vcpu-ubuntu-2204
141 steps:
142 - name: Add Rust to the PATH
143 run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
144
145 - name: Checkout repo
146 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
147 with:
148 clean: false
149
150 - name: Cache dependencies
151 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
152 with:
153 save-if: ${{ github.ref == 'refs/heads/main' }}
154 cache-provider: "buildjet"
155
156 - name: Install Linux dependencies
157 run: ./script/linux
158
159 - name: cargo clippy
160 run: ./script/clippy
161
162 - name: Run tests
163 uses: ./.github/actions/run_tests
164
165 - name: Build Zed
166 run: cargo build -p zed
167
168 build_remote_server:
169 timeout-minutes: 60
170 name: (Linux) Build Remote Server
171 if: github.repository_owner == 'zed-industries'
172 runs-on:
173 - buildjet-16vcpu-ubuntu-2204
174 steps:
175 - name: Add Rust to the PATH
176 run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
177
178 - name: Checkout repo
179 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
180 with:
181 clean: false
182
183 - name: Cache dependencies
184 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
185 with:
186 save-if: ${{ github.ref == 'refs/heads/main' }}
187 cache-provider: "buildjet"
188
189 - name: Install Clang & Mold
190 run: ./script/remote-server && ./script/install-mold 2.34.0
191
192 - name: Build Remote Server
193 run: cargo build -p remote_server
194
195 # todo(windows): Actually run the tests
196 windows_tests:
197 timeout-minutes: 60
198 name: (Windows) Run Clippy and tests
199 if: github.repository_owner == 'zed-industries'
200 runs-on: hosted-windows-1
201 steps:
202 # more info here:- https://github.com/rust-lang/cargo/issues/13020
203 - name: Enable longer pathnames for git
204 run: git config --system core.longpaths true
205 - name: Checkout repo
206 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
207 with:
208 clean: false
209
210 - name: Cache dependencies
211 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
212 with:
213 save-if: ${{ github.ref == 'refs/heads/main' }}
214 cache-provider: "github"
215
216 - name: cargo clippy
217 # Windows can't run shell scripts, so we need to use `cargo xtask`.
218 run: cargo xtask clippy
219
220 - name: Build Zed
221 run: cargo build
222
223 bundle-mac:
224 timeout-minutes: 60
225 name: Create a macOS bundle
226 runs-on:
227 - self-hosted
228 - bundle
229 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
230 needs: [macos_tests]
231 env:
232 MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
233 MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
234 APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
235 APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
236 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
237 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
238 DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
239 DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
240 steps:
241 - name: Install Node
242 uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
243 with:
244 node-version: "18"
245
246 - name: Checkout repo
247 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
248 with:
249 # We need to fetch more than one commit so that `script/draft-release-notes`
250 # is able to diff between the current and previous tag.
251 #
252 # 25 was chosen arbitrarily.
253 fetch-depth: 25
254 clean: false
255 ref: ${{ github.ref }}
256
257 - name: Limit target directory size
258 run: script/clear-target-dir-if-larger-than 100
259
260 - name: Determine version and release channel
261 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
262 run: |
263 # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
264 script/determine-release-channel
265
266 - name: Draft release notes
267 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
268 run: |
269 mkdir -p target/
270 # Ignore any errors that occur while drafting release notes to not fail the build.
271 script/draft-release-notes "$RELEASE_VERSION" "$RELEASE_CHANNEL" > target/release-notes.md || true
272 script/create-draft-release target/release-notes.md
273 env:
274 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
275
276 - name: Generate license file
277 run: script/generate-licenses
278
279 - name: Create macOS app bundle
280 run: script/bundle-mac
281
282 - name: Rename binaries
283 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
284 run: |
285 mv target/aarch64-apple-darwin/release/Zed.dmg target/aarch64-apple-darwin/release/Zed-aarch64.dmg
286 mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg
287
288 - name: Upload app bundle (aarch64) to workflow run if main branch or specific label
289 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
290 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
291 with:
292 name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
293 path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg
294
295 - name: Upload app bundle (x86_64) to workflow run if main branch or specific label
296 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
297 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
298 with:
299 name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
300 path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg
301
302 - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
303 name: Upload app bundle to release
304 if: ${{ env.RELEASE_CHANNEL == 'preview' || env.RELEASE_CHANNEL == 'stable' }}
305 with:
306 draft: true
307 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
308 files: |
309 target/zed-remote-server-macos-x86_64.gz
310 target/zed-remote-server-macos-aarch64.gz
311 target/aarch64-apple-darwin/release/Zed-aarch64.dmg
312 target/x86_64-apple-darwin/release/Zed-x86_64.dmg
313 env:
314 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
315
316 bundle-linux:
317 timeout-minutes: 60
318 name: Create a Linux bundle
319 runs-on:
320 - buildjet-16vcpu-ubuntu-2004
321 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
322 needs: [linux_tests]
323 env:
324 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
325 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
326 steps:
327 - name: Checkout repo
328 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
329 with:
330 clean: false
331
332 - name: Install Linux dependencies
333 run: ./script/linux && ./script/install-mold 2.34.0
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: Create Linux .tar.gz bundle
342 run: script/bundle-linux
343
344 - name: Upload Linux bundle to workflow run if main branch or specific label
345 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 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-unknown-linux-gnu.tar.gz
349 path: target/release/zed-*.tar.gz
350
351 - name: Upload app bundle to release
352 uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
353 with:
354 draft: true
355 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
356 files: |
357 target/zed-remote-server-linux-x86_64.gz
358 target/release/zed-linux-x86_64.tar.gz
359 env:
360 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
361
362 bundle-linux-aarch64: # this runs on ubuntu22.04
363 timeout-minutes: 60
364 name: Create arm64 Linux bundle
365 runs-on:
366 - buildjet-16vcpu-ubuntu-2204-arm
367 if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
368 needs: [linux_tests]
369 env:
370 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
371 ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
372 steps:
373 - name: Checkout repo
374 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
375 with:
376 clean: false
377
378 - name: Install Linux dependencies
379 run: ./script/linux
380
381 - name: Determine version and release channel
382 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
383 run: |
384 # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
385 script/determine-release-channel
386
387 - name: Create and upload Linux .tar.gz bundle
388 run: script/bundle-linux
389
390 - name: Upload Linux bundle to workflow run if main branch or specific label
391 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
392 if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
393 with:
394 name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz
395 path: target/release/zed-*.tar.gz
396
397 - name: Upload app bundle to release
398 uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
399 with:
400 draft: true
401 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
402 files: |
403 target/zed-remote-server-linux-aarch64.gz
404 target/release/zed-linux-aarch64.tar.gz
405 env:
406 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
407
408 auto-release-preview:
409 name: Auto release preview
410 if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre') }}
411 needs: [bundle-mac, bundle-linux, bundle-linux-aarch64]
412 runs-on:
413 - self-hosted
414 - bundle
415 steps:
416 - name: gh release
417 run: gh release edit $GITHUB_REF_NAME --draft=false
418 env:
419 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}