Skip to content
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

Support Sourcelink and Deterministic Build #737

Merged

Conversation

304NotModified
Copy link
Contributor

@304NotModified 304NotModified commented Sep 12, 2023

This PR enables Source Link and Deterministic Builds.

Why

  • Source Link so that users could debug the library from their Visual Studio
  • Deterministic Build to be sure that the produced binary on nuget.org is really made from this Github Source

Most of the top NuGet packages has enabled Source Link. Also some are using Deterministic Build.

E.g. Newtonsoft.Json

image

I've also configured deterministic builds for other open-source projects, e.g. nunit/nunit#3810, App-vNext/Polly#839

More info

Before

(Checked with https://github.com/NuGetPackageExplorer/NuGetPackageExplorer)

image

After

image

Note, no signature because this is from local. You could also see this by downloading the .nugpkg and .snupkg from the artifacts from AppVeyor

Note! the .snukpg should be published to nuget.org, otherwise the source link won't work

Copy link
Member

@dtchepak dtchepak left a comment

Choose a reason for hiding this comment

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

Thanks very much for this! 🙇

Have left some newbie questions for you before I merge.

src/NSubstitute/NSubstitute.csproj Outdated Show resolved Hide resolved
@304NotModified
Copy link
Contributor Author

This one is still on draft as it isn't tested yet.

I have applied many of these changes in the past, but every build pipeline is somewhat different.

RepositoryUrl + RepositoryType
@304NotModified
Copy link
Contributor Author

304NotModified commented Sep 27, 2023

@dtchepak how is nuget package publish process organized?

  • Is it automatically?
  • Is it from AppVeyor/Azure Devops/Travis (there is a Travis badge)/Github Actions?

@304NotModified 304NotModified force-pushed the sourcelink-and-deterministic-build branch from f5d8852 to c99f583 Compare September 27, 2023 18:48
@304NotModified 304NotModified force-pushed the sourcelink-and-deterministic-build branch from 971b14a to b0ac750 Compare September 27, 2023 19:02
@304NotModified 304NotModified marked this pull request as ready for review September 27, 2023 19:10
@304NotModified
Copy link
Contributor Author

@dtchepak this is ready, I also updated the description of this PR.

Please note:

Note! the .snukpg should be published to nuget.org, otherwise the source link won't work

@304NotModified 304NotModified force-pushed the sourcelink-and-deterministic-build branch from ba78b82 to b1f0dd6 Compare September 27, 2023 19:16
@alexandrnikitin
Copy link
Member

@304NotModified Thank you for the PR!
I have one question. How is Deterministic compiler option related to that. Do we want to enable it?

@304NotModified
Copy link
Contributor Author

Good question, I don't this this is needed:

While deterministic builds are enabled by default in .NET SDK projects, there is an extra property, ContinuousIntegrationBuild, to set on the build server to normalize stored file paths.

https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/

@304NotModified
Copy link
Contributor Author

polite bump @dtchepak :)

@dtchepak
Copy link
Member

dtchepak commented Oct 7, 2023

@dtchepak how is nuget package publish process organized?

  • Is it automatically?
  • Is it from AppVeyor/Azure Devops/Travis (there is a Travis badge)/Github Actions?

It's done manually, normally I use AppVeyor build. (Release procedure).

I'd love to have this automated at some point.

@dtchepak dtchepak merged commit 4beec78 into nsubstitute:main Oct 7, 2023
3 checks passed
@dtchepak
Copy link
Member

dtchepak commented Oct 7, 2023

Thanks @304NotModified !

@304NotModified 304NotModified deleted the sourcelink-and-deterministic-build branch November 18, 2023 00:28
@304NotModified
Copy link
Contributor Author

@dtchepak could we please release this? :)

@dtchepak
Copy link
Member

@dtchepak could we please release this? :)

I was going to just have this bundled in next feature release. Is there something this provides that is blocking you?
What semantic version bump would you suggest for this?

@304NotModified
Copy link
Contributor Author

5.2 or 5.1.1 are both fine to me. I prefer 5.2 as it isnt a bugfix.

@304NotModified
Copy link
Contributor Author

Hi @dtchepak, as Source Link could help with better bug reports and deterministic build in security, I still hope to see a release of this.

I like to contribute more but the delay of the releases is holding me back.

@dtchepak
Copy link
Member

@304NotModified MR for release 5.2 here: #791

I'll release it once I get core team approval 👍
cc: @alexandrnikitin

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.

3 participants