Skip to content

Commit

Permalink
Merge branch 'main' into better-context-expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
mikayla-maki committed May 16, 2024
2 parents dddfaa7 + 53815af commit fb5d75c
Show file tree
Hide file tree
Showing 426 changed files with 18,329 additions and 14,050 deletions.
15 changes: 15 additions & 0 deletions .cloudflare/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
We have two cloudflare workers that let us serve some assets of this repo
from Cloudflare.

* `open-source-website-assets` is used for `install.sh`
* `docs-proxy` is used for `https://zed.dev/docs`

On push to `main`, both of these (and the files they depend on) are uploaded to Cloudflare.

### Deployment

These functions are deployed on push to main by the deploy_cloudflare.yml workflow. Worker Rules in Cloudflare intercept requests to zed.dev and proxy them to the appropriate workers.

### Testing

You can use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update) to test these workers locally, or to deploy custom versions.
14 changes: 14 additions & 0 deletions .cloudflare/docs-proxy/src/worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
async fetch(request, _env, _ctx) {
const url = new URL(request.url);
url.hostname = "docs-anw.pages.dev";

let res = await fetch(url, request);

if (res.status === 404) {
res = await fetch("https://zed.dev/404");
}

return res;
},
};
8 changes: 8 additions & 0 deletions .cloudflare/docs-proxy/wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = "docs-proxy"
main = "src/worker.js"
compatibility_date = "2024-05-03"
workers_dev = true

[[routes]]
pattern = "zed.dev/docs*"
zone_name = "zed.dev"
19 changes: 19 additions & 0 deletions .cloudflare/open-source-website-assets/src/worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default {
async fetch(request, env) {
const url = new URL(request.url);
const key = url.pathname.slice(1);

const object = await env.OPEN_SOURCE_WEBSITE_ASSETS_BUCKET.get(key);
if (!object) {
return await fetch("https://zed.dev/404");
}

const headers = new Headers();
object.writeHttpMetadata(headers);
headers.set("etag", object.httpEtag);

return new Response(object.body, {
headers,
});
},
};
8 changes: 8 additions & 0 deletions .cloudflare/open-source-website-assets/wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = "open-source-website-assets"
main = "src/worker.js"
compatibility_date = "2024-05-15"
workers_dev = true

[[r2_buckets]]
binding = 'OPEN_SOURCE_WEBSITE_ASSETS_BUCKET'
bucket_name = 'zed-open-source-website-assets'
39 changes: 14 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"
fetch-depth: 0

- name: Remove untracked files
Expand Down Expand Up @@ -87,7 +86,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: cargo clippy
run: cargo xtask clippy
Expand All @@ -104,22 +102,17 @@ jobs:
# todo(linux): Actually run the tests
linux_tests:
name: (Linux) Run Clippy and tests
runs-on: ubuntu-latest
runs-on:
- self-hosted
- deploy
steps:
- name: Add Rust to the PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Checkout repo
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Cache dependencies
uses: swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: configure linux
shell: bash -euxo pipefail {0}
run: script/linux

- name: cargo clippy
run: cargo xtask clippy
Expand All @@ -136,7 +129,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Cache dependencies
uses: swatinem/rust-cache@v2
Expand Down Expand Up @@ -179,7 +171,6 @@ jobs:
# 25 was chosen arbitrarily.
fetch-depth: 25
clean: false
submodules: "recursive"

- name: Limit target directory size
run: script/clear-target-dir-if-larger-than 100
Expand Down Expand Up @@ -262,26 +253,24 @@ jobs:

bundle-linux:
name: Create a Linux bundle
runs-on: ubuntu-22.04 # keep the version fixed to avoid libc and dynamic linked library issues
runs-on:
- self-hosted
- deploy
if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
needs: [linux_tests]
env:
ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
steps:
- name: Add Rust to the PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Checkout repo
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Cache dependencies
uses: swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Configure linux
shell: bash -euxo pipefail {0}
run: script/linux
- name: Limit target directory size
run: script/clear-target-dir-if-larger-than 100

- name: Determine version and release channel
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/deploy_cloudflare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy Docs

on:
push:
branches:
- main

jobs:
deploy-docs:
name: Deploy Docs
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
clean: false

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: "0.4.37"

- name: Build book
run: |
set -euo pipefail
mkdir -p target/deploy
mdbook build ./docs --dest-dir=../target/deploy/docs/
- name: Deploy Docs
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy target/deploy --project-name=docs

- name: Deploy Install
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: r2 object put -f script/install.sh zed-open-source-website-assets/install.sh

- name: Deploy Docs Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy .cloudflare/docs-proxy/src/worker.js

- name: Deploy Install Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy .cloudflare/docs-proxy/src/worker.js
3 changes: 0 additions & 3 deletions .github/workflows/deploy_collab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"
fetch-depth: 0

- name: Run style checks
Expand All @@ -41,7 +40,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"
fetch-depth: 0

- name: Install cargo nextest
Expand Down Expand Up @@ -76,7 +74,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Build docker image
run: docker build . --build-arg GITHUB_SHA=$GITHUB_SHA --tag registry.digitalocean.com/zed/collab:$GITHUB_SHA
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/deploy_docs.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/publish_extension_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Cache dependencies
uses: swatinem/rust-cache@v2
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/randomized_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Run randomized tests
run: script/randomized-test-ci
18 changes: 5 additions & 13 deletions .github/workflows/release_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"
fetch-depth: 0

- name: Run style checks
Expand All @@ -45,7 +44,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Run tests
uses: ./.github/actions/run_tests
Expand Down Expand Up @@ -75,7 +73,6 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Set release channel to nightly
run: |
Expand All @@ -96,7 +93,9 @@ jobs:
bundle-deb:
name: Create a Linux *.tar.gz bundle
if: github.repository_owner == 'zed-industries'
runs-on: ubuntu-22.04 # keep the version fixed to avoid libc and dynamic linked library issues
runs-on:
- self-hosted
- deploy
needs: tests
env:
DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
Expand All @@ -107,16 +106,9 @@ jobs:
uses: actions/checkout@v4
with:
clean: false
submodules: "recursive"

- name: Cache dependencies
uses: swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Configure linux
shell: bash -euxo pipefail {0}
run: script/linux
- name: Add Rust to the PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Set release channel to nightly
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ DerivedData/
.venv
.blob_store
.vscode
.wrangler
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

9 changes: 9 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ Christian Bergschneider <christian.bergschneider@gmx.de>
Christian Bergschneider <christian.bergschneider@gmx.de> <magiclake@gmx.de>
Conrad Irwin <conrad@zed.dev>
Conrad Irwin <conrad@zed.dev> <conrad.irwin@gmail.com>
Fernando Tagawa <tagawafernando@gmail.com>
Fernando Tagawa <tagawafernando@gmail.com> <fernando.tagawa.gamail.com@gmail.com>
Greg Morenz <greg-morenz@droid.cafe>
Greg Morenz <greg-morenz@droid.cafe> <morenzg@gmail.com>
Ivan Žužak <izuzak@gmail.com>
Ivan Žužak <izuzak@gmail.com> <ivan.zuzak@github.com>
Joseph T. Lyons <JosephTLyons@gmail.com>
Joseph T. Lyons <JosephTLyons@gmail.com> <JosephTLyons@users.noreply.github.com>
Julia <floc@unpromptedtirade.com>
Expand All @@ -29,6 +33,9 @@ Kirill Bulatov <kirill@zed.dev>
Kirill Bulatov <kirill@zed.dev> <mail4score@gmail.com>
Kyle Caverly <kylebcaverly@gmail.com>
Kyle Caverly <kylebcaverly@gmail.com> <kyle@zed.dev>
LoganDark <contact@logandark.mozmail.com>
LoganDark <contact@logandark.mozmail.com> <git@logandark.mozmail.com>
LoganDark <contact@logandark.mozmail.com> <github@logandark.mozmail.com>
Marshall Bowers <elliott.codes@gmail.com>
Marshall Bowers <elliott.codes@gmail.com> <marshall@zed.dev>
Max Brunsfeld <maxbrunsfeld@gmail.com>
Expand All @@ -41,6 +48,8 @@ Nate Butler <iamnbutler@gmail.com> <nate@zed.dev>
Nathan Sobo <nathan@zed.dev>
Nathan Sobo <nathan@zed.dev> <nathan@warp.dev>
Nathan Sobo <nathan@zed.dev> <nathansobo@gmail.com>
Petros Amoiridis <petros@hey.com>
Petros Amoiridis <petros@hey.com> <petros@zed.dev>
Piotr Osiewicz <piotr@zed.dev>
Piotr Osiewicz <piotr@zed.dev> <24362066+osiewicz@users.noreply.github.com>
Robert Clover <git@clo4.net>
Expand Down

0 comments on commit fb5d75c

Please sign in to comment.