From e39ae07196ab7afd097e969342cc594add4da3ce Mon Sep 17 00:00:00 2001 From: Julia Ryan Date: Tue, 18 Mar 2025 12:56:16 -0700 Subject: [PATCH] nix: don't block nightly release on failure --- .github/workflows/release_nightly.yml | 37 ++++++++++++++------------- flake.nix | 18 ++++++------- nix/build.nix | 16 +++++++----- nix/shell.nix | 2 ++ 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.yml index 21c153e893..4817257c93 100644 --- a/.github/workflows/release_nightly.yml +++ b/.github/workflows/release_nightly.yml @@ -171,38 +171,39 @@ jobs: run: script/upload-nightly linux-targz bundle-nix: - strategy: - matrix: - os: [self-hosted, buildjet-16vcpu-ubuntu-2004, buildjet-16vcpu-ubuntu-2204-arm] timeout-minutes: 60 - name: Cache a nix build + name: (${{ matrix.system.os }}) Nix Build + continue-on-error: true + strategy: + fail-fast: false + matrix: + system: + - os: x86 Linux + runner: buildjet-16vcpu-ubuntu-2004 + - os: arm Mac + runner: [macOS, ARM64] + - os: arm Linux + runner: buildjet-16vcpu-ubuntu-2204-arm if: github.repository_owner == 'zed-industries' - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.system.runner }} needs: tests env: ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }} + GIT_LFS_SKIP_SMUDGE: 1 # breaks the livekit rust sdk examples which we don't actually depend on steps: - name: Checkout repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: clean: false - - name: Set release channel to nightly - run: | - set -euo pipefail - version=$(git rev-parse --short HEAD) - echo "Publishing version: ${version} on release channel nightly" - echo "nightly" > crates/zed/RELEASE_CHANNEL - - - uses: cachix/install-nix-action@v25 - # TODO: not needed since we're using flakes? - # with: - # nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v14 + - uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 with: name: zed-industries - signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - run: nix build update-nightly-tag: diff --git a/flake.nix b/flake.nix index 75afcc1da7..f3c832b536 100644 --- a/flake.nix +++ b/flake.nix @@ -62,14 +62,14 @@ overlays = overlays // { default = nixpkgs.lib.composeManyExtensions (builtins.attrValues overlays); }; - - nixConfig = { - extra-substituters = [ - "https://app.cachix.org/cache/zed-industries" - ]; - extra-trusted-public-keys = [ - "zed-industries.cachix.org-1:QW3RoXK0Lm4ycmU5/3bmYRd3MLf4RbTGPqRulGlX5W0=" - ]; - }; }; + + nixConfig = { + extra-substituters = [ + "https://zed-industries.cachix.org" + ]; + extra-trusted-public-keys = [ + "zed-industries.cachix.org-1:QW3RoXK0Lm4ycmU5/3bmYRd3MLf4RbTGPqRulGlX5W0=" + ]; + }; } diff --git a/nix/build.nix b/nix/build.nix index 940623894d..06ae95f805 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -38,6 +38,7 @@ nodejs_22, withGLES ? false, + profile ? "release", }: assert withGLES -> stdenv.hostPlatform.isLinux; @@ -153,6 +154,9 @@ let ] }"; LK_CUSTOM_WEBRTC = livekit-libwebrtc; + CARGO_PROFILE = profile; + # need to handle some profiles specially https://github.com/rust-lang/cargo/issues/11053 + TARGET_DIR = "target/" + (if profile == "dev" then "debug" else profile); }; cargoVendorDir = craneLib.vendorCargoDeps { @@ -225,13 +229,13 @@ craneLib.buildPackage ( pushd crates/zed sed -i "s/package.metadata.bundle-nightly/package.metadata.bundle/" Cargo.toml export CARGO_BUNDLE_SKIP_BUILD=true - app_path="$(cargo bundle --release | xargs)" + app_path="$(cargo bundle --profile $CARGO_PROFILE | xargs)" popd mkdir -p $out/Applications $out/bin # Zed expects git next to its own binary ln -s ${git}/bin/git "$app_path/Contents/MacOS/git" - mv target/release/cli "$app_path/Contents/MacOS/cli" + mv $TARGET_DIR/cli "$app_path/Contents/MacOS/cli" mv "$app_path" $out/Applications/ # Physical location of the CLI must be inside the app bundle as this is used @@ -241,21 +245,19 @@ craneLib.buildPackage ( runHook postInstall '' else - # TODO: icons should probably be named "zed-nightly". fix bundle-linux first '' runHook preInstall mkdir -p $out/bin $out/libexec - cp target/release/zed $out/libexec/zed-editor - cp target/release/cli $out/bin/zed + cp $TARGET_DIR/zed $out/libexec/zed-editor + cp $TARGET_DIR/cli $out/bin/zed install -D "crates/zed/resources/app-icon-nightly@2x.png" \ "$out/share/icons/hicolor/1024x1024@2x/apps/zed.png" install -D crates/zed/resources/app-icon-nightly.png \ $out/share/icons/hicolor/512x512/apps/zed.png - # extracted from ../script/bundle-linux (envsubst) and - # ../script/install.sh (final desktop file name) + # TODO: icons should probably be named "zed-nightly" ( export DO_STARTUP_NOTIFY="true" export APP_CLI="zed" diff --git a/nix/shell.nix b/nix/shell.nix index 9d880065d6..eba288d67a 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -49,6 +49,8 @@ mkShell' { (removeAttrs baseEnvs [ "LK_CUSTOM_WEBRTC" # download the staticlib during the build as usual "ZED_UPDATE_EXPLANATION" # allow auto-updates + "CARGO_PROFILE" # let you specify the profile + "TARGET_DIR" ]) // { # note: different than `$FONTCONFIG_FILE` in `build.nix` – this refers to relative paths