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

Build a deterministic build #9

Closed
31 of 34 tasks
iBrotNano opened this issue Feb 27, 2023 · 0 comments · Fixed by #26
Closed
31 of 34 tasks

Build a deterministic build #9

iBrotNano opened this issue Feb 27, 2023 · 0 comments · Fixed by #26
Assignees
Labels
task Work on the project, the build pipeline or any other task.
Milestone

Comments

@iBrotNano
Copy link
Owner

iBrotNano commented Feb 27, 2023

Requirements

Open Questions?

  1. @who: What must be discussed?

Blockers

  1. NuGet Package Explorer shows the build not as deterministic and i can't figure out why.

Description

A deterministic build is a build which binaries are the same regardless on which machine they are build.

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

Conditions

Side effects

Locally build binaries should not be build deterministic because it prevents debugging.

Acceptance tests

  • I will check in the NuGet compiled by the build server if the build is deterministic

Design

How can the task be done? describes how to configure the build. I will create a parameter in Directory.Build.props which can be set on the buildserver build and can be omit locally.

Dissection

Integration test 1
Action Check in the NuGet if the build was deterministic.
Expected result The must be a hook checked when it is opend with the NuGet Explorer.

Development

TODOs

  • Create a feature branch if needed (Maybe configuration changes or new project files)
  • Update the dependencies
  • Modify Directory.Build.props to enable deterministic build configuration
  • Check the build in IlSpy
  • Check with a minimal example
  • Check with a .NET 6.0 build
  • Is there any other tool to check if a NuGet is deterministic?
  • Proof with different version of MSBuild
  • Try if .NET SDK 7.0.201 can be used
  • The log shows that Deterministic is set to false
  • Analyze the log
  • Why is the file Shouldly.props part of the NuGet?
  • Try <ExcludeAssets>build</ExcludeAssets>
  • Why is the project build as reference assembly?
  • NPE does not show the deterministic builds correctly. Why?
  • Build the app with the flag for deterministic builds
  • Write meaningful comments
  • Are there any compiler warnings?
  • Do all unit tests pass?
  • Is the version number correctly configured?
  • Phrase a meaningful commit comment
  • Check-in the changes and push them to the server
  • Save the build configuration files (Directory.Build.props, Directory.Package.props, build.yml, templates, README.md, CHANGELOG.md) as a snippet in GitLab.

Notes

I could proof that the MSBuild version has no impact on the result.

I compile the assembly as a reference assembly. No metadata of private membes is published or can be used. This way only the public API of the assembly can be used. This is a more stable way to publish assemblies and should be used as default.

https://learn.microsoft.com/en-us/dotnet/standard/assembly/reference-assemblies

Debug

ID Result Pass
1 The hook to indicate a deterministic build is set. 🟢

Documentation

  • Do I need a new PIA or update an existing one?
  • Update the README.md
  • Update the CHANGELOG.md
  • Describe the setup of the story if needed for end users
  • Does something in the wiki needed to be updated?
  • Publish the solution as a blog post

Decisions

PIAs

Links

Demo

  • Setup a fresh demo environment

The NuGet is deterministic.

Deployment

  • Merge feature into master with a squash and remove the feature branch
  • Check if the compiled artifact is valid
  • Cleanup the Git history locally on the dev system
@iBrotNano iBrotNano self-assigned this Feb 27, 2023
@iBrotNano iBrotNano added the task Work on the project, the build pipeline or any other task. label Feb 27, 2023
@iBrotNano iBrotNano added this to the 1.0.5 milestone Feb 27, 2023
iBrotNano added a commit that referenced this issue Mar 6, 2023
iBrotNano added a commit that referenced this issue Mar 7, 2023
- Set the dotnet version to 7.0.x to use the latest patch version for building
iBrotNano added a commit that referenced this issue Mar 7, 2023
@iBrotNano iBrotNano linked a pull request Mar 8, 2023 that will close this issue
iBrotNano added a commit that referenced this issue Mar 8, 2023
* #11 Set a fix version for dotnet

* #9 Removed the fix dotnet build version

* #9 Set the pack command with the argument --no-build

* #9 Chaged the .NET SDK version to 7.0.201

* #9 Deterministic set to true

* #9 Excluded the build folder of Shouldly

- Set the dotnet version to 7.0.x to use the latest patch version for building

* #9 Commented Directory.Build.props

* #9 Standard templates for the documentation

* Update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Work on the project, the build pipeline or any other task.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant