Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3c45ff4
integration test: MSBuild 16 & NET 5.0
jpnurmi Sep 26, 2025
3592141
MSBuild: Pack
jpnurmi Sep 26, 2025
2beb045
Setup Environment to restore workload
jpnurmi Sep 26, 2025
f1a6b8e
Try temp dir to avoid global.json
jpnurmi Sep 26, 2025
60a9700
TreatWarningsAsErrors=false for now
jpnurmi Sep 26, 2025
733e4dd
Only .NET 5.0 with VS 2019 / MSBuild 16
jpnurmi Sep 26, 2025
2d2c22a
Check msbuild version for net5.0
jpnurmi Sep 26, 2025
355b616
temp cwd to avoid global.json
jpnurmi Sep 26, 2025
5a85fb5
Try dotnet msbuild
jpnurmi Sep 27, 2025
aa61a5c
install .net 5.0 and run tests on all platforms
jpnurmi Sep 27, 2025
328dfb9
Conditional net5.0 (unusable on linux-musl, linux-arm64, macos)
jpnurmi Sep 27, 2025
7832b72
try-catch
jpnurmi Sep 27, 2025
39c7f48
Fix ::group & AfterAll
jpnurmi Sep 27, 2025
c1f79a9
Revert unnecessary change
jpnurmi Sep 28, 2025
ec7f9d3
Merge remote-tracking branch 'upstream/main' into test/msbuild-net5.0
jpnurmi Sep 28, 2025
933d340
Install old deprecated libssl1 for .NET 5.0 on Linux
jpnurmi Sep 28, 2025
72564b3
Fix libssl1 installation
jpnurmi Sep 28, 2025
80aa17e
Simplify .NET 5.0 test checks
jpnurmi Sep 28, 2025
e17cc4b
Tweak libssl1 installation
jpnurmi Sep 28, 2025
58f33a5
Add clarifying comments
jpnurmi Sep 28, 2025
1bebae0
Clean up
jpnurmi Sep 28, 2025
e4a74f0
Cleaner structure with BeforeDiscovery + Context
jpnurmi Sep 28, 2025
d7c9189
Add scripts/install-libssl1.sh
jpnurmi Sep 29, 2025
39a3824
Add sudo
jpnurmi Sep 29, 2025
2e2a2da
Silence NET 5.0 EOL warnings
jpnurmi Sep 29, 2025
d310382
dotnet new console --no-restore
jpnurmi Sep 29, 2025
0de35a2
Restore --no-restore
jpnurmi Sep 29, 2025
ee2f76c
match condition with the comment to make cursor happy
jpnurmi Sep 30, 2025
390cea2
Pass -p for consistency with the others
jpnurmi Sep 30, 2025
50092d7
Ungroup build output to make CS8032 more visible
jpnurmi Sep 30, 2025
dc2ddfd
Update .github/actions/environment/action.yml
jpnurmi Sep 30, 2025
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
13 changes: 13 additions & 0 deletions .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ runs:
shell: bash
run: sudo chmod 666 /var/run/docker.sock

# Install old deprecated libssl1 for .NET 5.0 on Linux
- name: Install libssl1 for NET 5.0 on Linux
if: ${{ runner.os == 'Linux' }}
shell: bash
run: sudo ./scripts/install-libssl1.sh

- name: Install Linux ARM 32-bit dependencies
if: ${{ matrix.rid == 'linux-arm' }}
shell: bash
Expand Down Expand Up @@ -90,6 +96,13 @@ runs:
global-json-file: global.json
dotnet-version: 8.0.x

# .NET 5.0 does not support ARM64 on macOS
- name: Install .NET 5.0 SDK
if: ${{ runner.os != 'macOS' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: 5.0.x

- name: Install .NET Workloads
shell: bash
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,12 @@ jobs:

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

- name: Test MSBuild
uses: getsentry/github-workflows/sentry-cli/integration-test/@a5e409bd5bad4c295201cdcfe862b17c50b29ab7 # v2.14.1
with:
path: integration-test/msbuild.Tests.ps1

- name: Upload logs
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion integration-test/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ BeforeAll {
if ($type -eq 'console')
{
AddPackageReference $name 'Sentry'
if (!$IsMacOS -or $framework -eq 'net8.0')
if ((!$IsMacOS -or $framework -eq 'net8.0') -and $framework -ne 'net5.0')
{
@"
<Project>
Expand Down
101 changes: 101 additions & 0 deletions integration-test/msbuild.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This file contains test cases for https://pester.dev/
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
. $PSScriptRoot/common.ps1

$IsARM64 = "Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())

# NOTE: These .NET versions are used to build a test app that consumes the Sentry
# .NET SDK, and are not tied to the .NET version used to build the SDK itself.
Describe 'MSBuild app' {
BeforeDiscovery {
$frameworks = @()

# .NET 5.0 does not support ARM64 on macOS
if (-not $IsMacOS -or -not $IsARM64)
{
$frameworks += @{
framework = 'net5.0'
sdk = '5.0.400'
# NuGet 5 does not support packageSourceMapping
config = "$PSScriptRoot\nuget5.config"
}
}

$frameworks += @(
@{ framework = 'net8.0'; sdk = '8.0.400' },
@{ framework = 'net9.0'; sdk = '9.0.300' }
)
}

Context '(<framework>)' -ForEach $frameworks {
BeforeEach {
Write-Host "::group::Create msbuild-app"
DotnetNew 'console' 'msbuild-app' $framework
Push-Location msbuild-app
@'
using System.Runtime.InteropServices;
using Sentry;
SentrySdk.Init(options =>
{
options.Dsn = args[0];
options.Debug = true;
});
SentrySdk.CaptureMessage($"Hello from MSBuild app");
'@ | Out-File Program.cs
Write-Host "::endgroup::"

Write-Host "::group::Setup .NET SDK"
if (Test-Path variable:sdk)
{
# Pin to a specific SDK version to use MSBuild from that version
@"
{
"sdk": {
"version": "$sdk",
"rollForward": "latestFeature"
}
}
"@ | Out-File global.json
}
Write-Host "Using .NET SDK: $(dotnet --version)"
Write-Host "Using MSBuild version: $(dotnet msbuild -version)"
Write-Host "::endgroup::"
}

AfterEach {
Pop-Location
Remove-Item msbuild-app -Recurse -Force -ErrorAction SilentlyContinue
}

It 'builds without warnings and is able to capture a message' {
Write-Host "::group::Restore packages"
if (!(Test-Path variable:config))
{
$config = "$PSScriptRoot/nuget.config"
}
dotnet restore msbuild-app.csproj --configfile $config | ForEach-Object { Write-Host $_ }
$LASTEXITCODE | Should -Be 0
Write-Host "::endgroup::"

Write-Host "::group::Build msbuild-app"
# TODO: pass -p:TreatWarningsAsErrors=true after #4554 is fixed
dotnet msbuild msbuild-app.csproj -t:Build -p:Configuration=Release -p:TreatWarningsAsErrors=false | ForEach-Object { Write-Host $_ }
$LASTEXITCODE | Should -Be 0
Write-Host "::endgroup::"

Write-Host "::group::Run msbuild-app"
$result = Invoke-SentryServer {
param([string]$url)
$dsn = $url.Replace('http://', 'http://key@') + '/0'
dotnet msbuild msbuild-app.csproj -t:Run -p:Configuration=Release -p:RunArguments=$dsn | ForEach-Object { Write-Host $_ }
$LASTEXITCODE | Should -Be 0
}
$result.HasErrors() | Should -BeFalse
$result.Envelopes() | Should -AnyElementMatch "`"message`":`"Hello from MSBuild app`""
Write-Host "::endgroup::"
}
}
}
11 changes: 11 additions & 0 deletions integration-test/nuget5.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- nuget5.config is meant for testing with .NET 5.0 / NuGet 5. It is otherwise same as
nuget.config but without <packageSourceMapping> which was added in .NET 6.0 / NuGet 6
https://learn.microsoft.com/en-us/nuget/consume-packages/package-source-mapping -->
<configuration>
<packageSources>
<clear />
<add key="integration-test" value="./packages" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
22 changes: 22 additions & 0 deletions scripts/install-libssl1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -euo pipefail

# Install old deprecated libssl 1.x for .NET 5.0 on Linux to avoid:
# Error: 'No usable version of libssl was found'

if apk --version >/dev/null 2>&1; then
# Alpine Linux: openssl1.1-compat from the community repo
apk add --repository=https://dl-cdn.alpinelinux.org/alpine/v3.18/community openssl1.1-compat
elif dpkg --version >/dev/null 2>&1; then
# Ubuntu: libssl1 from focal-security
# https://github.com/actions/runner-images/blob/d43555be6577f2ac4e4f78bf683c520687891e1b/images/ubuntu/scripts/build/install-sqlpackage.sh#L11-L21
if [ "$(dpkg --print-architecture)" = "arm64" ]; then
echo "deb http://ports.ubuntu.com/ubuntu-ports focal-security main" | tee /etc/apt/sources.list.d/focal-security.list
else
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | tee /etc/apt/sources.list.d/focal-security.list
fi
apt-get update
apt-get install -y --no-install-recommends libssl1.1
rm /etc/apt/sources.list.d/focal-security.list
apt-get update
fi
Loading