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