Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ jobs:
with:
name: package-release

- name: Check plugin platform scopes
shell: pwsh
run: ./test/Scripts.Tests/test-plugin-platforms.ps1

- name: Check snapshot
id: snapshot-check
shell: pwsh
Expand Down Expand Up @@ -427,6 +431,23 @@ jobs:
with:
unity-version: ${{ matrix.unity-version }}

test-build-windows-mono:
# The Mono scripting backend resolves P/Invokes differently than IL2CPP, so it needs its own
# player. One version, default (Crashpad) backend only: the IL2CPP matrix already covers the
# version spread and both backends. The version is the first matrix entry rather than a
# literal, because `test-create` only builds what the matrix holds and Unity-bump PRs narrow
# it to the bumped version. The lists in create-unity-matrix.yml are oldest-first.
name: Build Windows Mono ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-create, create-unity-matrix]
secrets:
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
uses: ./.github/workflows/test-build-windows-mono.yml
with:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }}

test-build-macos:
name: Build macOS ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
Expand Down Expand Up @@ -479,6 +500,20 @@ jobs:
platform: windows
backend: ${{ matrix.backend }}

test-run-windows-mono:
name: Run Windows Mono ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-build-windows-mono, create-unity-matrix]
secrets:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
uses: ./.github/workflows/test-run-desktop.yml
with:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }}
platform: windows
scripting: mono
backend: crashpad

test-run-macos:
name: Run macOS ${{ matrix.backend }} ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
Expand Down
137 changes: 137 additions & 0 deletions .github/workflows/test-build-windows-mono.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: "Test: Build Windows Mono"
on:
workflow_call:
inputs:
unity-version:
required: true
type: string
secrets:
UNITY_LICENSE_SERVER_CONFIG:
required: true
SENTRY_AUTH_TOKEN:
required: true
SENTRY_TEST_DSN:
required: true

defaults:
run:
shell: pwsh

jobs:
build:
name: Windows Mono ${{ inputs.unity-version }}
runs-on: windows-latest
env:
UNITY_VERSION: ${{ inputs.unity-version }}
BUILD_PLATFORM: Windows-Mono

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Load env
id: env
run: |
$u = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}'
"unityVersion=$($u.version)" >> $env:GITHUB_OUTPUT
"unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT

- name: Setup Unity
uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3
with:
unity-version: ${{ steps.env.outputs.unityVersion }}
unity-version-changeset: ${{ steps.env.outputs.unityChangeset }}
unity-modules: windows-il2cpp

- name: Create Unity license config
run: |
New-Item -Path "C:/ProgramData/Unity/config/" -ItemType Directory -Force
Set-Content -Path "C:/ProgramData/Unity/config/services-config.json" -Value "$env:UNITY_LICENSE_SERVER_CONFIG"
env:
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}

- name: Download IntegrationTest project
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: test-${{ env.UNITY_VERSION }}

- name: Extract project archive
run: tar -xvzf test-project.tar.gz

- name: Restore Unity Library cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: samples/IntegrationTest/Library
key: it-library-windows-mono-${{ env.UNITY_VERSION }}-${{ github.run_id }}
restore-keys: |
it-library-windows-mono-${{ env.UNITY_VERSION }}-

- name: Download UPM package
uses: ./.github/actions/wait-for-artifact
with:
name: package-release

- name: Extract UPM package
run: ./test/Scripts.Integration.Test/extract-package.ps1

- name: Add Sentry to the project
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"

- name: Download DependencyConflict package
uses: ./.github/actions/wait-for-artifact
with:
name: dependency-conflict-package
path: dependency-conflict-package

- name: Add DependencyConflict to the project
run: ./test/Scripts.Integration.Test/add-dependency-conflict.ps1 -PackagePath "dependency-conflict-package"

- name: Configure Sentry
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}

# Crashpad backend only. The point of this job is that a Mono player resolves the
# P/Invokes to `sentry-native` instead of the managed `Sentry.dll` at all; both Windows
# backends bind against the same library, and the IL2CPP matrix already covers the
# backend spread. Crashpad is what players ship with by default.
- name: Build with Sentry SDK
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows-Mono -UnityVersion "$env:UNITY_VERSION"
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

- name: Assert symbols and sources were uploaded
run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath unity.log

# We create tar explicitly because upload-artifact is slow for many files.
- name: Create archive
run: |
Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue
Copy-Item unity.log samples/IntegrationTest/Build/ -ErrorAction SilentlyContinue
tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build

- name: Upload test app
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-windows-mono-crashpad
if-no-files-found: error
path: test-app-desktop.tar.gz
retention-days: 14

- name: Save Unity Library cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: samples/IntegrationTest/Library
key: it-library-windows-mono-${{ env.UNITY_VERSION }}-${{ github.run_id }}

- name: Upload IntegrationTest project on failure
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: failed-project-desktop-windows-mono-${{ env.UNITY_VERSION }}
path: |
samples/IntegrationTest
unity.log
!samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
retention-days: 14
13 changes: 10 additions & 3 deletions .github/workflows/test-run-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
type: string
default: ""
description: "macOS: native or cocoa. Windows: native or crashpad. Linux: native or breakpad."
scripting:
required: false
type: string
default: ""
description: "Only set for non-default scripting backends, e.g. mono for the Windows Mono player."
secrets:
SENTRY_AUTH_TOKEN:
required: true
Expand All @@ -26,7 +31,7 @@ defaults:

jobs:
run:
name: ${{ inputs.platform }}${{ inputs.backend && format(' ({0})', inputs.backend) || '' }} ${{ inputs.unity-version }}
name: ${{ inputs.platform }}${{ inputs.scripting && format(' {0}', inputs.scripting) || '' }}${{ 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 }}
Expand All @@ -43,7 +48,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 }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}
name: testapp-desktop-compiled-${{ inputs.unity-version }}-${{ inputs.platform }}${{ inputs.scripting && format('-{0}', inputs.scripting) || '' }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}

- name: Extract test app
run: tar -xvzf test-app-desktop.tar.gz
Expand Down Expand Up @@ -81,6 +86,8 @@ jobs:
- name: Run Integration Tests (Windows)
if: inputs.platform == 'windows'
timeout-minutes: 20
env:
SENTRY_TEST_SCRIPTING_BACKEND: ${{ inputs.scripting }}
run: |
$env:SENTRY_TEST_PLATFORM = "Desktop"
$env:SENTRY_TEST_APP = "samples/IntegrationTest/Build/test.exe"
Expand All @@ -90,7 +97,7 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: testapp-desktop-logs-${{ inputs.platform }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}-${{ inputs.unity-version }}
name: testapp-desktop-logs-${{ inputs.platform }}${{ inputs.scripting && format('-{0}', inputs.scripting) || '' }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}-${{ inputs.unity-version }}
path: |
test/IntegrationTest/results/
retention-days: 14
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ package-dev/Plugins/Windows/SentryNative~/*
package-dev/Plugins/Linux/Sentry~/*
package-dev/Plugins/Linux/SentryNative~/*

# macOS SDK files
package-dev/Plugins/macOS/Sentry~/*
package-dev/Plugins/macOS/SentryNative~/*

# CLI
package-dev/Editor/sentry-cli

Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ Read only guide relevant to task. Do not import all guides at startup.
## Commits

- Use direct, capitalized commit subjects without conventional-commit prefixes.
- Include the committing agent's own `Co-Authored-By` attribution when a commit is requested.
- Do not add agent attribution trailers such as `Co-Authored-By`.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

### Fixes

- When targeting Windows using the `Mono` scripting backend the SDK now correctly loads `sentry-native` to capture native crashes. ([#2842](https://github.com/getsentry/sentry-unity/pull/2842))
- Fixed a `NoSuchFieldError` during initialization on Android when setting the `sample rate`. ([#2838](https://github.com/getsentry/sentry-unity/issues/2838))
- Individual assemblies and plugins are now scoped to the platforms that use them. ([#2848](https://github.com/getsentry/sentry-unity/pull/2848))
- When targeting Nintendo Switch or Switch 2 the SDK no longer fails to initialize the native layer at runtime. The respective stubs are now written to `Assets/Plugins/Sentry` so the SDK can enable and disable them before the build starts. ([#2849](https://github.com/getsentry/sentry-unity/pull/2849))

### Dependencies

Expand Down
Loading
Loading