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

Upgrade .NET & add GitHub actions to automatically build Foreman #117

Draft
wants to merge 3 commits into
base: Main
Choose a base branch
from

Conversation

Olipro
Copy link
Collaborator

@Olipro Olipro commented Nov 7, 2024

Changeset highlights:

  • Updated the entire solution to .NET 8.0
  • No binary files are needed in the repo, these are now proper dependencies of the project.
  • BinaryFormatter has been replaced with protobuf since .NET considers the former to be a security risk and refuses to compile code using it unless you force it to.
  • Fixed all newly-uncovered compiler warnings
  • Removed cruft files from the repo - including the unrunnable tests project.
  • Added GitHub actions that automatically build snapshots and releases. An annotated tag (e.g. v1.2.3.4) will automatically build a release with the version in the tag (automatically incorporating the version into the binary) and upload the artifacts to a draft Release for you in the Releases section.
  • Snapshot builds are created on every commit, you can grab the artifacts directly from the workflow for that commit.
  • Foreman is built in two packages: one that is an entirely self-contained executable (no .NET framework installation needed) and a smaller one that depends on you having .NET installed.

This should greatly streamline the process of releasing new builds of Foreman2. If you are confident, the draft option can be disabled entirely and the GitHub action can go ahead and make a public release the moment you push an annotated tag to the repo - though you'd possibly want to do more verbose commit messages in that case since that's how we'd have it do release notes for you.

This commit upgrades Foreman2 to use .NET 8. This enables us to use
proper dependency management and build with the `dotnet` command line
tools in preparation for having a proper CI build.

Additionally, this enables a newer version of C# and better tooling to
detect code issues.

I have deleted all files that are irrelevant to the codebase or no
longer needed because they are managed by `dotnet`/`nuget` dependency
management. Since we're using git, they'll be accessible forever anyway.

ForemanTest has also been deleted since it wasn't compilable due to
missing functions. Ideally we'll introduce a test suite in future and
possibly leverage the now-deleted tests, but since it currently serves
no purpose and isn't buildable, remove it.
All warnings issued by the compiler have been eliminated. This mainly
revolves around a number of `IDisposable` types that were fields of
other `IDisposable`s. The codebase should no longer have any
compile-time warnings which sets us up for the option of turning all
warnings into errors.
We now use GitHub to build and publish Foreman releases.

This consists of two workflows: snapshot and release.

The snapshot workflow runs for all commits and archives the artifacts so
that you can download them directly from the workflow if you need to
debug anything.

The release workflow only fires when an annotated tag is pushed and it
expects it to be in the format `v1.2.3.4` (replace the numbers as
appropriate). The compiled program will automatically be imbued with the
version number in the tag. Additionally, the action will prepare a draft
release and upload the artifacts into it.
@Olipro Olipro marked this pull request as draft November 9, 2024 12:00
@Olipro
Copy link
Collaborator Author

Olipro commented Nov 9, 2024

I've converted this to a draft since discovering that the serialisation needs a rework to avoid inappropriately trying to serialise fields that shouldn't be serialised.

I'll undraft it once it's been fixed up properly.

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.

1 participant