release_nightly.yml

  1name: Release Nightly
  2
  3on:
  4  schedule:
  5    # Fire every day at 7:00am UTC (Roughly before EU workday and after US workday)
  6    - cron: "0 7 * * *"
  7  push:
  8    tags:
  9      - "nightly"
 10
 11env:
 12  CARGO_TERM_COLOR: always
 13  CARGO_INCREMENTAL: 0
 14  RUST_BACKTRACE: 1
 15  ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
 16  ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }}
 17  DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
 18  DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
 19
 20jobs:
 21  style:
 22    timeout-minutes: 60
 23    name: Check formatting and Clippy lints
 24    if: github.repository_owner == 'zed-industries'
 25    runs-on:
 26      - self-hosted
 27      - macOS
 28    steps:
 29      - name: Checkout repo
 30        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 31        with:
 32          clean: false
 33          fetch-depth: 0
 34
 35      - name: Run style checks
 36        uses: ./.github/actions/check_style
 37
 38      - name: Run clippy
 39        run: ./script/clippy
 40
 41  tests:
 42    timeout-minutes: 60
 43    name: Run tests
 44    if: github.repository_owner == 'zed-industries'
 45    runs-on:
 46      - self-hosted
 47      - macOS
 48    needs: style
 49    steps:
 50      - name: Checkout repo
 51        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 52        with:
 53          clean: false
 54
 55      - name: Run tests
 56        uses: ./.github/actions/run_tests
 57
 58  windows-tests:
 59    timeout-minutes: 60
 60    name: Run tests on Windows
 61    if: github.repository_owner == 'zed-industries'
 62    runs-on: [self-hosted, Windows, X64]
 63    steps:
 64      - name: Checkout repo
 65        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 66        with:
 67          clean: false
 68
 69      - name: Configure CI
 70        run: |
 71          New-Item -ItemType Directory -Path "./../.cargo" -Force
 72          Copy-Item -Path "./.cargo/ci-config.toml" -Destination "./../.cargo/config.toml"
 73
 74      - name: Run tests
 75        uses: ./.github/actions/run_tests_windows
 76
 77      - name: Limit target directory size
 78        run: ./script/clear-target-dir-if-larger-than.ps1 1024
 79
 80      - name: Clean CI config file
 81        if: always()
 82        run: Remove-Item -Recurse -Path "./../.cargo" -Force -ErrorAction SilentlyContinue
 83
 84  bundle-mac:
 85    timeout-minutes: 60
 86    name: Create a macOS bundle
 87    if: github.repository_owner == 'zed-industries'
 88    runs-on:
 89      - self-mini-macos
 90    needs: tests
 91    env:
 92      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
 93      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
 94      APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
 95      APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
 96      APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
 97    steps:
 98      - name: Install Node
 99        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
100        with:
101          node-version: "18"
102
103      - name: Checkout repo
104        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
105        with:
106          clean: false
107
108      - name: Set release channel to nightly
109        run: |
110          set -eu
111          version=$(git rev-parse --short HEAD)
112          echo "Publishing version: ${version} on release channel nightly"
113          echo "nightly" > crates/zed/RELEASE_CHANNEL
114
115      - name: Setup Sentry CLI
116        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
117        with:
118          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
119
120      - name: Create macOS app bundle
121        run: script/bundle-mac
122
123      - name: Upload Zed Nightly
124        run: script/upload-nightly macos
125
126  bundle-linux-x86:
127    timeout-minutes: 60
128    name: Create a Linux *.tar.gz bundle for x86
129    if: github.repository_owner == 'zed-industries'
130    runs-on:
131      - namespace-profile-16x32-ubuntu-2004 # ubuntu 20.04 for minimal glibc
132    needs: tests
133    steps:
134      - name: Checkout repo
135        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
136        with:
137          clean: false
138
139      - name: Add Rust to the PATH
140        run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
141
142      - name: Install Linux dependencies
143        run: ./script/linux && ./script/install-mold 2.34.0
144
145      - name: Setup Sentry CLI
146        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
147        with:
148          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
149
150      - name: Limit target directory size
151        run: script/clear-target-dir-if-larger-than 100
152
153      - name: Set release channel to nightly
154        run: |
155          set -euo pipefail
156          version=$(git rev-parse --short HEAD)
157          echo "Publishing version: ${version} on release channel nightly"
158          echo "nightly" > crates/zed/RELEASE_CHANNEL
159
160      - name: Create Linux .tar.gz bundle
161        run: script/bundle-linux
162
163      - name: Upload Zed Nightly
164        run: script/upload-nightly linux-targz
165
166  bundle-linux-arm:
167    timeout-minutes: 60
168    name: Create a Linux *.tar.gz bundle for ARM
169    if: github.repository_owner == 'zed-industries'
170    runs-on:
171      - namespace-profile-8x32-ubuntu-2004-arm-m4 # ubuntu 20.04 for minimal glibc
172    needs: tests
173    steps:
174      - name: Checkout repo
175        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
176        with:
177          clean: false
178
179      - name: Install Linux dependencies
180        run: ./script/linux
181
182      - name: Setup Sentry CLI
183        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
184        with:
185          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
186
187      - name: Limit target directory size
188        run: script/clear-target-dir-if-larger-than 100
189
190      - name: Set release channel to nightly
191        run: |
192          set -euo pipefail
193          version=$(git rev-parse --short HEAD)
194          echo "Publishing version: ${version} on release channel nightly"
195          echo "nightly" > crates/zed/RELEASE_CHANNEL
196
197      - name: Create Linux .tar.gz bundle
198        run: script/bundle-linux
199
200      - name: Upload Zed Nightly
201        run: script/upload-nightly linux-targz
202
203  freebsd:
204    timeout-minutes: 60
205    if: false && github.repository_owner == 'zed-industries'
206    runs-on: github-8vcpu-ubuntu-2404
207    needs: tests
208    name: Build Zed on FreeBSD
209    # env:
210    #   MYTOKEN : ${{ secrets.MYTOKEN }}
211    #   MYTOKEN2: "value2"
212    steps:
213      - uses: actions/checkout@v4
214      - name: Build FreeBSD remote-server
215        id: freebsd-build
216        uses: vmactions/freebsd-vm@c3ae29a132c8ef1924775414107a97cac042aad5 # v1.2.0
217        with:
218          # envs: "MYTOKEN MYTOKEN2"
219          usesh: true
220          release: 13.5
221          copyback: true
222          prepare: |
223            pkg install -y \
224              bash curl jq git \
225              rustup-init cmake-core llvm-devel-lite pkgconf protobuf # ibx11 alsa-lib rust-bindgen-cli
226          run: |
227            freebsd-version
228            sysctl hw.model
229            sysctl hw.ncpu
230            sysctl hw.physmem
231            sysctl hw.usermem
232            git config --global --add safe.directory /home/runner/work/zed/zed
233            rustup-init --profile minimal --default-toolchain none -y
234            . "$HOME/.cargo/env"
235            ./script/bundle-freebsd
236            mkdir -p out/
237            mv "target/zed-remote-server-freebsd-x86_64.gz" out/
238            rm -rf target/
239            cargo clean
240
241      - name: Upload Zed Nightly
242        run: script/upload-nightly freebsd
243
244  bundle-nix:
245    name: Build and cache Nix package
246    if: false
247    needs: tests
248    secrets: inherit
249    uses: ./.github/workflows/nix.yml
250
251  bundle-windows-x64:
252    timeout-minutes: 60
253    name: Create a Windows installer
254    if: github.repository_owner == 'zed-industries'
255    runs-on: [self-hosted, Windows, X64]
256    needs: windows-tests
257    env:
258      AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
259      AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
260      AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
261      ACCOUNT_NAME: ${{ vars.AZURE_SIGNING_ACCOUNT_NAME }}
262      CERT_PROFILE_NAME: ${{ vars.AZURE_SIGNING_CERT_PROFILE_NAME }}
263      ENDPOINT: ${{ vars.AZURE_SIGNING_ENDPOINT }}
264      FILE_DIGEST: SHA256
265      TIMESTAMP_DIGEST: SHA256
266      TIMESTAMP_SERVER: "http://timestamp.acs.microsoft.com"
267    steps:
268      - name: Checkout repo
269        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
270        with:
271          clean: false
272
273      - name: Set release channel to nightly
274        working-directory: ${{ env.ZED_WORKSPACE }}
275        run: |
276          $ErrorActionPreference = "Stop"
277          $version = git rev-parse --short HEAD
278          Write-Host "Publishing version: $version on release channel nightly"
279          "nightly" | Set-Content -Path "crates/zed/RELEASE_CHANNEL"
280
281      - name: Setup Sentry CLI
282        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
283        with:
284          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
285
286      - name: Build Zed installer
287        working-directory: ${{ env.ZED_WORKSPACE }}
288        run: script/bundle-windows.ps1
289
290      - name: Upload Zed Nightly
291        working-directory: ${{ env.ZED_WORKSPACE }}
292        run: script/upload-nightly.ps1 windows
293
294  update-nightly-tag:
295    name: Update nightly tag
296    if: github.repository_owner == 'zed-industries'
297    runs-on: ubuntu-latest
298    needs:
299      - bundle-mac
300      - bundle-linux-x86
301      - bundle-linux-arm
302      - bundle-windows-x64
303    steps:
304      - name: Checkout repo
305        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
306        with:
307          fetch-depth: 0
308
309      - name: Update nightly tag
310        run: |
311          if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then
312            echo "Nightly tag already points to current commit. Skipping tagging."
313            exit 0
314          fi
315          git config user.name github-actions
316          git config user.email github-actions@github.com
317          git tag -f nightly
318          git push origin nightly --force
319
320      - name: Create Sentry release
321        uses: getsentry/action-release@526942b68292201ac6bbb99b9a0747d4abee354c # v3
322        env:
323          SENTRY_ORG: zed-dev
324          SENTRY_PROJECT: zed
325          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
326        with:
327          environment: production