diff --git a/.github/actions/setup-sentry-cli/action.yml b/.github/actions/setup-sentry-cli/action.yml new file mode 100644 index 00000000000..58eea478a64 --- /dev/null +++ b/.github/actions/setup-sentry-cli/action.yml @@ -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 diff --git a/.github/workflows/package-client.yml b/.github/workflows/package-client.yml index 659b56d26fd..a45e1bf855f 100644 --- a/.github/workflows/package-client.yml +++ b/.github/workflows/package-client.yml @@ -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 @@ -106,6 +107,9 @@ jobs: with: tool: syft@0.84.0, 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 @@ -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 @@ -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: @@ -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: diff --git a/client/electron/snap/snapcraft.yaml b/client/electron/snap/snapcraft.yaml index 85dea98c8d6..5f33ef1ee95 100644 --- a/client/electron/snap/snapcraft.yaml +++ b/client/electron/snap/snapcraft.yaml @@ -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 @@ -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" @@ -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