Skip to content

Commit

Permalink
Upload libparsec debug files to sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
FirelightFlagboy committed Oct 17, 2024
1 parent 89529f3 commit 0196402
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 4 deletions.
37 changes: 37 additions & 0 deletions .github/actions/setup-sentry-cli/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: setup-sentry-cli
description: Install Sentry-CLI

inputs:
sentry-version:
description: Sentry-CLI version to install
required: true


runs:
using: composite
steps:
- name: (*Nix) Install Sentry-CLI@${{ inputs.sentry-version }}
shell: bash -eux -o pipefail {0}
if: runner.os != 'Windows'
run: |
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="${{ inputs.sentry-version }}" sh
- name: (Windows) Install scoop
shell: powershell
if: runner.os == 'Windows'
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
- name: (Windows) Install sentry-cli
shell: powershell
if: runner.os == 'Windows'
run: |
scoop install sentry-cli@${{ inputs.sentry-version }}
- name: Check sentry-cli is installed
shell: bash
run: sentry-cli --version
23 changes: 22 additions & 1 deletion .github/workflows/package-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ env:
node-version: 18.12.0
wasm-pack-version: 0.12.1
WINFSP_VERSION: 2.0.23075
sentry-cli-version: 2.37.0

permissions:
contents: read
Expand Down Expand Up @@ -106,6 +107,9 @@ jobs:
with:
tool: [email protected], wasm-pack@${{ env.wasm-pack-version }}

# TODO: wasm-pack do provide debug info by default
# https://github.com/rustwasm/wasm-pack/issues/1351
# https://docs.sentry.io/platforms/native/data-management/debug-files/file-formats/#wasm
- name: Build web bindings
run: npm run build:release
working-directory: bindings/web
Expand Down Expand Up @@ -178,11 +182,13 @@ jobs:
- name: Create env file for snapcraft
run:
(
echo "SENTRY_CLI_VERSION=${{ env.sentry-cli-version }}";
echo "SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}";
echo "SENTRY_RELEASE=parsec@${{ steps.version.outputs.full }}";
echo "SENTRY_DIST=snapcraft-linux";
echo "SENTRY_ORG=scille";
echo "SENTRY_PROJECT=parsec3-frontend";
echo "SENTRY_CLIENT_PROJECT=parsec3-frontend";
echo "SENTRY_LIBPARSEC_PROJECT=parsec3-libparsec";
echo "VITE_MODE=${{ steps.version.outputs.type }}";
) | tee snapcraft.env
shell: bash
Expand Down Expand Up @@ -259,6 +265,10 @@ jobs:
node-version: ${{ env.node-version }}
timeout-minutes: 2

- uses: ./.github/actions/setup-sentry-cli
with:
sentry-version: ${{ env.sentry-cli-version }}

- name: Download version.patch artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # pin v4.1.8
with:
Expand Down Expand Up @@ -321,6 +331,17 @@ jobs:
# MacOS is really slow when build rust
timeout-minutes: 30

- name: Upload debug info to sentry
shell: bash
run: |
sentry-cli debug-files check dist/libparsec/index.node
sentry-cli debug-files upload --include-sources dist/libparsec/index.node
working-directory: bindings/electron
env:
SENTRY_ORG: scille
SENTRY_PROJECT: parsec3-libparsec
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

- name: Build client for electron
run: npm run native:build -- --mode ${{ steps.version.outputs.type }}
env:
Expand Down
21 changes: 18 additions & 3 deletions client/electron/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ parts:
build-attributes:
- enable-patchelf
override-build: |
set -x
set -eux -o pipefail
# Set system alias for python
update-alternatives --install /usr/local/bin/python python $(which python3) 100
Expand All @@ -76,6 +76,21 @@ parts:
npm clean-install
npm run build:release
set -a
source $SNAPCRAFT_PROJECT_DIR/snapcraft.env
set +a
if [ "${SENTRY_AUTH_TOKEN:=}" != "__TOKEN__" ] && [ -n "${SENTRY_AUTH_TOKEN:=}" ]; then
# Install sentry-cli
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=$SENTRY_CLI_VERSION sh
# Upload debug info
SENTRY_PROJECT=$SENTRY_LIBPARSEC_PROJECT sentry-cli debug-files check dist/libparsec/index.node
SENTRY_PROJECT=$SENTRY_LIBPARSEC_PROJECT sentry-cli debug-files upload --include-sources dist/libparsec/index.node
else
echo "SENTRY_AUTH_TOKEN is not set, skipping source maps upload." >&2
fi
cp -va dist/libparsec/index.node "$CRAFT_PART_INSTALL/libparsec.node"
cp -va dist/libparsec/index.d.ts "$CRAFT_PART_INSTALL/libparsec.d.ts"
Expand Down Expand Up @@ -147,8 +162,8 @@ parts:
npx tsc
if [ "${SENTRY_AUTH_TOKEN:=}" != "__TOKEN__" ] && [ -n "${SENTRY_AUTH_TOKEN:=}" ]; then
npm exec sentry-cli -- sourcemaps inject --release $SENTRY_RELEASE ./build
npm exec sentry-cli -- sourcemaps upload --release $SENTRY_RELEASE --dist $SENTRY_DIST ./build
SENTRY_PROJECT=$SENTRY_CLIENT_PROJECT npm exec sentry-cli -- sourcemaps inject --release $SENTRY_RELEASE ./build
SENTRY_PROJECT=$SENTRY_CLIENT_PROJECT npm exec sentry-cli -- sourcemaps upload --release $SENTRY_RELEASE --dist $SENTRY_DIST ./build
else
echo "SENTRY_AUTH_TOKEN is not set, skipping source maps upload." >&2
fi
Expand Down

0 comments on commit 0196402

Please sign in to comment.