Wire up release_nightly workflow, to upload artifacts to DO spaces
Co-authored-by: Kirill <kirill@zed.dev> Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
f44f60c6e6
commit
c684f08e30
5 changed files with 100 additions and 158 deletions
48
.github/actions/run_tests/action.yml
vendored
Normal file
48
.github/actions/run_tests/action.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
name: 'Run tests'
|
||||||
|
description: 'Runs the tests'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Install Rust
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
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
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: script/clear-target-dir-if-larger-than 70
|
||||||
|
|
||||||
|
- name: Run check
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: -D warnings
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: cargo check --test --workspace
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: -D warnings
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: cargo nextest run --workspace --no-fail-fast
|
||||||
|
|
||||||
|
- name: Build collab
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: cargo build -p collab
|
||||||
|
|
||||||
|
- name: Build other binaries
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: cargo build --workspace --bins --all-features
|
21
.github/actions/rust_fmt/action.yml
vendored
Normal file
21
.github/actions/rust_fmt/action.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
name: 'Run rustfmt'
|
||||||
|
description: 'Runs rustfmt'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Install Rust
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: |
|
||||||
|
rustup set profile minimal
|
||||||
|
rustup update stable
|
||||||
|
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
clean: false
|
||||||
|
submodules: "recursive"
|
||||||
|
|
||||||
|
- name: cargo fmt
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: cargo fmt --all -- --check
|
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
|
@ -23,19 +23,8 @@ jobs:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust
|
- name: Run rustfmt
|
||||||
run: |
|
uses: ./.github/actions/rust_fmt
|
||||||
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:
|
tests:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
|
@ -43,41 +32,9 @@ jobs:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
needs: rustfmt
|
needs: rustfmt
|
||||||
env:
|
|
||||||
RUSTFLAGS: -D warnings
|
|
||||||
steps:
|
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
|
- name: Run tests
|
||||||
run: cargo nextest run --workspace --no-fail-fast
|
uses: ./.github/actions/run_tests
|
||||||
|
|
||||||
- name: Build collab
|
|
||||||
run: cargo build -p collab
|
|
||||||
|
|
||||||
- name: Build other binaries
|
|
||||||
run: cargo build --workspace --bins --all-features
|
|
||||||
|
|
||||||
bundle:
|
bundle:
|
||||||
name: Bundle app
|
name: Bundle app
|
||||||
|
|
95
.github/workflows/release_nightly.yml
vendored
95
.github/workflows/release_nightly.yml
vendored
|
@ -20,19 +20,8 @@ jobs:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust
|
- name: Run rustfmt
|
||||||
run: |
|
uses: ./.github/actions/rust_fmt
|
||||||
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:
|
tests:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
|
@ -40,41 +29,9 @@ jobs:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
needs: rustfmt
|
needs: rustfmt
|
||||||
env:
|
|
||||||
RUSTFLAGS: -D warnings
|
|
||||||
steps:
|
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
|
- name: Run tests
|
||||||
run: cargo nextest run --workspace --no-fail-fast
|
uses: ./.github/actions/run_tests
|
||||||
|
|
||||||
- name: Build collab
|
|
||||||
run: cargo build -p collab
|
|
||||||
|
|
||||||
- name: Build other binaries
|
|
||||||
run: cargo build --workspace --bins --all-features
|
|
||||||
|
|
||||||
bundle:
|
bundle:
|
||||||
name: Bundle app
|
name: Bundle app
|
||||||
|
@ -87,6 +44,8 @@ jobs:
|
||||||
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
|
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
|
||||||
APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
|
APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
|
||||||
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
|
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
|
||||||
|
DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
|
||||||
|
DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
run: |
|
run: |
|
||||||
|
@ -110,22 +69,12 @@ jobs:
|
||||||
- name: Limit target directory size
|
- name: Limit target directory size
|
||||||
run: script/clear-target-dir-if-larger-than 70
|
run: script/clear-target-dir-if-larger-than 70
|
||||||
|
|
||||||
- name: Determine version and release channel
|
- name: Set release channel to nightly
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
version=$(git rev-parse --short HEAD)
|
version=$(git rev-parse --short HEAD)
|
||||||
channel=$(cat crates/zed/RELEASE_CHANNEL)
|
echo "Publishing version: ${version} on release channel nightly"
|
||||||
echo "Publishing version: ${version} on release channel ${channel}"
|
echo "nightly" > crates/zed/RELEASE_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
|
- name: Generate license file
|
||||||
run: script/generate-licenses
|
run: script/generate-licenses
|
||||||
|
@ -133,31 +82,5 @@ jobs:
|
||||||
- name: Create app bundle
|
- name: Create app bundle
|
||||||
run: script/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
|
- name: Upload Zed Nightly
|
||||||
run: script/upload-nightly #something something
|
run: script/upload-nightly
|
||||||
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 }}
|
|
||||||
|
|
45
script/upload-nightly
Normal file → Executable file
45
script/upload-nightly
Normal file → Executable file
|
@ -1,44 +1,37 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Based on the template in: https://docs.digitalocean.com/reference/api/spaces-api/
|
# Based on the template in: https://docs.digitalocean.com/reference/api/spaces-api/
|
||||||
|
set -ux
|
||||||
|
|
||||||
# Step 1: Define the parameters for the Space you want to upload to.
|
# 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.
|
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).
|
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.
|
# Step 2: Define a function that uploads your object via cURL.
|
||||||
function putS3
|
function uploadToSpaces
|
||||||
{
|
{
|
||||||
path="." # The local path to the file you want to upload.
|
file_to_upload="$1"
|
||||||
file="hello-world.txt" # The file you want to upload.
|
file_name="$2"
|
||||||
space_path="/" # The path within your Space where you want to upload the new file.
|
space_path="nightly"
|
||||||
space="${SPACE}"
|
|
||||||
date=$(date +"%a, %d %b %Y %T %z")
|
date=$(date +"%a, %d %b %Y %T %z")
|
||||||
acl="x-amz-acl:private" # Defines Access-control List (ACL) permissions, such as private or public.
|
acl="x-amz-acl:private"
|
||||||
content_type="text/plain" # Defines the type of content you are uploading.
|
content_type="application/octet-stream"
|
||||||
storage_type="x-amz-storage-class:${STORAGETYPE}"
|
storage_type="x-amz-storage-class:STANDARD"
|
||||||
string="PUT\n\n$content_type\n$date\n$acl\n$storage_type\n/$space$space_path$file"
|
string="PUT\n\n${content_type}\n${date}\n${acl}\n${storage_type}\n/${SPACE}/${space_path}/${file_name}"
|
||||||
signature=$(echo -en "${string}" | openssl sha1 -hmac "${SECRET}" -binary | base64)
|
signature=$(echo -en "${string}" | openssl sha1 -hmac "${DIGITALOCEAN_SPACES_SECRET_KEY}" -binary | base64)
|
||||||
curl -s -X PUT -T "$path/$file" \ # The cURL command that uploads your file.
|
|
||||||
-H "Host: $space.${REGION}.digitaloceanspaces.com" \
|
curl -vv -s -X PUT -T "$file_to_upload" \
|
||||||
|
-H "Host: ${SPACE}.${REGION}.digitaloceanspaces.com" \
|
||||||
-H "Date: $date" \
|
-H "Date: $date" \
|
||||||
-H "Content-Type: $content_type" \
|
-H "Content-Type: $content_type" \
|
||||||
-H "$storage_type" \
|
-H "$storage_type" \
|
||||||
-H "$acl" \
|
-H "$acl" \
|
||||||
-H "Authorization: AWS ${KEY}:$signature" \
|
-H "Authorization: AWS ${DIGITALOCEAN_SPACES_ACCESS_KEY}:$signature" \
|
||||||
"https://$space.${REGION}.digitaloceanspaces.com$space_path$file"
|
"https://${SPACE}.${REGION}.digitaloceanspaces.com/${space_path}/${file_name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Step 3: mkdir for file based on release sha
|
sha=$(git rev-parse HEAD)
|
||||||
# :/sha-of- -commit/Zed.dmg
|
echo ${sha} > target/latest-sha
|
||||||
|
|
||||||
# Step 4: Put Zed.dmg in that directory
|
uploadToSpaces "target/release/Zed.dmg" "Zed.dmg"
|
||||||
for file in "$path"/*; do
|
uploadToSpaces "target/latest-sha" "latest-sha"
|
||||||
putS3 "$path" "${file##*/}" "nyc-tutorial-space/"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Step 5: Output that directory for next step
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue