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