Skip to content

Conversation

@Romfos
Copy link
Contributor

@Romfos Romfos commented Jan 2, 2026

this PR is copy of #700 with removed appveyor changes

key points:

  1. Test projects setup
  • marks test projects as non-packable
  • makes the tests in the Castle.Core.Tests.WeakNamed.csproj project runnable again (by adding the test framework & adapter packages to the .csproj file)
  • replaces NUnitLite with NUnit
  1. Assembly output
  • sets up SourceLink
  • sets up deterministic builds

related #700

@Romfos Romfos marked this pull request as draft January 2, 2026 11:59
@Romfos
Copy link
Contributor Author

Romfos commented Jan 2, 2026

appveyor build need to be fixed

@Romfos Romfos mentioned this pull request Jan 2, 2026
10 tasks
@stakx
Copy link
Member

stakx commented Jan 2, 2026

@Romfos:

appveyor build need to be fixed

Not the Appveyor build per se, but the build shell scripts for both Windows and Linux used by AppVeyor. You could proceed in either of the following ways:

  • Don't remove NUnit3Lite and keep the test project executables, so that the build scripts continue to run successfully unmodified.
  • Do remove NUnit3Lite and adjust the build scripts as necessary.

For the Windows build script (buildscripts/build.cmd), a change such as the following might work:

 echo --------------------
 echo Running NET462 Tests
 echo --------------------

-src\Castle.Core.Tests\bin\%Configuration%\net462\Castle.Core.Tests.exe --result=DesktopClrTestResults.xml;format=nunit3 || exit /b 1
-src\Castle.Core.Tests.WeakNamed\bin\%Configuration%\net462\Castle.Core.Tests.WeakNamed.exe --result=DesktopClrWeakNamedTestResults.xml;format=nunit3 || exit /b 1
+dotnet test src\Castle.Core.Tests           -f net462 -c %Configuration% --no-build -- NUnit.TestOutputXml="%CD%" NUnit.TestOutputXmlFileName="DesktopClrTestResults"          || exit /b 1
+dotnet test src\Castle.Core.Tests.WeakNamed -f net462 -c %Configuration% --no-build -- NUnit.TestOutputXml="%CD%" NUnit.TestOutputXmlFileName="DesktopClrWeakNamedTestResults" || exit /b 1

 echo ---------------------------
 echo Running NET8.0 Tests
 echo ---------------------------

-dotnet .\src\Castle.Core.Tests\bin\%Configuration%\net8.0\Castle.Core.Tests.dll --result=Net80TestResults.xml;format=nunit3 || exit /b 1
-dotnet .\src\Castle.Core.Tests.WeakNamed\bin\%Configuration%\net8.0/Castle.Core.Tests.WeakNamed.dll --result=Net80WeakNamedTestResults.xml;format=nunit3 || exit /b 1
+dotnet test src\Castle.Core.Tests           -f net8.0 -c %Configuration% --no-build -- NUnit.TestOutputXml="%CD%" NUnit.TestOutputXmlFileName="Net80TestResults"               || exit /b 1
+dotnet test src\Castle.Core.Tests.WeakNamed -f net8.0 -c %Configuration% --no-build -- NUnit.TestOutputXml="%CD%" NUnit.TestOutputXmlFileName="Net80WeakNamedTestResults"      || exit /b 1

 echo ---------------------------
 echo Running NET9.0 Tests
 echo ---------------------------

-dotnet .\src\Castle.Core.Tests\bin\%Configuration%\net9.0\Castle.Core.Tests.dll --result=Net90TestResults.xml;format=nunit3 || exit /b 1
-dotnet .\src\Castle.Core.Tests.WeakNamed\bin\%Configuration%\net9.0/Castle.Core.Tests.WeakNamed.dll --result=Net90WeakNamedTestResults.xml;format=nunit3 || exit /b 1
+dotnet test src\Castle.Core.Tests           -f net9.0 -c %Configuration% --no-build -- NUnit.TestOutputXml="%CD%" NUnit.TestOutputXmlFileName="Net90TestResults"               || exit /b 1
+dotnet test src\Castle.Core.Tests.WeakNamed -f net9.0 -c %Configuration% --no-build -- NUnit.TestOutputXml="%CD%" NUnit.TestOutputXmlFileName="Net90WeakNamedTestResults"      || exit /b 1

The Linux build script (build.sh) would have to be adjusted similarly, e. g. as follows (I'm guessing a little):

 echo ---------------------------
 echo Running NET8.0 Tests
 echo ---------------------------
 
-dotnet ./src/Castle.Core.Tests/bin/Release/net8.0/Castle.Core.Tests.dll --result=Net80TestResults.xml;format=nunit3
-dotnet ./src/Castle.Core.Tests.WeakNamed/bin/Release/net8.0/Castle.Core.Tests.WeakNamed.dll --result=Net80WeakNamedTestResults.xml;format=nunit3
+dotnet test src\Castle.Core.Tests           -f net8.0 -c Release --no-build -- NUnit.TestOutputXml="$PWD" NUnit.TestOutputXmlFileName="Net80TestResults"
+dotnet test src\Castle.Core.Tests.WeakNamed -f net8.0 -c Release --no-build -- NUnit.TestOutputXml="$PWD" NUnit.TestOutputXmlFileName="Net80WeakNamedTestResults"
 
 ...
 
 echo ---------------------------
 echo Running NET9.0 Tests
 echo ---------------------------
 
-dotnet ./src/Castle.Core.Tests/bin/Release/net9.0/Castle.Core.Tests.dll --result=Net90TestResults.xml;format=nunit3
-dotnet ./src/Castle.Core.Tests.WeakNamed/bin/Release/net9.0/Castle.Core.Tests.WeakNamed.dll --result=Net90WeakNamedTestResults.xml;format=nunit3
+dotnet test src\Castle.Core.Tests           -f net9.0 -c Release --no-build -- NUnit.TestOutputXml="$PWD" NUnit.TestOutputXmlFileName="Net90TestResults"
+dotnet test src\Castle.Core.Tests.WeakNamed -f net9.0 -c Release --no-build -- NUnit.TestOutputXml="$PWD" NUnit.TestOutputXmlFileName="Net90WeakNamedTestResults"

@Romfos Romfos force-pushed the actions2 branch 2 times, most recently from 5056214 to 63f421d Compare January 3, 2026 13:11
Copy link
Member

@stakx stakx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not my final review, but a couple things I stumbled over.

@Romfos Romfos requested a review from stakx January 3, 2026 13:29
@Romfos Romfos marked this pull request as ready for review January 3, 2026 13:29
Copy link
Member

@stakx stakx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking mostly good, from what I can tell. Just a few details. After those have been taken care of, this should be ready for merging.


P.S. perhaps you could also add a brief description of your changes in the CHANGELOG.md? For exampe:

 Enhancements:
 ...
+Set up deterministic builds, SourceLink, and switched to `.snupkg` symbol packages (@Romfos, #722)

P.P.S: Are we sure that an explicit <PackageReference Include="Microsoft.SourceLink.GitHub" Version="..." PrivateAssets="All" /> is no longer needed these days for SourceLink to work correctly? Has that since been integrated diretly into the .NET SDK? (https://github.com/dotnet/sourcelink?tab=readme-ov-file#using-source-link-in-net-projects)

Comment on lines +36 to +42
<PropertyGroup Condition="'$(CI)' == 'True'">
<!--Deterministic Build and Source Link settings -->
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
Copy link
Member

@stakx stakx Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm noticing that on local builds, we still get (legacy?) .symbols.nupkg files (like before), while on CI, we get .snupkg files. I am not sure whether the former symbols package format makes particular sense for local builds... but I suspect not.

Perhaps it might be better to put both <IncludeSymbols> and <SymbolPackageFormat> in a non-conditional <PropertyGroup>, such that we always get the same symbols package format.

Or do you have a better recommendation?

Copy link
Contributor Author

@Romfos Romfos Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for me - better solution is to implement it in a right way via dotnet pack and pass this CI = true

https://github.com/Romfos/Core/blob/47eceaf738b4de367a3469f5bc10f52e8eb82dc3/.github/workflows/release.yml#L29

some articles:
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#continuousintegrationbuild

When set to true, this property enables settings that only apply to official builds as opposed to local builds on a developer machine. 
For example, stored file paths are normalized for official builds. 
But on a local development machine, the debugger isn't able to find local source files if file paths are normalized.

for now this change is not in production =)

Copy link
Member

@stakx stakx Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not quite there yet however.

Are you saying that non-CI builds should not emit any NuGet packages at all? In that case we'd still need to change something here.

(Note that I wasn't suggesting taking the <ContinuousIntegrationBuild> out of the conditional group – that one clearly belongs there. I was referring only to the two last properties.)

Copy link
Contributor Author

@Romfos Romfos Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can build nuget packages locally but probably you don't want to publish to nuget your local package symbols that could contains your local file paths, maybe other sensitive information

As I understand best practice here is to use it on CI

sorry, maybe I'm not filly understand this topic

@Romfos
Copy link
Contributor Author

Romfos commented Jan 3, 2026

Microsoft.SourceLink.GitHub no longer need for .NET 8+ sdk. This project uses .NET 10 sdk

@stakx stakx changed the title Update test projects Configure SourceLink, .snupkg symbols package format & update test projects Jan 5, 2026
@stakx stakx merged commit 8b13837 into castleproject:master Jan 5, 2026
4 checks passed
@Romfos Romfos deleted the actions2 branch January 5, 2026 13:59
@stakx stakx added this to the v6.0.0 milestone Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants