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      - github-16vcpu-ubuntu-2204
132      # - buildjet-16vcpu-ubuntu-2004
133    needs: tests
134    steps:
135      - name: Checkout repo
136        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
137        with:
138          clean: false
139
140      - name: Add Rust to the PATH
141        run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
142
143      - name: Install Linux dependencies
144        run: ./script/linux && ./script/install-mold 2.34.0
145
146      - name: Setup Sentry CLI
147        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
148        with:
149          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
150
151      - name: Limit target directory size
152        run: script/clear-target-dir-if-larger-than 100
153
154      - name: Set release channel to nightly
155        run: |
156          set -euo pipefail
157          version=$(git rev-parse --short HEAD)
158          echo "Publishing version: ${version} on release channel nightly"
159          echo "nightly" > crates/zed/RELEASE_CHANNEL
160
161      - name: Create Linux .tar.gz bundle
162        run: script/bundle-linux
163
164      - name: Upload Zed Nightly
165        run: script/upload-nightly linux-targz
166
167  bundle-linux-arm:
168    timeout-minutes: 60
169    name: Create a Linux *.tar.gz bundle for ARM
170    if: github.repository_owner == 'zed-industries'
171    runs-on:
172      - github-16vcpu-ubuntu-2204-arm
173    needs: tests
174    steps:
175      - name: Checkout repo
176        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
177        with:
178          clean: false
179
180      - name: Install Linux dependencies
181        run: ./script/linux
182
183      - name: Setup Sentry CLI
184        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
185        with:
186          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
187
188      - name: Limit target directory size
189        run: script/clear-target-dir-if-larger-than 100
190
191      - name: Set release channel to nightly
192        run: |
193          set -euo pipefail
194          version=$(git rev-parse --short HEAD)
195          echo "Publishing version: ${version} on release channel nightly"
196          echo "nightly" > crates/zed/RELEASE_CHANNEL
197
198      - name: Create Linux .tar.gz bundle
199        run: script/bundle-linux
200
201      - name: Upload Zed Nightly
202        run: script/upload-nightly linux-targz
203
204  freebsd:
205    timeout-minutes: 60
206    if: false && github.repository_owner == 'zed-industries'
207    runs-on: github-8vcpu-ubuntu-2404
208    needs: tests
209    name: Build Zed on FreeBSD
210    # env:
211    #   MYTOKEN : ${{ secrets.MYTOKEN }}
212    #   MYTOKEN2: "value2"
213    steps:
214      - uses: actions/checkout@v4
215      - name: Build FreeBSD remote-server
216        id: freebsd-build
217        uses: vmactions/freebsd-vm@c3ae29a132c8ef1924775414107a97cac042aad5 # v1.2.0
218        with:
219          # envs: "MYTOKEN MYTOKEN2"
220          usesh: true
221          release: 13.5
222          copyback: true
223          prepare: |
224            pkg install -y \
225              bash curl jq git \
226              rustup-init cmake-core llvm-devel-lite pkgconf protobuf # ibx11 alsa-lib rust-bindgen-cli
227          run: |
228            freebsd-version
229            sysctl hw.model
230            sysctl hw.ncpu
231            sysctl hw.physmem
232            sysctl hw.usermem
233            git config --global --add safe.directory /home/runner/work/zed/zed
234            rustup-init --profile minimal --default-toolchain none -y
235            . "$HOME/.cargo/env"
236            ./script/bundle-freebsd
237            mkdir -p out/
238            mv "target/zed-remote-server-freebsd-x86_64.gz" out/
239            rm -rf target/
240            cargo clean
241
242      - name: Upload Zed Nightly
243        run: script/upload-nightly freebsd
244
245  bundle-nix:
246    name: Build and cache Nix package
247    if: false
248    needs: tests
249    secrets: inherit
250    uses: ./.github/workflows/nix.yml
251
252  bundle-windows-x64:
253    timeout-minutes: 60
254    name: Create a Windows installer
255    if: github.repository_owner == 'zed-industries'
256    runs-on: [self-hosted, Windows, X64]
257    needs: windows-tests
258    env:
259      AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
260      AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
261      AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
262      ACCOUNT_NAME: ${{ vars.AZURE_SIGNING_ACCOUNT_NAME }}
263      CERT_PROFILE_NAME: ${{ vars.AZURE_SIGNING_CERT_PROFILE_NAME }}
264      ENDPOINT: ${{ vars.AZURE_SIGNING_ENDPOINT }}
265      FILE_DIGEST: SHA256
266      TIMESTAMP_DIGEST: SHA256
267      TIMESTAMP_SERVER: "http://timestamp.acs.microsoft.com"
268    steps:
269      - name: Checkout repo
270        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
271        with:
272          clean: false
273
274      - name: Set release channel to nightly
275        working-directory: ${{ env.ZED_WORKSPACE }}
276        run: |
277          $ErrorActionPreference = "Stop"
278          $version = git rev-parse --short HEAD
279          Write-Host "Publishing version: $version on release channel nightly"
280          "nightly" | Set-Content -Path "crates/zed/RELEASE_CHANNEL"
281
282      - name: Setup Sentry CLI
283        uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
284        with:
285          token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
286
287      - name: Build Zed installer
288        working-directory: ${{ env.ZED_WORKSPACE }}
289        run: script/bundle-windows.ps1
290
291      - name: Upload Zed Nightly
292        working-directory: ${{ env.ZED_WORKSPACE }}
293        run: script/upload-nightly.ps1 windows
294
295  update-nightly-tag:
296    name: Update nightly tag
297    if: github.repository_owner == 'zed-industries'
298    runs-on: ubuntu-latest
299    needs:
300      - bundle-mac
301      - bundle-linux-x86
302      - bundle-linux-arm
303      - bundle-windows-x64
304    steps:
305      - name: Checkout repo
306        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
307        with:
308          fetch-depth: 0
309
310      - name: Update nightly tag
311        run: |
312          if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then
313            echo "Nightly tag already points to current commit. Skipping tagging."
314            exit 0
315          fi
316          git config user.name github-actions
317          git config user.email github-actions@github.com
318          git tag -f nightly
319          git push origin nightly --force