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
 16jobs:
 17  style:
 18    timeout-minutes: 60
 19    name: Check formatting and Clippy lints
 20    if: github.repository_owner == 'zed-industries'
 21    runs-on:
 22      - self-hosted
 23      - test
 24    steps:
 25      - name: Checkout repo
 26        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 27        with:
 28          clean: false
 29          fetch-depth: 0
 30
 31      - name: Run style checks
 32        uses: ./.github/actions/check_style
 33
 34      - name: Run clippy
 35        run: ./script/clippy
 36
 37  tests:
 38    timeout-minutes: 60
 39    name: Run tests
 40    if: github.repository_owner == 'zed-industries'
 41    runs-on:
 42      - self-hosted
 43      - test
 44    needs: style
 45    steps:
 46      - name: Checkout repo
 47        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 48        with:
 49          clean: false
 50
 51      - name: Run tests
 52        uses: ./.github/actions/run_tests
 53
 54  bundle-mac:
 55    timeout-minutes: 60
 56    name: Create a macOS bundle
 57    if: github.repository_owner == 'zed-industries'
 58    runs-on:
 59      - self-hosted
 60      - bundle
 61    needs: tests
 62    env:
 63      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
 64      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
 65      APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
 66      APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
 67      APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
 68      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
 69      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
 70      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
 71      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
 72    steps:
 73      - name: Install Node
 74        uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
 75        with:
 76          node-version: "18"
 77
 78      - name: Checkout repo
 79        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 80        with:
 81          clean: false
 82
 83      - name: Set release channel to nightly
 84        run: |
 85          set -eu
 86          version=$(git rev-parse --short HEAD)
 87          echo "Publishing version: ${version} on release channel nightly"
 88          echo "nightly" > crates/zed/RELEASE_CHANNEL
 89
 90      - name: Create macOS app bundle
 91        run: script/bundle-mac
 92
 93      - name: Upload Zed Nightly
 94        run: script/upload-nightly macos
 95
 96  bundle-linux-x86:
 97    timeout-minutes: 60
 98    name: Create a Linux *.tar.gz bundle for x86
 99    if: github.repository_owner == 'zed-industries'
100    runs-on:
101      - buildjet-16vcpu-ubuntu-2004
102    needs: tests
103    env:
104      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
105      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
106      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
107      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
108    steps:
109      - name: Checkout repo
110        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
111        with:
112          clean: false
113
114      - name: Add Rust to the PATH
115        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
116
117      - name: Install Linux dependencies
118        run: ./script/linux && ./script/install-mold 2.34.0
119
120      - name: Limit target directory size
121        run: script/clear-target-dir-if-larger-than 100
122
123      - name: Set release channel to nightly
124        run: |
125          set -euo pipefail
126          version=$(git rev-parse --short HEAD)
127          echo "Publishing version: ${version} on release channel nightly"
128          echo "nightly" > crates/zed/RELEASE_CHANNEL
129
130      - name: Create Linux .tar.gz bundle
131        run: script/bundle-linux
132
133      - name: Upload Zed Nightly
134        run: script/upload-nightly linux-targz
135
136  bundle-linux-arm:
137    timeout-minutes: 60
138    name: Create a Linux *.tar.gz bundle for ARM
139    if: github.repository_owner == 'zed-industries'
140    runs-on:
141      - buildjet-16vcpu-ubuntu-2204-arm
142    needs: tests
143    env:
144      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
145      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
146      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
147      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
148    steps:
149      - name: Checkout repo
150        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
151        with:
152          clean: false
153
154      - name: Install Linux dependencies
155        run: ./script/linux
156
157      - name: Limit target directory size
158        run: script/clear-target-dir-if-larger-than 100
159
160      - name: Set release channel to nightly
161        run: |
162          set -euo pipefail
163          version=$(git rev-parse --short HEAD)
164          echo "Publishing version: ${version} on release channel nightly"
165          echo "nightly" > crates/zed/RELEASE_CHANNEL
166
167      - name: Create Linux .tar.gz bundle
168        run: script/bundle-linux
169
170      - name: Upload Zed Nightly
171        run: script/upload-nightly linux-targz
172
173  bundle-nix:
174    timeout-minutes: 60
175    name: (${{ matrix.system.os }}) Nix Build
176    continue-on-error: true
177    strategy:
178      fail-fast: false
179      matrix:
180        system:
181          - os: x86 Linux
182            runner: buildjet-16vcpu-ubuntu-2204
183            install_nix: true
184          - os: arm Mac
185            runner: [macOS, ARM64, test]
186            install_nix: false
187    if: github.repository_owner == 'zed-industries'
188    runs-on: ${{ matrix.system.runner }}
189    needs: tests
190    env:
191      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
192      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
193      GIT_LFS_SKIP_SMUDGE: 1 # breaks the livekit rust sdk examples which we don't actually depend on
194    steps:
195      - name: Checkout repo
196        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
197        with:
198          clean: false
199
200      # on our macs we manually install nix. for some reason the cachix action is running
201      # under a non-login /bin/bash shell which doesn't source the proper script to add the
202      # nix profile to PATH, so we manually add them here
203      - name: Set path
204        if: ${{ ! matrix.system.install_nix }}
205        run: |
206          echo "/nix/var/nix/profiles/default/bin" >> $GITHUB_PATH
207          echo "/Users/administrator/.nix-profile/bin" >> $GITHUB_PATH
208
209      - uses: cachix/install-nix-action@d1ca217b388ee87b2507a9a93bf01368bde7cec2 # v31
210        if: ${{ matrix.system.install_nix }}
211        with:
212          github_access_token: ${{ secrets.GITHUB_TOKEN }}
213
214      - uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
215        with:
216          name: zed-industries
217          authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
218      - run: nix build
219      - name: Limit /nix/store to 50GB
220        run: '[ $(du -sm /nix/store | cut -f1) -gt 50000 ] && nix-collect-garbage -d'
221
222  update-nightly-tag:
223    name: Update nightly tag
224    if: github.repository_owner == 'zed-industries'
225    runs-on: ubuntu-latest
226    needs:
227      - bundle-mac
228      - bundle-linux-x86
229      - bundle-linux-arm
230    steps:
231      - name: Checkout repo
232        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
233        with:
234          fetch-depth: 0
235
236      - name: Update nightly tag
237        run: |
238          if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then
239            echo "Nightly tag already points to current commit. Skipping tagging."
240            exit 0
241          fi
242          git config user.name github-actions
243          git config user.email github-actions@github.com
244          git tag -f nightly
245          git push origin nightly --force