mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
4f862ffbc6
Removes a lot of dead code we have floating around here that is no longer used and has not been for ages. If we ever need to check something out here again, we can just revert parts of these. Currently, these just trigger security warnings if anything and thus are dead weight. Hence removing here. Drive-by fix of our collab staging deploys as well. Release Notes: - N/A
173 lines
6.1 KiB
YAML
173 lines
6.1 KiB
YAML
# Generated from xtask::workflows::deploy_collab
|
|
# Rebuild with `cargo xtask workflows`.
|
|
name: deploy_collab
|
|
env:
|
|
DOCKER_BUILDKIT: '1'
|
|
on:
|
|
push:
|
|
tags:
|
|
- collab-production
|
|
- collab-staging
|
|
permissions:
|
|
contents: read
|
|
jobs:
|
|
style:
|
|
if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
|
|
name: Check formatting and Clippy lints
|
|
runs-on: namespace-profile-16x32-ubuntu-2204
|
|
env:
|
|
CC: clang
|
|
CXX: clang++
|
|
steps:
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
fetch-depth: 0
|
|
- name: steps::setup_cargo_config
|
|
run: |
|
|
mkdir -p ./../.cargo
|
|
cp ./.cargo/ci-config.toml ./../.cargo/config.toml
|
|
- name: steps::cache_rust_dependencies_namespace
|
|
uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
|
|
with:
|
|
cache: rust
|
|
path: ~/.rustup
|
|
- name: steps::setup_linux
|
|
run: ./script/linux
|
|
- name: steps::download_wasi_sdk
|
|
run: ./script/download-wasi-sdk
|
|
- name: steps::cargo_fmt
|
|
run: cargo fmt --all -- --check
|
|
- name: steps::clippy
|
|
run: ./script/clippy
|
|
tests:
|
|
needs:
|
|
- style
|
|
name: Run tests
|
|
runs-on: namespace-profile-16x32-ubuntu-2204
|
|
env:
|
|
CC: clang
|
|
CXX: clang++
|
|
steps:
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
fetch-depth: 0
|
|
- name: steps::setup_cargo_config
|
|
run: |
|
|
mkdir -p ./../.cargo
|
|
cp ./.cargo/ci-config.toml ./../.cargo/config.toml
|
|
- name: steps::cache_rust_dependencies_namespace
|
|
uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
|
|
with:
|
|
cache: rust
|
|
path: ~/.rustup
|
|
- name: steps::setup_linux
|
|
run: ./script/linux
|
|
- name: steps::download_wasi_sdk
|
|
run: ./script/download-wasi-sdk
|
|
- name: steps::cargo_install_nextest
|
|
uses: taiki-e/install-action@a6b2e2dcd845ddd7f509ce4f3ed3d922b80cc5d9
|
|
with:
|
|
tool: nextest
|
|
- name: steps::clear_target_dir_if_large
|
|
run: ./script/clear-target-dir-if-larger-than 350 200
|
|
- name: deploy_collab::tests::run_collab_tests
|
|
run: cargo nextest run --package collab --no-fail-fast
|
|
services:
|
|
postgres:
|
|
image: postgres:15@sha256:1b92e7a80c021647bf70f5d3eb66066a998e4f5cf43c07bb9dc9f729782cf88e
|
|
env:
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
ports:
|
|
- 5432:5432
|
|
options: --health-cmd pg_isready --health-interval 500ms --health-timeout 5s --health-retries 10
|
|
publish:
|
|
needs:
|
|
- style
|
|
- tests
|
|
name: Publish collab server image
|
|
runs-on: namespace-profile-16x32-ubuntu-2204
|
|
steps:
|
|
- name: deploy_collab::publish::install_doctl
|
|
uses: digitalocean/action-doctl@3cb3953159719656269e044e0e24ca16dd2a690f
|
|
with:
|
|
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
|
- name: deploy_collab::publish::sign_into_registry
|
|
run: doctl registry login
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
- name: deploy_collab::publish::build_docker_image
|
|
run: |
|
|
docker build -f Dockerfile-collab \
|
|
--build-arg "GITHUB_SHA=$GITHUB_SHA" \
|
|
--tag "registry.digitalocean.com/zed/collab:$GITHUB_SHA" \
|
|
.
|
|
- name: deploy_collab::publish::publish_docker_image
|
|
run: docker push "registry.digitalocean.com/zed/collab:${GITHUB_SHA}"
|
|
- name: deploy_collab::publish::prune_docker_system
|
|
run: docker system prune --filter 'until=72h' -f
|
|
deploy:
|
|
needs:
|
|
- publish
|
|
name: Deploy new server image
|
|
runs-on: namespace-profile-16x32-ubuntu-2204
|
|
steps:
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
- name: deploy_collab::deploy::install_doctl
|
|
uses: digitalocean/action-doctl@3cb3953159719656269e044e0e24ca16dd2a690f
|
|
with:
|
|
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
|
- name: deploy_collab::deploy::sign_into_kubernetes
|
|
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 "$CLUSTER_NAME"
|
|
env:
|
|
CLUSTER_NAME: ${{ secrets.CLUSTER_NAME }}
|
|
- name: deploy_collab::deploy::start_rollout
|
|
run: |
|
|
set -eu
|
|
if [[ $GITHUB_REF_NAME = "collab-production" ]]; then
|
|
export ZED_KUBE_NAMESPACE=production
|
|
export ZED_COLLAB_LOAD_BALANCER_SIZE_UNIT=10
|
|
export ZED_API_LOAD_BALANCER_SIZE_UNIT=2
|
|
elif [[ $GITHUB_REF_NAME = "collab-staging" ]]; then
|
|
export ZED_KUBE_NAMESPACE=staging
|
|
export ZED_COLLAB_LOAD_BALANCER_SIZE_UNIT=1
|
|
export ZED_API_LOAD_BALANCER_SIZE_UNIT=1
|
|
else
|
|
echo "cowardly refusing to deploy from an unknown branch"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Deploying collab:$GITHUB_SHA to $ZED_KUBE_NAMESPACE"
|
|
|
|
source script/lib/deploy-helpers.sh
|
|
export_vars_for_environment "$ZED_KUBE_NAMESPACE"
|
|
|
|
ZED_DO_CERTIFICATE_ID="$(doctl compute certificate list --format ID --no-header)"
|
|
export ZED_DO_CERTIFICATE_ID
|
|
export ZED_IMAGE_ID="registry.digitalocean.com/zed/collab:${GITHUB_SHA}"
|
|
|
|
export ZED_SERVICE_NAME=collab
|
|
export ZED_LOAD_BALANCER_SIZE_UNIT=$ZED_COLLAB_LOAD_BALANCER_SIZE_UNIT
|
|
export DATABASE_MAX_CONNECTIONS=850
|
|
envsubst < crates/collab/k8s/collab.template.yml | kubectl apply -f -
|
|
kubectl -n "$ZED_KUBE_NAMESPACE" rollout status "deployment/$ZED_SERVICE_NAME" --watch
|
|
echo "deployed ${ZED_SERVICE_NAME} to ${ZED_KUBE_NAMESPACE}"
|
|
|
|
export ZED_SERVICE_NAME=api
|
|
export ZED_LOAD_BALANCER_SIZE_UNIT=$ZED_API_LOAD_BALANCER_SIZE_UNIT
|
|
export DATABASE_MAX_CONNECTIONS=60
|
|
envsubst < crates/collab/k8s/collab.template.yml | kubectl apply -f -
|
|
kubectl -n "$ZED_KUBE_NAMESPACE" rollout status "deployment/$ZED_SERVICE_NAME" --watch
|
|
echo "deployed ${ZED_SERVICE_NAME} to ${ZED_KUBE_NAMESPACE}"
|
|
defaults:
|
|
run:
|
|
shell: bash -euxo pipefail {0}
|