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