Skip to content
Open
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
46 changes: 46 additions & 0 deletions .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,52 @@ runs:

steps:

# The Windows images keep .NET under Program Files, where workloads install as MSI packages, and the NuGet cache
# in the user profile on C:. So .NET goes next to the workspace, where workloads install as plain files. The x64
# runners put the workspace on D:, so the NuGet packages go there too. The arm64 runners only have C:, so the
# NuGet packages and TEMP go on a Dev Drive there. Defender already excludes C:\ on these images.
- name: Install .NET and NuGet packages on a fast drive
if: runner.os == 'Windows'
shell: pwsh
run: |
$root = Split-Path $env:GITHUB_WORKSPACE
"DOTNET_INSTALL_DIR=$root\.dotnet" >> $env:GITHUB_ENV
if ($root.StartsWith('C:'))
{
try
{
# Only volumes mounted after this get no antivirus filters
fsutil devdrv enable /disallowAv | Out-Host
'create vdisk file="C:\devdrive.vhdx" maximum=81920 type=expandable', 'select vdisk file="C:\devdrive.vhdx"', 'attach vdisk', 'convert gpt', 'create partition primary' |
Set-Content "$env:RUNNER_TEMP\diskpart.txt"
diskpart /s "$env:RUNNER_TEMP\diskpart.txt" | Out-Host
if ($LASTEXITCODE -ne 0) { throw "diskpart failed with exit code $LASTEXITCODE" }
$partition = Get-DiskImage -ImagePath 'C:\devdrive.vhdx' | Get-Disk | Get-Partition | Where-Object Type -eq 'Basic'
$partition | Format-Volume -DevDrive -Confirm:$false -Force | Out-Host
$partition | Add-PartitionAccessPath -AccessPath 'X:\'
# Right after the mount, trust can fail with "Access is denied" while the volume is still in use
for ($attempt = 1; $attempt -le 5; $attempt++)
{
fsutil devdrv trust X: | Out-Host
if ($LASTEXITCODE -eq 0) { break }
Start-Sleep -Seconds 3
}
if ($LASTEXITCODE -ne 0) { Write-Warning "Couldn't mark X: as a trusted Dev Drive, so antivirus filters may still scan it" }
fsutil devdrv query X: | Out-Host
New-Item -ItemType Directory 'X:\tmp' | Out-Null
'TEMP=X:\tmp' >> $env:GITHUB_ENV
'TMP=X:\tmp' >> $env:GITHUB_ENV
$root = 'X:'
}
catch
{
# The Dev Drive is a speedup, so the job goes on without it
Write-Warning "Couldn't set up the Dev Drive, so the NuGet packages stay next to the workspace: $_"
}
}
"NUGET_PACKAGES=$root\.nuget\packages" >> $env:GITHUB_ENV
$global:LASTEXITCODE = 0
- name: Set Global Environment Variables
shell: bash
run: |
Expand Down
192 changes: 187 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,14 @@ jobs:
- name: Integration test
# # Note that when upgrading .NET versions, linux-musl may need special handling... see comments below
# if: ${{ (matrix.rid != 'linux-musl-x64') && (matrix.rid != 'linux-musl-arm64') }}
# TODO: Re-enable once we have resolved https://github.com/getsentry/sentry-dotnet/issues/4788
if: ${{ (matrix.rid != 'linux-musl-x64') }}
# TODO: Re-enable for linux-musl-x64 once we have resolved https://github.com/getsentry/sentry-dotnet/issues/4788
# The other legs' integration tests run in the integration-test job
if: matrix.rid == 'linux-arm64' || matrix.rid == 'linux-musl-arm64' || matrix.rid == 'macos'
uses: getsentry/github-workflows/sentry-cli/integration-test@959162c159b866489d3fabe93327f48f9b8cb7ee # 3.4.1
# The MAUI cases run in the integration-test job, against packages built there. On release branches they run
# here too, so the packages craft publishes are the ones tested.
env:
SKIP_MAUI_TESTS: ${{ runner.os == 'macOS' && !startsWith(github.ref_name, 'release/') }}
with:
path: integration-test

Expand All @@ -336,6 +341,96 @@ jobs:
# with:
# path: integration-test

# These run integration tests next to a build leg, against packages built here from only the projects the tests
# use, which the Sentry-CI-IntegrationTest filters list. CI_PUBLISHING_BUILD only adds the other platforms' native
# libraries and sentry-cli binaries, which these tests don't use.
# - macos: the MAUI cases build three Release apps, which takes 8-10 minutes. On release branches the macOS leg
# runs them too, against the packages it publishes.
# - linux-x64, win-x64 and win-arm64: every integration test runs here, in parallel with the leg.
integration-test:
needs: build-sentry-native
name: Integration test (${{ matrix.rid }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
include:
- os: xcode-27
rid: macos
slnf: Sentry-CI-IntegrationTest-macOS.slnf
tests: integration-test/cli-maui.Tests.ps1
- os: ubuntu-24.04
rid: linux-x64
slnf: Sentry-CI-IntegrationTest.slnf
tests: integration-test
- os: windows-latest
rid: win-x64
slnf: Sentry-CI-IntegrationTest.slnf
tests: integration-test
- os: windows-11-arm
rid: win-arm64
slnf: Sentry-CI-IntegrationTest.slnf
tests: integration-test

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive

- name: Remove unused applications
uses: ./.github/actions/freediskspace

- name: Setup Environment
uses: ./.github/actions/environment
with:
projects: ${{ matrix.slnf }}

- name: Download sentry-native (${{ matrix.rid }})
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-${{ matrix.rid }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
enableCrossOsArchive: true

- name: Get Cocoa SDK cache key
id: cocoa-key
if: runner.os == 'macOS'
uses: ./.github/actions/cocoa-cache-key

- name: Restore Cocoa SDK
id: cache-cocoa
if: runner.os == 'macOS' && !startsWith(github.ref_name, 'release/')
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: modules/sentry-cocoa/Carthage
key: ${{ steps.cocoa-key.outputs.key }}

- name: Build Native Dependencies
uses: ./.github/actions/buildnative

- name: Build
run: dotnet build ${{ matrix.slnf }} -c Release --nologo -v:minimal

- name: Save Cocoa SDK
if: ${{ !cancelled() && steps.cache-cocoa.outputs.cache-primary-key != '' && steps.cache-cocoa.outputs.cache-hit != 'true' && hashFiles('modules/sentry-cocoa/Carthage/.built-from-sha') != '' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: modules/sentry-cocoa/Carthage
key: ${{ steps.cache-cocoa.outputs.cache-primary-key }}

# Like the build legs, pack the build outputs. Packing Sentry.Maui while building it on macOS fails with NU5026,
# looking for the Windows target's .pri file, which isn't generated on macOS.
- name: Create NuGet Packages
run: dotnet pack ${{ matrix.slnf }} -c Release --no-build --nologo

- name: Integration test
uses: getsentry/github-workflows/sentry-cli/integration-test@959162c159b866489d3fabe93327f48f9b8cb7ee # 3.4.1
with:
path: ${{ matrix.tests }}

ms-build:
needs: build-sentry-native
name: MSBuild
Expand All @@ -358,7 +453,7 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/environment
with:
projects: Sentry-CI-Build-Windows.slnf
projects: Sentry-CI-Build-Windows.slnf samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj

- name: Build Native Dependencies
uses: ./.github/actions/buildnative
Expand All @@ -368,7 +463,12 @@ jobs:

- name: Run MSBuild
id: msbuild
run: msbuild Sentry-CI-Build-Windows.slnf -t:Restore,Build,Pack -p:Configuration=Release --nologo -v:minimal -p:CopyLocalLockFileAssemblies=true -bl:msbuild.binlog
run: msbuild Sentry-CI-Build-Windows.slnf -restore -t:Build,Pack -p:Configuration=Release -m -nr:false --nologo -v:minimal -p:CopyLocalLockFileAssemblies=true -bl:msbuild.binlog

# The app samples build in their own job, with the .NET CLI, so the MAUI sample's Android and Windows targets
# get an MSBuild build here
- name: Build the MAUI sample
run: msbuild samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj -restore -t:Build -p:Configuration=Release -m -nr:false --nologo -v:minimal -p:CopyLocalLockFileAssemblies=true -bl:msbuild-maui.binlog

- name: Test MSBuild
uses: getsentry/github-workflows/sentry-cli/integration-test@959162c159b866489d3fabe93327f48f9b8cb7ee # 3.4.1
Expand All @@ -380,7 +480,9 @@ jobs:
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ${{ runner.os }}-msbuild-logs
path: msbuild.binlog
path: |
msbuild.binlog
msbuild-maui.binlog
if-no-files-found: ignore

# Unsupported Native AOT runtimes should have SentryNative auto-disabled
Expand Down Expand Up @@ -477,6 +579,86 @@ jobs:
# - name: Publish Test app (iOS)
# run: dotnet publish test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj -c Release -f net9.0-ios18.0 -r ios-arm64

# Nothing consumes the app samples, but their Release builds trim and AOT-compile each app, which made them the
# last minutes of the Build step in the .NET legs. Here they build next to the legs instead of inside them.
build-samples:
needs: build-sentry-native
name: Samples (${{ matrix.rid }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
include:
- os: xcode-27
rid: macos
samples: Sentry-CI-Build-Samples-macOS.slnf
# The MAUI sample's Windows target, which the MSBuild job also builds with msbuild.exe
- os: windows-latest
rid: win-x64
samples: samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj
# The Android and MAUI samples' Android targets on a Linux host, as the linux-x64 leg built them
- os: ubuntu-24.04
rid: linux-x64
samples: Sentry-CI-Build-Samples-Linux.slnf

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive

- name: Setup Environment
uses: ./.github/actions/environment
with:
projects: ${{ matrix.samples }}

- name: Download sentry-native (${{ matrix.rid }})
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-${{ matrix.rid }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
enableCrossOsArchive: true

# See build-sentry
- name: Get Cocoa SDK cache key
id: cocoa-key
if: runner.os == 'macOS'
uses: ./.github/actions/cocoa-cache-key

- name: Restore Cocoa SDK
id: cache-cocoa
if: runner.os == 'macOS' && !startsWith(github.ref_name, 'release/')
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: modules/sentry-cocoa/Carthage
key: ${{ steps.cocoa-key.outputs.key }}

- name: Build Native Dependencies
uses: ./.github/actions/buildnative

- name: Restore .NET Dependencies
run: dotnet restore ${{ matrix.samples }} --nologo

- name: Build
run: dotnet build ${{ matrix.samples }} -c Release --no-restore --nologo -v:minimal -bl:build.binlog

- name: Save Cocoa SDK
if: ${{ !cancelled() && steps.cache-cocoa.outputs.cache-primary-key != '' && steps.cache-cocoa.outputs.cache-hit != 'true' && hashFiles('modules/sentry-cocoa/Carthage/.built-from-sha') != '' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: modules/sentry-cocoa/Carthage
key: ${{ steps.cache-cocoa.outputs.cache-primary-key }}

- name: Upload build logs
if: ${{ always() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: samples-${{ matrix.rid }}-build-logs
path: build.binlog
if-no-files-found: ignore

test-solution-filters:
runs-on: ubuntu-24.04
if: ${{ !startsWith(github.ref_name, 'release/') }}
Expand Down
46 changes: 34 additions & 12 deletions .github/workflows/device-tests-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ jobs:
# Requires a "larger runner", for nested virtualization support
runs-on: ubuntu-latest-4-cores

strategy:
strategy: &android-emulator-matrix
fail-fast: false
matrix:
tfm: [net9.0, net10.0]
# Must be 34+ for new apps and app updates as of August 31, 2024.
# See https://apilevels.com/
api-level: [34, 36]
env:
env: &android-emulator-env
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
# We don't need the Google APIs, but the default images are not available for 32+
Expand Down Expand Up @@ -165,17 +165,40 @@ jobs:
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
with: *android-emulator-test

- name: Upload results
if: success() || failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: device-test-android-${{ matrix.api-level }}-${{ matrix.tfm }}-results
path: test_output

# The integration tests build and run their own app, so they run next to the device tests instead of after them
android-integration-tests:
name: Run Android API-${{ matrix.api-level }} Integration Test (${{ matrix.tfm }})

# Requires a "larger runner", for nested virtualization support
runs-on: ubuntu-latest-4-cores

strategy: *android-emulator-matrix
env: *android-emulator-env
steps:
# See https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive

- name: Setup Environment
uses: ./.github/actions/environment
with:
projects: integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj

- name: Select Java 21
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
distribution: temurin
java-version: '21'

- name: Checkout github-workflows
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -209,7 +232,6 @@ jobs:
if: success() || failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: device-test-android-${{ matrix.api-level }}-${{ matrix.tfm }}-results
path: |
test_output
integration-test/mobile-app/test_output
name: device-test-android-integration-${{ matrix.api-level }}-${{ matrix.tfm }}-results
path: integration-test/mobile-app/test_output
if-no-files-found: ignore
Loading
Loading