Skip to content

Commit d1a59a6

Browse files
committed
capture all the envelopes
1 parent a01d8d6 commit d1a59a6

10 files changed

Lines changed: 737 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ jobs:
238238
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM"
239239
env:
240240
BUILD_PLATFORM: ${{ matrix.build_platform }}
241-
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
241+
SENTRY_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
242242

243243
- name: Build Project
244244
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -UnityVersion "$env:UNITY_VERSION"
@@ -294,7 +294,7 @@ jobs:
294294
secrets:
295295
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
296296
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
297-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
297+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
298298
strategy:
299299
fail-fast: false
300300
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
@@ -308,7 +308,7 @@ jobs:
308308
needs: [test-build-android, create-unity-matrix]
309309
secrets:
310310
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
311-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
311+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
312312
uses: ./.github/workflows/test-run-android.yml
313313
with:
314314
unity-version: ${{ matrix.unity-version }}
@@ -329,7 +329,7 @@ jobs:
329329
secrets:
330330
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
331331
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
332-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
332+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
333333
strategy:
334334
fail-fast: false
335335
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
@@ -362,7 +362,7 @@ jobs:
362362
init-type: ${{ matrix.init-type }}
363363
secrets:
364364
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
365-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
365+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
366366
strategy:
367367
fail-fast: false
368368
matrix:
@@ -386,7 +386,7 @@ jobs:
386386
needs: [test-build-webgl, create-unity-matrix]
387387
secrets:
388388
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
389-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
389+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
390390
strategy:
391391
fail-fast: false
392392
matrix:
@@ -402,7 +402,7 @@ jobs:
402402
secrets:
403403
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
404404
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
405-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
405+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
406406
strategy:
407407
fail-fast: false
408408
matrix:
@@ -418,7 +418,7 @@ jobs:
418418
secrets:
419419
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
420420
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
421-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
421+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
422422
strategy:
423423
fail-fast: false
424424
matrix:
@@ -434,7 +434,7 @@ jobs:
434434
secrets:
435435
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
436436
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
437-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
437+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
438438
strategy:
439439
fail-fast: false
440440
matrix:
@@ -449,7 +449,7 @@ jobs:
449449
needs: [test-build-linux, create-unity-matrix]
450450
secrets:
451451
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
452-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
452+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
453453
strategy:
454454
fail-fast: false
455455
matrix:
@@ -467,7 +467,7 @@ jobs:
467467
needs: [test-build-windows, create-unity-matrix]
468468
secrets:
469469
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
470-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
470+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
471471
strategy:
472472
fail-fast: false
473473
matrix:
@@ -485,7 +485,7 @@ jobs:
485485
needs: [test-build-macos, create-unity-matrix]
486486
secrets:
487487
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
488-
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
488+
SENTRY_TEST_DSN: http://capture@127.0.0.1:8000/1 # TEMPORARY: envelope capture, see docs/envelope-capture.md
489489
strategy:
490490
fail-fast: false
491491
matrix:
@@ -497,6 +497,43 @@ jobs:
497497
platform: macos
498498
backend: ${{ matrix.backend }}
499499

500+
# Merges the per-job envelope artifacts into a single `envelopes-all` download.
501+
# See docs/envelope-capture.md.
502+
collect-envelopes:
503+
name: Collect captured envelopes
504+
runs-on: ubuntu-latest
505+
if: ${{ always() }}
506+
needs: [test-run-android, test-run-ios, test-run-webgl, test-run-linux, test-run-windows, test-run-macos]
507+
steps:
508+
- name: Download all envelope artifacts
509+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
510+
with:
511+
pattern: envelopes-*
512+
merge-multiple: true
513+
path: envelopes
514+
515+
- name: Summarize corpus
516+
run: |
517+
"## Captured envelopes`n" >> $env:GITHUB_STEP_SUMMARY
518+
"| Platform | Payloads | Test actions |" >> $env:GITHUB_STEP_SUMMARY
519+
"| --- | --- | --- |" >> $env:GITHUB_STEP_SUMMARY
520+
$total = 0
521+
Get-ChildItem -Path envelopes -Recurse -Filter index.jsonl | Sort-Object { $_.Directory.Name } | ForEach-Object {
522+
$entries = Get-Content $_.FullName | ForEach-Object { $_ | ConvertFrom-Json }
523+
$total += $entries.Count
524+
$actions = ($entries | ForEach-Object { $_.label } | Sort-Object -Unique) -join ", "
525+
"| $($_.Directory.Name) | $($entries.Count) | $actions |" >> $env:GITHUB_STEP_SUMMARY
526+
}
527+
"`nTotal: $total payloads" >> $env:GITHUB_STEP_SUMMARY
528+
529+
- name: Upload combined corpus
530+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
531+
with:
532+
name: envelopes-all
533+
path: envelopes/
534+
if-no-files-found: error
535+
retention-days: 14
536+
500537
build-size-summary:
501538
name: Build Size
502539
runs-on: ubuntu-latest

.github/workflows/test-run-android.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ jobs:
8484
mkdir -p $HOME/.android/avd
8585
touch $HOME/.android/repositories.cfg
8686
87+
# Envelope capture: only active when ci.yml was dispatched with `capture-envelopes`, which
88+
# points the DSN baked into the test build at 127.0.0.1:8000. `adb reverse` below tunnels that
89+
# port from the device to the runner. See docs/envelope-capture.md.
90+
- name: Start envelope capture server
91+
if: contains(env.SENTRY_DSN, '127.0.0.1')
92+
run: ./test/Scripts.Integration.Test/start-capture-server.ps1 -Platform "android-${{ inputs.api-level }}-${{ inputs.unity-version }}-${{ inputs.init-type }}"
93+
8794
- name: Run Android Integration Tests (emulator)
8895
if: ${{ steps.device.outputs.device == 'emulator' }}
8996
uses: reactivecircus/android-emulator-runner@0a638108440efd5c7f980e6ba145dbcdd8f32009 # v2.37.0
@@ -111,6 +118,7 @@ jobs:
111118
adb wait-for-device
112119
adb shell input keyevent 82
113120
adb devices -l
121+
adb reverse tcp:8000 tcp:8000
114122
pwsh -Command '$env:SENTRY_TEST_PLATFORM = "Android"; $env:SENTRY_TEST_APP = "samples/IntegrationTest/Build/test.apk"; Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI'
115123
116124
# --- arm64 path: Redroid container on the arm64 runner (no hypervisor needed) ---
@@ -168,10 +176,24 @@ jobs:
168176
Start-Sleep -Seconds 5
169177
}
170178
adb devices -l
179+
adb reverse tcp:8000 tcp:8000
171180
$env:SENTRY_TEST_PLATFORM = "Android"
172181
$env:SENTRY_TEST_APP = "samples/IntegrationTest/Build/test.apk"
173182
Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI
174183
184+
- name: Stop envelope capture server
185+
if: ${{ always() && contains(env.SENTRY_DSN, '127.0.0.1') }}
186+
run: Invoke-WebRequest -Uri "http://127.0.0.1:8000/STOP" -TimeoutSec 5 -UseBasicParsing -ErrorAction SilentlyContinue | Out-Null
187+
188+
- name: Upload captured envelopes
189+
if: ${{ always() && contains(env.SENTRY_DSN, '127.0.0.1') }}
190+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
191+
with:
192+
name: envelopes-android-${{ inputs.api-level }}-${{ inputs.unity-version }}-${{ inputs.init-type }}
193+
path: test/IntegrationTest/envelopes/
194+
if-no-files-found: warn
195+
retention-days: 14
196+
175197
- name: Upload test results on failure
176198
if: ${{ failure() }}
177199
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/test-run-desktop.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ jobs:
5858
run: chmod +x samples/IntegrationTest/Build/test.app/Contents/MacOS/IntegrationTest
5959
shell: bash
6060

61+
# Envelope capture: only active when ci.yml was dispatched with `capture-envelopes`, which
62+
# points the DSN baked into the test build at 127.0.0.1:8000. See docs/envelope-capture.md.
63+
- name: Start envelope capture server
64+
if: contains(env.SENTRY_DSN, '127.0.0.1')
65+
run: ./test/Scripts.Integration.Test/start-capture-server.ps1 -Platform "${{ inputs.platform }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}-${{ inputs.unity-version }}"
66+
6167
- name: Run Integration Tests (Linux)
6268
if: inputs.platform == 'linux'
6369
timeout-minutes: 20
@@ -86,6 +92,19 @@ jobs:
8692
$env:SENTRY_TEST_APP = "samples/IntegrationTest/Build/test.exe"
8793
Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI
8894
95+
- name: Stop envelope capture server
96+
if: ${{ always() && contains(env.SENTRY_DSN, '127.0.0.1') }}
97+
run: Invoke-WebRequest -Uri "http://127.0.0.1:8000/STOP" -TimeoutSec 5 -UseBasicParsing -ErrorAction SilentlyContinue | Out-Null
98+
99+
- name: Upload captured envelopes
100+
if: ${{ always() && contains(env.SENTRY_DSN, '127.0.0.1') }}
101+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
102+
with:
103+
name: envelopes-${{ inputs.platform }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}-${{ inputs.unity-version }}
104+
path: test/IntegrationTest/envelopes/
105+
if-no-files-found: warn
106+
retention-days: 14
107+
89108
- name: Upload test results on failure
90109
if: ${{ failure() }}
91110
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/test-run-ios.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ jobs:
6565
with:
6666
xcode-version: '15.0' # to run iOS 17.0 we need Xcode 15.0
6767

68+
# Envelope capture: only active when ci.yml was dispatched with `capture-envelopes`, which
69+
# points the DSN baked into the test build at 127.0.0.1:8000. The simulator shares the host
70+
# loopback, so no port forwarding is needed. See docs/envelope-capture.md.
71+
- name: Start envelope capture server
72+
if: contains(env.SENTRY_DSN, '127.0.0.1')
73+
run: ./test/Scripts.Integration.Test/start-capture-server.ps1 -Platform "ios-${{ env.IOS_VERSION }}-${{ env.UNITY_VERSION }}-${{ env.INIT_TYPE }}"
74+
6875
- name: Run iOS Integration Tests
6976
id: integration-test
7077
timeout-minutes: 20
@@ -76,6 +83,19 @@ jobs:
7683
Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI
7784
echo "status=success" >> $env:GITHUB_OUTPUT
7885
86+
- name: Stop envelope capture server
87+
if: ${{ always() && contains(env.SENTRY_DSN, '127.0.0.1') }}
88+
run: Invoke-WebRequest -Uri "http://127.0.0.1:8000/STOP" -TimeoutSec 5 -UseBasicParsing -ErrorAction SilentlyContinue | Out-Null
89+
90+
- name: Upload captured envelopes
91+
if: ${{ always() && contains(env.SENTRY_DSN, '127.0.0.1') }}
92+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
93+
with:
94+
name: envelopes-ios-${{ env.IOS_VERSION }}-${{ env.UNITY_VERSION }}-${{ env.INIT_TYPE }}
95+
path: test/IntegrationTest/envelopes/
96+
if-no-files-found: warn
97+
retention-days: 14
98+
7999
- name: Upload test results on failure
80100
if: ${{ failure() }}
81101
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/test-run-webgl.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ jobs:
4343
run: pip3 install --upgrade selenium
4444
shell: bash
4545

46+
# Envelope capture: only active when ci.yml was dispatched with `capture-envelopes`, which
47+
# points the DSN baked into the test build at 127.0.0.1:8000. The capture server answers CORS
48+
# preflights so the browser can post to it cross-origin. See docs/envelope-capture.md.
49+
- name: Start envelope capture server
50+
if: contains(env.SENTRY_DSN, '127.0.0.1')
51+
run: ./test/Scripts.Integration.Test/start-capture-server.ps1 -Platform "webgl-${{ inputs.unity-version }}"
52+
4653
- name: Run Integration Tests
4754
timeout-minutes: 20
4855
run: |
@@ -51,6 +58,19 @@ jobs:
5158
$env:SENTRY_TEST_UNITY_VERSION = "${{ inputs.unity-version }}"
5259
Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI
5360
61+
- name: Stop envelope capture server
62+
if: ${{ always() && contains(env.SENTRY_DSN, '127.0.0.1') }}
63+
run: Invoke-WebRequest -Uri "http://127.0.0.1:8000/STOP" -TimeoutSec 5 -UseBasicParsing -ErrorAction SilentlyContinue | Out-Null
64+
65+
- name: Upload captured envelopes
66+
if: ${{ always() && contains(env.SENTRY_DSN, '127.0.0.1') }}
67+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
68+
with:
69+
name: envelopes-webgl-${{ inputs.unity-version }}
70+
path: test/IntegrationTest/envelopes/
71+
if-no-files-found: warn
72+
retention-days: 14
73+
5474
- name: Upload test results on failure
5575
if: ${{ failure() }}
5676
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

0 commit comments

Comments
 (0)