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.

Upload debug info to sentry.io in nightly builds (#35089)

Julia Ryana57e4dc8a801
diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.yml
index f799133ea70..4f7506967bd 100644
--- a/.github/workflows/release_nightly.yml
+++ b/.github/workflows/release_nightly.yml
@@ -111,6 +111,11 @@ jobs:
echo "Publishing version: ${version} on release channel nightly"
echo "nightly" > crates/zed/RELEASE_CHANNEL
+ - name: Setup Sentry CLI
+ uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
+ with:
+ token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
+
- name: Create macOS app bundle
run: script/bundle-mac
@@ -136,6 +141,11 @@ jobs:
- name: Install Linux dependencies
run: ./script/linux && ./script/install-mold 2.34.0
+ - name: Setup Sentry CLI
+ uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
+ with:
+ token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
+
- name: Limit target directory size
run: script/clear-target-dir-if-larger-than 100
@@ -168,6 +178,11 @@ jobs:
- name: Install Linux dependencies
run: ./script/linux
+ - name: Setup Sentry CLI
+ uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
+ with:
+ token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
+
- name: Limit target directory size
run: script/clear-target-dir-if-larger-than 100
@@ -262,6 +277,11 @@ jobs:
Write-Host "Publishing version: $version on release channel nightly"
"nightly" | Set-Content -Path "crates/zed/RELEASE_CHANNEL"
+ - name: Setup Sentry CLI
+ uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2
+ with:
+ token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
+
- name: Build Zed installer
working-directory: ${{ env.ZED_WORKSPACE }}
run: script/bundle-windows.ps1
diff --git a/script/bundle-linux b/script/bundle-linux
index c52312015be..64de62ce9b6 100755
--- a/script/bundle-linux
+++ b/script/bundle-linux
@@ -83,6 +83,23 @@ if [[ "$remote_server_triple" == "$musl_triple" ]]; then
fi
cargo build --release --target "${remote_server_triple}" --package remote_server
+# Upload debug info to sentry.io
+if ! command -v sentry-cli >/dev/null 2>&1; then
+ echo "sentry-cli not found. skipping sentry upload."
+ echo "install with: 'curl -sL https://sentry.io/get-cli | bash'"
+else
+ if [[ -n "${SENTRY_AUTH_TOKEN:-}" ]]; then
+ echo "Uploading zed debug symbols to sentry..."
+ # note: this uploads the unstripped binary which is needed because it contains
+ # .eh_frame data for stack unwinindg. see https://github.com/getsentry/symbolic/issues/783
+ sentry-cli debug-files upload --include-sources --wait -p zed -o zed-dev \
+ "${target_dir}/${target_triple}"/release/zed \
+ "${target_dir}/${remote_server_triple}"/release/remote_server
+ else
+ echo "missing SENTRY_AUTH_TOKEN. skipping sentry upload."
+ fi
+fi
+
# Strip debug symbols and save them for upload to DigitalOcean
objcopy --only-keep-debug "${target_dir}/${target_triple}/release/zed" "${target_dir}/${target_triple}/release/zed.dbg"
objcopy --only-keep-debug "${target_dir}/${remote_server_triple}/release/remote_server" "${target_dir}/${remote_server_triple}/release/remote_server.dbg"
diff --git a/script/bundle-mac b/script/bundle-mac
index 18dfe908152..b2be5732355 100755
--- a/script/bundle-mac
+++ b/script/bundle-mac
@@ -366,3 +366,20 @@ else
gzip -f --stdout --best target/x86_64-apple-darwin/release/remote_server > target/zed-remote-server-macos-x86_64.gz
gzip -f --stdout --best target/aarch64-apple-darwin/release/remote_server > target/zed-remote-server-macos-aarch64.gz
fi
+
+# Upload debug info to sentry.io
+if ! command -v sentry-cli >/dev/null 2>&1; then
+ echo "sentry-cli not found. skipping sentry upload."
+ echo "install with: 'curl -sL https://sentry.io/get-cli | bash'"
+else
+ if [[ -n "${SENTRY_AUTH_TOKEN:-}" ]]; then
+ echo "Uploading zed debug symbols to sentry..."
+ # note: this uploads the unstripped binary which is needed because it contains
+ # .eh_frame data for stack unwinindg. see https://github.com/getsentry/symbolic/issues/783
+ sentry-cli debug-files upload --include-sources --wait -p zed -o zed-dev \
+ "target/x86_64-apple-darwin/${target_dir}/" \
+ "target/aarch64-apple-darwin/${target_dir}/"
+ else
+ echo "missing SENTRY_AUTH_TOKEN. skipping sentry upload."
+ fi
+fi
diff --git a/script/bundle-windows.ps1 b/script/bundle-windows.ps1
index 01a1114c26a..3aac8700ce9 100644
--- a/script/bundle-windows.ps1
+++ b/script/bundle-windows.ps1
@@ -96,6 +96,21 @@ function ZipZedAndItsFriendsDebug {
Compress-Archive -Path $items -DestinationPath ".\target\release\zed-$env:RELEASE_VERSION-$env:ZED_RELEASE_CHANNEL.dbg.zip" -Force
}
+
+function UploadToSentry {
+ if (-not (Get-Command "sentry-cli" -ErrorAction SilentlyContinue)) {
+ Write-Output "sentry-cli not found. skipping sentry upload."
+ Write-Output "install with: 'winget install -e --id=Sentry.sentry-cli'"
+ return
+ }
+ if (-not (Test-Path "env:SENTRY_AUTH_TOKEN")) {
+ Write-Output "missing SENTRY_AUTH_TOKEN. skipping sentry upload."
+ return
+ }
+ Write-Output "Uploading zed debug symbols to sentry..."
+ sentry-cli debug-files upload --include-sources --wait -p zed -o zed-dev .\target\release\
+}
+
function MakeAppx {
switch ($channel) {
"stable" {
@@ -242,6 +257,8 @@ function BuildInstaller {
ParseZedWorkspace
$innoDir = "$env:ZED_WORKSPACE\inno"
+$debugArchive = ".\target\release\zed-$env:RELEASE_VERSION-$env:ZED_RELEASE_CHANNEL.dbg.zip"
+$debugStoreKey = "$env:ZED_RELEASE_CHANNEL/zed-$env:RELEASE_VERSION-$env:ZED_RELEASE_CHANNEL.dbg.zip"
CheckEnvironmentVariables
PrepareForBundle
@@ -253,9 +270,8 @@ ZipZedAndItsFriendsDebug
CollectFiles
BuildInstaller
-$debugArchive = ".\target\release\zed-$env:RELEASE_VERSION-$env:ZED_RELEASE_CHANNEL.dbg.zip"
-$debugStoreKey = "$env:ZED_RELEASE_CHANNEL/zed-$env:RELEASE_VERSION-$env:ZED_RELEASE_CHANNEL.dbg.zip"
UploadToBlobStorePublic -BucketName "zed-debug-symbols" -FileToUpload $debugArchive -BlobStoreKey $debugStoreKey
+UploadToSentry
if ($buildSuccess) {
Write-Output "Build successful"