-
-
Notifications
You must be signed in to change notification settings - Fork 226
test(ci): .NET 5.0 with MSBuild 16 #4569
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
Merged
Merged
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 3592141
MSBuild: Pack
jpnurmi 2beb045
Setup Environment to restore workload
jpnurmi f1a6b8e
Try temp dir to avoid global.json
jpnurmi 60a9700
TreatWarningsAsErrors=false for now
jpnurmi 733e4dd
Only .NET 5.0 with VS 2019 / MSBuild 16
jpnurmi 2d2c22a
Check msbuild version for net5.0
jpnurmi 355b616
temp cwd to avoid global.json
jpnurmi 5a85fb5
Try dotnet msbuild
jpnurmi aa61a5c
install .net 5.0 and run tests on all platforms
jpnurmi 328dfb9
Conditional net5.0 (unusable on linux-musl, linux-arm64, macos)
jpnurmi 7832b72
try-catch
jpnurmi 39c7f48
Fix ::group & AfterAll
jpnurmi c1f79a9
Revert unnecessary change
jpnurmi ec7f9d3
Merge remote-tracking branch 'upstream/main' into test/msbuild-net5.0
jpnurmi 933d340
Install old deprecated libssl1 for .NET 5.0 on Linux
jpnurmi 72564b3
Fix libssl1 installation
jpnurmi 80aa17e
Simplify .NET 5.0 test checks
jpnurmi e17cc4b
Tweak libssl1 installation
jpnurmi 58f33a5
Add clarifying comments
jpnurmi 1bebae0
Clean up
jpnurmi e4a74f0
Cleaner structure with BeforeDiscovery + Context
jpnurmi d7c9189
Add scripts/install-libssl1.sh
jpnurmi 39a3824
Add sudo
jpnurmi 2e2a2da
Silence NET 5.0 EOL warnings
jpnurmi d310382
dotnet new console --no-restore
jpnurmi 0de35a2
Restore --no-restore
jpnurmi ee2f76c
match condition with the comment to make cursor happy
jpnurmi 390cea2
Pass -p for consistency with the others
jpnurmi 50092d7
Ungroup build output to make CS8032 more visible
jpnurmi dc2ddfd
Update .github/actions/environment/action.yml
jpnurmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
jpnurmi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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::" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.