Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: WebGL - dotnet support #657

Merged
merged 40 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9aef26d
feat: JS error example
vaind Apr 11, 2022
817ae3a
chore: webgl sample - disable compression
vaind Apr 11, 2022
1a2e322
webgl
bruno-garcia Apr 11, 2022
4809076
fix: SentryWebGL version info sources
vaind Apr 11, 2022
9a6a063
Format code
getsentry-bot Apr 11, 2022
d233371
fix: WebGL BackgroundWorker implementation & sample packages
vaind Apr 11, 2022
82d18df
feat: implement WebGL with a custom HttpMessageHandler
vaind Apr 11, 2022
ff9a1f0
refactor: change WebGL implementation to override HttpTransport
vaind Apr 11, 2022
d179b83
chore: update WebGL sample test code
vaind Apr 11, 2022
cfd3697
feat: update SmokeTest for WebGL
vaind Apr 11, 2022
4aba6da
test: webgl smoke test script
vaind Apr 11, 2022
d7340a5
fix: compilation on Unity 2019
vaind Apr 11, 2022
6308a9d
test: finalize webGL test scripts
vaind Apr 11, 2022
26039fa
ci: add WebGL smoke test to CI
vaind Apr 11, 2022
1462cca
chore: minor code cleanup
vaind Apr 11, 2022
5c038a8
chore: reenable features on WebGL
vaind Apr 11, 2022
5b901a9
refactor: update WebGL to use HttpTransportBase
vaind Apr 11, 2022
06f6d1f
refactor: futer WebGL implementation cleanup
vaind Apr 11, 2022
ef58bd9
refactor: WebGL - use latest sentry-dotnet APIs
vaind Apr 11, 2022
b0b1cb1
chore: update changelog
vaind Apr 11, 2022
154ce69
fix: disable async file IO on WebGL
vaind Apr 11, 2022
0c5234d
ci: change docker image name to the new one with WebGL
vaind Apr 11, 2022
0831f9c
fix: compilation on Unity 2020+
vaind Apr 11, 2022
fa35fe6
Update src/Sentry.Unity/WebGL/SentryWebGL.cs
vaind Apr 11, 2022
5543f85
chore: cleanups
vaind Apr 12, 2022
39e0637
Apply suggestions from code review
vaind Apr 12, 2022
412b352
Merge branch 'main' into feat/webgl
vaind Apr 12, 2022
29e1adb
refactor: move WebRequest transport to its own file
vaind Apr 12, 2022
5bc3c87
chore: update package snapshot
vaind Apr 12, 2022
dcc1137
refactor: improve HttpRequestMessage stream type support
vaind Apr 12, 2022
cde6f21
chore: update broken python packages on CI
vaind Apr 13, 2022
810a772
chore: fix WebGL smoke test on CI
vaind Apr 13, 2022
5dac1d7
Merge branch 'main' into feat/webgl
vaind Apr 13, 2022
6fe1eb3
Merge branch 'main' into feat/webgl
vaind Apr 13, 2022
01769a5
fix: SmokeTester GetTestArg when in the editor
vaind Apr 13, 2022
78de6aa
Merge branch 'main' into feat/webgl
vaind Apr 13, 2022
bfdf9d8
chore: skip unity shader errors on webgl smoke test
vaind Apr 14, 2022
78cf31e
Merge branch 'main' into feat/webgl
vaind Apr 14, 2022
ce4cd4c
fixup: chore: skip unity shader errors on webgl smoke test
vaind Apr 14, 2022
9f82cd5
Apply suggestions from code review
vaind Apr 19, 2022
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 @@ -197,6 +197,18 @@ jobs:
path: samples/artifacts/builds/Android
if-no-files-found: error

- name: Build WebGL Player
run: |
docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:TestDsn=http://publickey@127.0.0.1:8000/12345 /p:Configuration=Release /p:OutDir=other src/Sentry.Unity
docker exec unity dotnet msbuild /t:UnityBuildPlayerWebGL /p:Configuration=Release /p:OutDir=other src/Sentry.Unity

- name: Upload WebGL Build
uses: actions/upload-artifact@v2
with:
name: testapp-webgl-${{ matrix.unity-version }}
path: samples/artifacts/builds/WebGL
if-no-files-found: error

package-validation:
needs: [build]
name: UPM Package validation
Expand Down Expand Up @@ -453,3 +465,26 @@ jobs:
$runtime = "iOS " + $runtime
}
./Scripts/smoke-test-ios.ps1 Test "$runtime"

webgl-smoke-test:
needs: [build]
name: Run WebGL Unity ${{ matrix.unity-version }} Smoke Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unity-version: ['2019', '2020', '2021']
steps:
- name: Checkout
uses: actions/checkout@v2.3.3

- name: Download test app artifact
uses: actions/download-artifact@v2
with:
name: testapp-webgl-${{ matrix.unity-version }}
path: samples/artifacts/builds/WebGL

- run: pip3 install --upgrade --user selenium urllib3 requests

- run: python3 scripts/smoke-test-webgl.py
timeout-minutes: 10
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features

- WebGL - .NET support ([#657](https://github.com/getsentry/sentry-unity/pull/657))
- Capture `Debug.LogError()` and `Debug.LogException()` also on background threads ([#673](https://github.com/getsentry/sentry-unity/pull/673))

- Adding override for Sentry CLI URL ([#666](https://github.com/getsentry/sentry-unity/pull/666))
Expand Down
16 changes: 16 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,22 @@ Related: https://forum.unity.com/threads/6572-debugger-agent-unable-to-listen-on
<!-- <Error Condition="!Exists('$(IOSBuildPath)')" Text="iOS build not found. Did something go wrong?"></Error> -->
</Target>

<!-- Build a WebGL player: dotnet msbuild /t:UnityBuildPlayerWebGL src/Sentry.Unity -->
<Target Name="UnityBuildPlayerWebGL" DependsOnTargets="FindUnity" Condition="'$(MSBuildProjectName)' == 'Sentry.Unity'">
<Error Condition="$(UnityRoot) == ''" Text="Couldn't find Unity."></Error>

<Message Importance="High" Text="Building the sample player for WebGL." />

<Exec Command="$(UnityExec) -quit -batchmode -nographics -logFile - -projectPath $(UnitySampleProjectPath) -executeMethod Builder.BuildWebGLPlayer -buildPath $(PlayerBuildPath)WebGL" IgnoreStandardErrorWarningFormat="true" />
</Target>

<!-- Run smoke test on the WebGL player: dotnet msbuild /t:UnitySmokeTestPlayerWebGL src/Sentry.Unity -->
<Target Name="UnitySmokeTestPlayerWebGL" DependsOnTargets="FindUnity" Condition="'$(MSBuildProjectName)' == 'Sentry.Unity'">
<Error Condition="$(UnityRoot) == ''" Text="Couldn't find Unity."></Error>

<Exec Command="python3 -X utf8 &quot;$(RepoRoot)/scripts/smoke-test-webgl.py&quot;" IgnoreStandardErrorWarningFormat="true"/>
vaind marked this conversation as resolved.
Show resolved Hide resolved
</Target>

<!-- If Unity Library Project doesn't exist, create a Unity project. We use this project to restore packages needed to build
this solution without using the sample project which depends on the output of this build. -->
<Target Name="UnityCreatePackages" Condition="!Exists('$(UnityPackageProject)') AND '$(MSBuildProjectName)' == 'Sentry.Unity'" AfterTargets="FindUnity">
Expand Down
6 changes: 6 additions & 0 deletions package-dev/Runtime/SentryInitialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#define SENTRY_NATIVE_ANDROID
#elif UNITY_STANDALONE_WIN && ENABLE_IL2CPP
#define SENTRY_NATIVE_WINDOWS
#elif UNITY_WEBGL
#define SENTRY_WEBGL
#endif
#endif

Expand All @@ -17,6 +19,8 @@
using Sentry.Unity.Android;
#elif SENTRY_NATIVE_WINDOWS
using Sentry.Unity.Native;
#elif SENTRY_WEBGL
using Sentry.Unity.WebGL;
#endif

[assembly: AlwaysLinkAssembly]
Expand All @@ -39,6 +43,8 @@ public static void Init()
SentryNativeAndroid.Configure(options, sentryUnityInfo);
#elif SENTRY_NATIVE_WINDOWS
SentryNative.Configure(options);
#elif SENTRY_WEBGL
SentryWebGL.Configure(options);
#endif

SentryUnity.Init(options);
Expand Down
1 change: 1 addition & 0 deletions samples/unity-of-bugs/Assets/Editor/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public static void BuildIl2CPPPlayer(BuildTarget target, BuildTargetGroup group)
public static void BuildLinuxIl2CPPPlayer() => BuildIl2CPPPlayer(BuildTarget.StandaloneLinux64, BuildTargetGroup.Standalone);
public static void BuildAndroidIl2CPPPlayer() => BuildIl2CPPPlayer(BuildTarget.Android, BuildTargetGroup.Android);
public static void BuildIOSPlayer() => BuildIl2CPPPlayer(BuildTarget.iOS, BuildTargetGroup.iOS);
public static void BuildWebGLPlayer() => BuildIl2CPPPlayer(BuildTarget.WebGL, BuildTargetGroup.WebGL);

private static void SetupSentryOptions(Dictionary<string, string> args)
{
Expand Down
Loading