Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Push some sketches

Mikayla6976af502975
diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.yml
new file mode 100644
index 00000000000..bb743505da0
--- /dev/null
+++ b/.github/workflows/release_nightly.yml
@@ -0,0 +1,163 @@
+name: Release Nightly
+
+on:
+ schedule:
+ # Fire every night at 1:00am
+ - cron: "0 1 * * *"
+ push:
+ tags:
+ - "nightly*"
+
+env:
+ CARGO_TERM_COLOR: always
+ CARGO_INCREMENTAL: 0
+ RUST_BACKTRACE: 1
+
+jobs:
+ rustfmt:
+ name: Check formatting
+ runs-on:
+ - self-hosted
+ - test
+ steps:
+ - name: Install Rust
+ run: |
+ rustup set profile minimal
+ rustup update stable
+
+ - name: Checkout repo
+ uses: actions/checkout@v3
+ with:
+ clean: false
+ submodules: "recursive"
+
+ - name: cargo fmt
+ run: cargo fmt --all -- --check
+
+ tests:
+ name: Run tests
+ runs-on:
+ - self-hosted
+ - test
+ needs: rustfmt
+ env:
+ RUSTFLAGS: -D warnings
+ steps:
+ - name: Install Rust
+ run: |
+ rustup set profile minimal
+ rustup update stable
+ rustup target add wasm32-wasi
+ cargo install cargo-nextest
+
+ - name: Install Node
+ uses: actions/setup-node@v3
+ with:
+ node-version: "18"
+
+ - name: Checkout repo
+ uses: actions/checkout@v3
+ with:
+ clean: false
+ submodules: "recursive"
+
+ - name: Limit target directory size
+ run: script/clear-target-dir-if-larger-than 70
+
+ - name: Run check
+ run: cargo check --workspace
+
+ - name: Run tests
+ run: cargo nextest run --workspace --no-fail-fast
+
+ - name: Build collab
+ run: cargo build -p collab
+
+ - name: Build other binaries
+ run: cargo build --workspace --bins --all-features
+
+ bundle:
+ name: Bundle app
+ runs-on:
+ - self-hosted
+ - bundle
+ needs: tests
+ env:
+ MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
+ MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
+ APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
+ APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
+ steps:
+ - name: Install Rust
+ run: |
+ rustup set profile minimal
+ rustup update stable
+ rustup target add aarch64-apple-darwin
+ rustup target add x86_64-apple-darwin
+ rustup target add wasm32-wasi
+
+ - name: Install Node
+ uses: actions/setup-node@v3
+ with:
+ node-version: "18"
+
+ - name: Checkout repo
+ uses: actions/checkout@v3
+ with:
+ clean: false
+ submodules: "recursive"
+
+ - name: Limit target directory size
+ run: script/clear-target-dir-if-larger-than 70
+
+ - name: Determine version and release channel
+ run: |
+ set -eu
+
+ version=$(git rev-parse --short HEAD)
+ channel=$(cat crates/zed/RELEASE_CHANNEL)
+ echo "Publishing version: ${version} on release channel ${channel}"
+ echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
+
+ case ${channel} in
+ nightly)
+ exit 0;;
+ *)
+ echo "can't publish a release on channel ${channel} with this action"
+ exit 1;;
+ esac
+
+ - name: Generate license file
+ run: script/generate-licenses
+
+ - name: Create app bundle
+ run: script/bundle
+
+ # So, here's an example of how this _could_ be done.
+ # Problem: Need to setup some docker secrets
+ # Problem: This action is very old
+ # Problem: Need to add stuff for interacting with our API
+ # - uses: BetaHuhn/do-spaces-action@v2
+ # name: Upload app bundle to nightly
+ # id: spaces-upload
+ # with:
+ # # Need to put this stuff in kuberenetes I think
+ # access_key: ${{ secrets.ACCESS_KEY}}
+ # secret_key: ${{ secrets.SECRET_KEY }}
+ # space_name: ${{ secrets.SPACE_NAME }}
+ # space_region: ${{ secrets.SPACE_REGION }}
+ # source: target/release/Zed.dmg
+ # env:
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Upload Zed Nightly
+ run: script/upload-nightly #something something
+ with:
+ do_secret: ${{ secrets.DO_SPACES_SECRET }}
+ do_access_key: ${{ secrets.DO_SPACES_ACCESS_KEY }}
+
+ # Upload to zed.dev?
+ - name: Upload new release URL to zed.dev
+ run: ??? #something something
+ with:
+ nightly_release_key: ${{ secrets.NIGHTLY_RELEASE_KEY }}
+ deployment_url: ${{ steps.spaces-upload.outputs.output_url }}
diff --git a/crates/zed/RELEASE_CHANNEL b/crates/zed/RELEASE_CHANNEL
index 90012116c03..bf867e0ae5b 100644
--- a/crates/zed/RELEASE_CHANNEL
+++ b/crates/zed/RELEASE_CHANNEL
@@ -1 +1 @@
-dev
\ No newline at end of file
+nightly
diff --git a/script/upload-nightly b/script/upload-nightly
new file mode 100644
index 00000000000..e98516a7dc2
--- /dev/null
+++ b/script/upload-nightly
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+# Based on the template in: https://docs.digitalocean.com/reference/api/spaces-api/
+
+
+# Step 1: Define the parameters for the Space you want to upload to.
+SPACE="zed-nightly-host" # Find your endpoint in the control panel, under Settings.
+REGION="nyc3" # Must be "us-east-1" when creating new Spaces. Otherwise, use the region in your endpoint (e.g. nyc3).
+STORAGETYPE="STANDARD" # Storage type, can be STANDARD, REDUCED_REDUNDANCY, etc.
+KEY="???????" # Access key pair. You can create access key pairs using the control panel or API.
+SECRET="$SECRET" # Secret access key defined through an environment variable.
+
+# Step 2: Define a function that uploads your object via cURL.
+function putS3
+{
+ path="." # The local path to the file you want to upload.
+ file="hello-world.txt" # The file you want to upload.
+ space_path="/" # The path within your Space where you want to upload the new file.
+ space="${SPACE}"
+ date=$(date +"%a, %d %b %Y %T %z")
+ acl="x-amz-acl:private" # Defines Access-control List (ACL) permissions, such as private or public.
+ content_type="text/plain" # Defines the type of content you are uploading.
+ storage_type="x-amz-storage-class:${STORAGETYPE}"
+ string="PUT\n\n$content_type\n$date\n$acl\n$storage_type\n/$space$space_path$file"
+ signature=$(echo -en "${string}" | openssl sha1 -hmac "${SECRET}" -binary | base64)
+ curl -s -X PUT -T "$path/$file" \ # The cURL command that uploads your file.
+ -H "Host: $space.${REGION}.digitaloceanspaces.com" \
+ -H "Date: $date" \
+ -H "Content-Type: $content_type" \
+ -H "$storage_type" \
+ -H "$acl" \
+ -H "Authorization: AWS ${KEY}:$signature" \
+ "https://$space.${REGION}.digitaloceanspaces.com$space_path$file"
+}
+
+# Step 3: mkdir for file based on release sha
+# Step 4: Put Zed.dmg in that directory
+for file in "$path"/*; do
+ putS3 "$path" "${file##*/}" "nyc-tutorial-space/"
+done
+
+# Step 5: Output that directory for next step