From 3ba0787ec2c52d8e4c8c5eee95d692498f127b53 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 28 Aug 2024 20:50:50 -0700 Subject: [PATCH] macOS: save dSYM files The focus of this commit is to store the dSYM files associated with official macOS builds. dSYM files allow us to map crash reports to source. The dSYM files are primarily uploaded to our official blob storage where all releases are also stored. We also upload the dSYM files to Sentry since I'm experimenting with using that for crash reproting (note: manual crash reporting, no automatic network traffic). This commit also changes our blob URLs for releases to use the full Git SHA rather than a build number. This is much easier to trace back. --- .github/workflows/release-pr.yml | 64 +++++++++++++++++++++--- .github/workflows/release-tip.yml | 66 ++++++++++++++++++++++--- dist/macos/update_appcast_tip.py | 5 +- macos/Ghostty.xcodeproj/project.pbxproj | 1 + 4 files changed, 121 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index c1272c697..1b36e5ffc 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -7,6 +7,48 @@ on: name: Release PR jobs: + sentry-dsym-debug: + runs-on: namespace-profile-ghostty-sm + needs: [build-macos-debug] + steps: + - uses: actions/checkout@v4 + + - name: Install sentry-cli + run: | + curl -sL https://sentry.io/get-cli/ | bash + + - name: Download dSYM + run: | + GHOSTTY_COMMIT_LONG=$(git rev-parse HEAD) + curl -L https://pr.files.ghostty.dev/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-debug-dsym.zip > dsym.zip + + - name: Upload dSYM to Sentry + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + run: | + sentry-cli dif upload --project ghostty --wait dsym.zip + + sentry-dsym: + runs-on: namespace-profile-ghostty-sm + needs: [build-macos] + steps: + - uses: actions/checkout@v4 + + - name: Install sentry-cli + run: | + curl -sL https://sentry.io/get-cli/ | bash + + - name: Download dSYM + run: | + GHOSTTY_COMMIT_LONG=$(git rev-parse HEAD) + curl -L https://pr.files.ghostty.dev/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-dsym.zip > dsym.zip + + - name: Upload dSYM to Sentry + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + run: | + sentry-cli dif upload --project ghostty --wait dsym.zip + build-macos: runs-on: namespace-profile-ghostty-macos timeout-minutes: 90 @@ -42,6 +84,7 @@ jobs: run: | echo "GHOSTTY_BUILD=$(git rev-list --count head)" >> $GITHUB_ENV echo "GHOSTTY_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "GHOSTTY_COMMIT_LONG=$(git rev-parse HEAD)" >> $GITHUB_ENV # GhosttyKit is the framework that is built from Zig for our native # Mac app to access. Build this in release mode. @@ -132,14 +175,18 @@ jobs: # Zip up the app - name: Zip App - run: cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal.zip Ghostty.app + run: | + cd macos/build/Release + zip -9 -r --symlinks ../../../ghostty-macos-universal.zip Ghostty.app + zip -9 -r --symlinks ../../../ghostty-macos-universal-dsym.zip Ghostty.app.dSYM/ # Update Blob Storage - name: Prep R2 Storage run: | mkdir blob - mkdir -p blob/${GHOSTTY_BUILD} - cp ghostty-macos-universal.zip blob/${GHOSTTY_BUILD}/ghostty-macos-universal.zip + mkdir -p blob/${GHOSTTY_COMMIT_LONG} + cp ghostty-macos-universal.zip blob/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal.zip + cp ghostty-macos-universal-dsym.zip blob/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-dsym.zip - name: Upload to R2 uses: ryand56/r2-upload-action@latest with: @@ -185,6 +232,7 @@ jobs: run: | echo "GHOSTTY_BUILD=$(git rev-list --count head)" >> $GITHUB_ENV echo "GHOSTTY_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "GHOSTTY_COMMIT_LONG=$(git rev-parse HEAD)" >> $GITHUB_ENV # GhosttyKit is the framework that is built from Zig for our native # Mac app to access. Build this in release mode. @@ -275,14 +323,18 @@ jobs: # Zip up the app - name: Zip App - run: cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal-debug.zip Ghostty.app + run: | + cd macos/build/Release + zip -9 -r --symlinks ../../../ghostty-macos-universal-debug.zip Ghostty.app + zip -9 -r --symlinks ../../../ghostty-macos-universal-debug-dsym.zip Ghostty.app.dSYM/ # Update Blob Storage - name: Prep R2 Storage run: | mkdir blob - mkdir -p blob/${GHOSTTY_BUILD} - cp ghostty-macos-universal-debug.zip blob/${GHOSTTY_BUILD}/ghostty-macos-universal-debug.zip + mkdir -p blob/${GHOSTTY_COMMIT_LONG} + cp ghostty-macos-universal-debug.zip blob/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-debug.zip + cp ghostty-macos-universal-debug-dsym.zip blob/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-debug-dsym.zip - name: Upload to R2 uses: ryand56/r2-upload-action@latest with: diff --git a/.github/workflows/release-tip.yml b/.github/workflows/release-tip.yml index b03a3f6aa..aeba6cfa8 100644 --- a/.github/workflows/release-tip.yml +++ b/.github/workflows/release-tip.yml @@ -21,6 +21,48 @@ jobs: git tag -fa tip -m "Latest Continuous Release" ${GITHUB_SHA} git push --force origin tip + sentry-dsym-debug: + runs-on: namespace-profile-ghostty-sm + needs: [build-macos-debug] + steps: + - uses: actions/checkout@v4 + + - name: Install sentry-cli + run: | + curl -sL https://sentry.io/get-cli/ | bash + + - name: Download dSYM + run: | + GHOSTTY_COMMIT_LONG=$(git rev-parse HEAD) + curl -L https://tip.files.ghostty.dev/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-debug-dsym.zip > dsym.zip + + - name: Upload dSYM to Sentry + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + run: | + sentry-cli dif upload --project ghostty --wait dsym.zip + + sentry-dsym: + runs-on: namespace-profile-ghostty-sm + needs: [build-macos] + steps: + - uses: actions/checkout@v4 + + - name: Install sentry-cli + run: | + curl -sL https://sentry.io/get-cli/ | bash + + - name: Download dSYM + run: | + GHOSTTY_COMMIT_LONG=$(git rev-parse HEAD) + curl -L https://tip.files.ghostty.dev/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-dsym.zip > dsym.zip + + - name: Upload dSYM to Sentry + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + run: | + sentry-cli dif upload --project ghostty --wait dsym.zip + build-macos: if: | ${{ @@ -66,6 +108,7 @@ jobs: run: | echo "GHOSTTY_BUILD=$(git rev-list --count head)" >> $GITHUB_ENV echo "GHOSTTY_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "GHOSTTY_COMMIT_LONG=$(git rev-parse HEAD)" >> $GITHUB_ENV # GhosttyKit is the framework that is built from Zig for our native # Mac app to access. Build this in release mode. @@ -154,9 +197,12 @@ jobs: echo "Attach staple" xcrun stapler staple "macos/build/Release/Ghostty.app" - # Zip up the app + # Zip up the app and symbols - name: Zip App - run: cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal.zip Ghostty.app + run: | + cd macos/build/Release + zip -9 -r --symlinks ../../../ghostty-macos-universal.zip Ghostty.app + zip -9 -r --symlinks ../../../ghostty-macos-universal-dsym.zip Ghostty.app.dSYM/ # Update Release - name: Release @@ -184,8 +230,9 @@ jobs: - name: Prep R2 Storage run: | mkdir blob - mkdir -p blob/${GHOSTTY_BUILD} - cp ghostty-macos-universal.zip blob/${GHOSTTY_BUILD}/ghostty-macos-universal.zip + mkdir -p blob/${GHOSTTY_COMMIT_LONG} + cp ghostty-macos-universal.zip blob/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal.zip + cp ghostty-macos-universal-dsym.zip blob/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-dsym.zip cp appcast_new.xml blob/appcast.xml - name: Upload to R2 uses: ryand56/r2-upload-action@latest @@ -242,6 +289,7 @@ jobs: run: | echo "GHOSTTY_BUILD=$(git rev-list --count head)" >> $GITHUB_ENV echo "GHOSTTY_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "GHOSTTY_COMMIT_LONG=$(git rev-parse HEAD)" >> $GITHUB_ENV # GhosttyKit is the framework that is built from Zig for our native # Mac app to access. Build this in release mode. @@ -332,7 +380,10 @@ jobs: # Zip up the app - name: Zip App - run: cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal-debug.zip Ghostty.app + run: | + cd macos/build/Release + zip -9 -r --symlinks ../../../ghostty-macos-universal-debug.zip Ghostty.app + zip -9 -r --symlinks ../../../ghostty-macos-universal-debug-dsym.zip Ghostty.app.dSYM/ # Update Release - name: Release @@ -349,8 +400,9 @@ jobs: - name: Prep R2 Storage run: | mkdir blob - mkdir -p blob/${GHOSTTY_BUILD} - cp ghostty-macos-universal-debug.zip blob/${GHOSTTY_BUILD}/ghostty-macos-universal-debug.zip + mkdir -p blob/${GHOSTTY_COMMIT_LONG} + cp ghostty-macos-universal-debug.zip blob/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-debug.zip + cp ghostty-macos-universal-debug-dsym.zip blob/${GHOSTTY_COMMIT_LONG}/ghostty-macos-universal-debug-dsym.zip - name: Upload to R2 uses: ryand56/r2-upload-action@latest with: diff --git a/dist/macos/update_appcast_tip.py b/dist/macos/update_appcast_tip.py index 8f7d5da54..f58ab00ba 100644 --- a/dist/macos/update_appcast_tip.py +++ b/dist/macos/update_appcast_tip.py @@ -22,6 +22,7 @@ from datetime import datetime, timezone now = datetime.now(timezone.utc) build = os.environ["GHOSTTY_BUILD"] commit = os.environ["GHOSTTY_COMMIT"] +commit_long = os.environ["GHOSTTY_COMMIT_LONG"] repo = "https://github.com/ghostty-org/ghostty" # Read our sign_update output @@ -83,7 +84,7 @@ elem.text = "12.0.0" elem = ET.SubElement(item, "description") elem.text = f"""

-Automated build from commit {commit} +Automated build from commit {commit} on {now.strftime('%Y-%m-%d')}.

@@ -93,7 +94,7 @@ commit history on GitHub for all changes.

""" elem = ET.SubElement(item, "enclosure") -elem.set("url", f"https://tip.files.ghostty.dev/{build}/ghostty-macos-universal.zip") +elem.set("url", f"https://tip.files.ghostty.dev/{commit_long}/ghostty-macos-universal.zip") elem.set("type", "application/octet-stream") for key, value in attrs.items(): elem.set(key, value) diff --git a/macos/Ghostty.xcodeproj/project.pbxproj b/macos/Ghostty.xcodeproj/project.pbxproj index 608c1ee9f..b758411cf 100644 --- a/macos/Ghostty.xcodeproj/project.pbxproj +++ b/macos/Ghostty.xcodeproj/project.pbxproj @@ -770,6 +770,7 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES;