feature add sentry for catch crash on win (#50)

* feature add sentry for soft catch dmp

* feature add cli upload pdb to sentry server

* feature add flag for control sentry to use

* fix  flag not effect on src/makefile

* feature unzip for dmp file to upload sentry server

* feature remove test code

* feature add api for function report log to server

* feature update the soft version
This commit is contained in:
Alves
2025-12-05 09:19:32 +08:00
committed by GitHub
parent b28f1f2de4
commit b0b7890c9e
17 changed files with 599 additions and 159 deletions

View File

@@ -151,7 +151,7 @@ jobs:
if-no-files-found: error
- name: Deploy Flatpak to nightly release
if: ${{github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.0'}}
if: ${{github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.1'}}
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/Snapmaker/OrcaSlicer/releases/169912305/assets{?name,label}

View File

@@ -150,3 +150,14 @@ jobs:
os: ${{ inputs.os }}
arch: ${{ inputs.arch }}
secrets: inherit
upload_symbols:
name: Upload Debug Symbols to Sentry
needs: [build_orca]
if: ${{ !cancelled() && needs.build_orca.result == 'success' }}
uses: ./.github/workflows/sentry_cli.yml
with:
os: ${{ inputs.os }}
pdb-artifact-name: PDB
release: ${{ github.sha }}
secrets: inherit

View File

@@ -18,6 +18,8 @@ jobs:
build_orca:
name: Build Snapmaker_Orca
runs-on: ${{ inputs.os }}
outputs:
release: ${{ steps.set_release.outputs.release || steps.set_release_win.outputs.release }}
env:
date:
ver:
@@ -77,6 +79,21 @@ jobs:
echo "date: ${{ env.date }} version: ${{ env.ver }}"
shell: pwsh
- name: Set release output (non-Windows)
id: set_release
if: inputs.os != 'windows-latest'
run: |
echo "release=$ver" >> $GITHUB_OUTPUT
shell: bash
- name: Set release output (Windows)
id: set_release_win
if: inputs.os == 'windows-latest'
run: |
$release = $env:ver
Write-Output ("release=$release") | Out-File -Append -FilePath $env:GITHUB_OUTPUT -Encoding utf8
shell: pwsh
# Mac
- name: Install tools mac
if: inputs.os == 'macos-14'
@@ -289,7 +306,7 @@ jobs:
path: ${{ github.workspace }}/build/src/Release/Snapmaker_Orca_profile_validator.exe
- name: Deploy Windows release portable
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.0') && inputs.os == 'windows-latest'
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.1') && inputs.os == 'windows-latest'
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/Snapmaker/OrcaSlicer/releases/169912305/assets{?name,label}
@@ -300,7 +317,7 @@ jobs:
max_releases: 1
- name: Deploy Windows release installer
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.0') && inputs.os == 'windows-latest'
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.1') && inputs.os == 'windows-latest'
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/Snapmaker/OrcaSlicer/releases/169912305/assets{?name,label}
@@ -311,7 +328,7 @@ jobs:
max_releases: 1
- name: Deploy Windows Snapmaker_Orca_profile_validator release
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.0') && inputs.os == 'windows-latest'
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.1') && inputs.os == 'windows-latest'
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/Snapmaker/OrcaSlicer/releases/169912305/assets{?name,label}
@@ -385,7 +402,7 @@ jobs:
path: './build/src/Release/Snapmaker_Orca_profile_validator'
- name: Deploy Ubuntu release
if: ${{ ! env.ACT && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.0') && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
if: ${{ ! env.ACT && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.1') && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
env:
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
uses: WebFreak001/deploy-nightly@v3.2.0
@@ -406,7 +423,7 @@ jobs:
message: "nightly-builds"
- name: Deploy Ubuntu Snapmaker_Orca_profile_validator release
if: ${{ ! env.ACT && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.0') && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
if: ${{ ! env.ACT && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.1') && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
env:
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
uses: WebFreak001/deploy-nightly@v3.2.0
@@ -419,7 +436,7 @@ jobs:
max_releases: 1
- name: Deploy orca_custom_preset_tests
if: ${{ ! env.ACT && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.0') && inputs.os == 'ubuntu-24.04' }}
if: ${{ ! env.ACT && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.2.1') && inputs.os == 'ubuntu-24.04' }}
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/Snapmaker/OrcaSlicer/releases/169912305/assets{?name,label}

92
.github/workflows/sentry_cli.yml vendored Normal file
View File

@@ -0,0 +1,92 @@
name: Upload Debug Symbols to Sentry
on:
workflow_call:
inputs:
os:
required: true
type: string
description: "Target OS: windows-latest, macos-14, ubuntu-20.04, ubuntu-24.04"
pdb-artifact-name:
required: false
type: string
description: "Artifact name for Windows PDB archive (e.g., 'PDB')"
release:
required: true
type: string
description: "Release version/tag"
jobs:
upload_symbols:
name: Upload Debug Symbols to Sentry
runs-on: ${{ inputs.os }}
steps:
# ==================== Windows ====================
- name: "[Windows] Install sentry-cli via choco"
if: inputs.os == 'windows-latest'
shell: pwsh
run: |
choco install sentry-cli -y -y 2>&1 | Out-Null
- name: "[Windows] Download PDB artifact"
if: inputs.os == 'windows-latest'
uses: actions/download-artifact@v4
with:
name: ${{ inputs.pdb-artifact-name }}
path: ./symbols
- name: "[Windows] Extract PDB archive"
if: inputs.os == 'windows-latest'
shell: pwsh
run: |
$archive = Get-ChildItem -Path ./symbols -Filter "*.7z" -File | Select-Object -First 1
if ($archive) {
Write-Host "Found archive: $($archive.FullName)"
Write-Host "Extracting to ./symbols/extracted ..."
7z x "$($archive.FullName)" -o"./symbols/extracted" -y
if ($LASTEXITCODE -ne 0) {
Write-Host "::error::Failed to extract archive with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-Host "Extraction complete. Contents:"
Get-ChildItem -Path ./symbols/extracted -Recurse | ForEach-Object { Write-Host " $($_.FullName)" }
} else {
Write-Host "No .7z archive found, assuming PDB files are already extracted"
Get-ChildItem -Path ./symbols -Recurse | ForEach-Object { Write-Host " Found: $($_.FullName)" }
}
- name: "[Windows] Upload PDB to Sentry (sentry-cli)"
if: inputs.os == 'windows-latest'
shell: pwsh
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_LOG_LEVEL: debug
run: |
# Determine upload path - prefer extracted folder if it exists
$uploadPath = "./symbols"
if (Test-Path "./symbols/extracted") {
$uploadPath = "./symbols/extracted"
}
$pdbFiles = Get-ChildItem -Path $uploadPath -Filter "*.pdb" -File -Recurse
if ($pdbFiles.Count -gt 0) {
Write-Host "Found $($pdbFiles.Count) PDB file(s) to upload from $uploadPath :"
$pdbFiles | ForEach-Object { Write-Host " - $($_.FullName)" }
Write-Host ""
Write-Host "Starting Sentry upload with debug logging..."
sentry-cli.exe --log-level=debug --auth-token $env:SENTRY_AUTH_TOKEN upload-dif --org "${{ secrets.SENTRY_ORG }}" --project "${{ secrets.SENTRY_PROJECT }}" $uploadPath 2>&1 | Out-Host
if ($LASTEXITCODE -ne 0) {
Write-Host "::error::Sentry upload failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
} else {
Write-Host "::error::No PDB files found in $uploadPath"
Get-ChildItem -Path ./symbols -Recurse | ForEach-Object { Write-Host " Found: $($_.FullName)" }
exit 1
}
# ==================== macOS ====================
# ==================== Linux ====================