diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f64c3dc5a..ed0309e6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,6 +92,12 @@ jobs: name: Cocoa-sdk path: package-dev/Plugins + - name: Download MacOSNative SDK + uses: ./.github/actions/wait-for-artifact + with: + name: MacOSNative-sdk + path: package-dev/Plugins/macOS/SentryNative~ + - name: Download Linux SDK uses: ./.github/actions/wait-for-artifact with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0414c8868..1cfee42fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,8 @@ jobs: host: windows-latest - target: Cocoa host: macos-latest + - target: MacOSNative + host: macos-latest uses: ./.github/workflows/sdk.yml with: target: ${{ matrix.target }} @@ -421,7 +423,7 @@ jobs: platform: windows test-run-macos: - name: Run macOS ${{ matrix.unity-version }} Integration Test + name: Run macOS ${{ matrix.backend }} ${{ matrix.unity-version }} Integration Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [test-build-macos, create-unity-matrix] secrets: inherit @@ -429,10 +431,12 @@ jobs: fail-fast: false matrix: unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }} + backend: ["cocoa", "native"] uses: ./.github/workflows/test-run-desktop.yml with: unity-version: ${{ matrix.unity-version }} platform: macos + backend: ${{ matrix.backend }} build-size-summary: name: Build Size diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index 35c963615..e3819943b 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -107,12 +107,20 @@ jobs: name: ${{ env.TARGET }}-sdk path: | package-dev/Plugins/iOS/Sentry.xcframework~ - package-dev/Plugins/macOS/Sentry + package-dev/Plugins/macOS/Sentry~ # Lower retention period - we only need this to retry CI. retention-days: 14 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - if: ${{ env.TARGET != 'Cocoa' }} + if: ${{ env.TARGET == 'MacOSNative' }} + with: + name: ${{ env.TARGET }}-sdk + path: package-dev/Plugins/macOS/SentryNative~ + # Lower retention period - we only need this to retry CI. + retention-days: 14 + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + if: ${{ env.TARGET != 'Cocoa' && env.TARGET != 'MacOSNative' }} with: name: ${{ env.TARGET }}-sdk path: package-dev/Plugins/${{ env.TARGET }} diff --git a/.github/workflows/test-build-macos.yml b/.github/workflows/test-build-macos.yml index 300b9f517..a2593e1c6 100644 --- a/.github/workflows/test-build-macos.yml +++ b/.github/workflows/test-build-macos.yml @@ -87,7 +87,7 @@ jobs: env: SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }} - - name: Build with Sentry SDK + - name: Build with Sentry SDK (Cocoa backend) run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform MacOS -UnityVersion "$env:UNITY_VERSION" - name: Compare build sizes @@ -101,15 +101,39 @@ jobs: retention-days: 1 # We create tar explicitly because upload-artifact is slow for many files. - - name: Create archive + - name: Create archive (Cocoa backend) run: | Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build - - name: Upload test app + - name: Upload test app (Cocoa backend) uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-macos + name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-macos-cocoa + if-no-files-found: error + path: test-app-desktop.tar.gz + retention-days: 14 + + - name: Overwrite IntegrationOptionsConfiguration for Native backend + run: | + $optionsPath = "samples/IntegrationTest/Assets/Scripts/IntegrationOptionsConfiguration.cs" + $content = Get-Content $optionsPath -Raw + $content = $content -replace 'MacosBackend = MacosBackend.Cocoa', 'MacosBackend = MacosBackend.Native' + Set-Content $optionsPath $content + + - name: Build with Sentry SDK (Native backend) + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform MacOS -UnityVersion "$env:UNITY_VERSION" + + - name: Create archive (Native backend) + run: | + Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue + Remove-Item -Force test-app-desktop.tar.gz -ErrorAction SilentlyContinue + tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build + + - name: Upload test app (Native backend) + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-macos-native if-no-files-found: error path: test-app-desktop.tar.gz retention-days: 14 diff --git a/.github/workflows/test-run-desktop.yml b/.github/workflows/test-run-desktop.yml index 771c60c0a..3f3a7be91 100644 --- a/.github/workflows/test-run-desktop.yml +++ b/.github/workflows/test-run-desktop.yml @@ -9,6 +9,11 @@ on: required: true type: string description: "linux, windows, or macos" + backend: + required: false + type: string + default: "" + description: "macOS only: native or cocoa" defaults: run: @@ -16,7 +21,7 @@ defaults: jobs: run: - name: ${{ inputs.platform }} ${{ inputs.unity-version }} + name: ${{ inputs.platform }}${{ inputs.backend && format(' ({0})', inputs.backend) || '' }} ${{ inputs.unity-version }} runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-latest' || inputs.platform == 'macos' && 'macos-latest' || 'windows-latest' }} env: SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }} @@ -33,7 +38,7 @@ jobs: - name: Download test app artifact uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: - name: testapp-desktop-compiled-${{ inputs.unity-version }}-${{ inputs.platform }} + name: testapp-desktop-compiled-${{ inputs.unity-version }}-${{ inputs.platform }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }} - name: Extract test app run: tar -xvzf test-app-desktop.tar.gz @@ -78,7 +83,7 @@ jobs: if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: testapp-desktop-logs-${{ inputs.platform }}-${{ inputs.unity-version }} + name: testapp-desktop-logs-${{ inputs.platform }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}-${{ inputs.unity-version }} path: | test/IntegrationTest/results/ retention-days: 14 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b7e6ba02..64761128f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Features + +- Introduce `sentry-native` on macOS as experimental backend. This is an opt-in and accessible programmatically via the `options.Experimental`. The `sentry-native` backend allows for crashes to be sent immediately and will enable further updates, like `AppHangTracking` support ([#2687](https://github.com/getsentry/sentry-unity/pull/2687)) + ### Fixes - When targeting iOS, the SDK no longer crashes in `urlSessionTask:setState:` when handling an `AVAssetDownloadTask` ([#2677](https://github.com/getsentry/sentry-unity/pull/2677)) diff --git a/build/native-sdks.targets b/build/native-sdks.targets index 63be39e0e..01d91a264 100644 --- a/build/native-sdks.targets +++ b/build/native-sdks.targets @@ -5,7 +5,8 @@ $(RepoRoot)modules/sentry-cocoa/ $(SentryArtifactsDestination)iOS/Sentry.xcframework~/ - $(SentryArtifactsDestination)macOS/Sentry/ + $(SentryArtifactsDestination)macOS/Sentry~/ + $(SentryArtifactsDestination)macOS/SentryNative~/ $(RepoRoot)modules/sentry-java/ @@ -131,6 +132,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +