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

Provide a dotnet global tool version of ilrepack #364

Merged
merged 7 commits into from
Jul 26, 2024

Conversation

kzu
Copy link
Contributor

@kzu kzu commented Jul 8, 2024

A dotnet global tool of ilrepack would be much easier to install and use in a cross-platform manner.

This PR provides:

  • As-is repackaging of the main executable tool as a dotnet global tool project
  • Build and publish (release) workflows that build, test, pack and publish both the original package and the dotnet-tool
  • Cross-platform sanity check test for the packaged tool (extensive unit and integration tests aren't strictly necessary since they already run for the main tool and there's no additional code in the dotnet-tool).

The workflows automatically detect and use two repository/org secrets:

  • SLEET_CONNECTION: an optional Sleet connection string to provide a CI feed for dogfooding
  • NUGET_API_KEY to push both the original package and the dotnet-tool to nuget.org when a release (or prerelease) is created.

An example run of the build workflow can be seen in action at https://github.com/kzu/il-repack/actions/runs/9846710011.
And the published CI package for the global tool can be installed with:

dotnet tool install -g dotnet-ilrepack --prerelease --add-source https://kzu.blob.core.windows.net/nuget/index.json

And checked with: ilrepack --version.

kzu added 7 commits July 8, 2024 17:27
* Automatically version from github.ref
* Build and test on windows, only sanity check run on others
* Build using desktop MSBuild: This is what appveyor does.
* Pack separately just the tools project.
This command also helps check the tool is installed properly and can run, returning a success status code, without having to repack anything actually.
Avoids having to skip it for the auto-generated .vs when you open a single project from the integration tests folder, for example
In order to test that the basics of the dotnet-ilrepack tool are working in all supported OSes, we pick a clean and common scenario that doesn't require any particular workload, and which builds fast, as a simple end-to-end sanity check for the global tool itself.

Note that the extensive tests already run on the code from existing tests is a prerequisite already for the test tool job.
This makes merging this PR to upstream can be done even if the GH workflows aren't used for publishing.
@kzu kzu changed the title Provide a dotnet global tool version of the ilrepack tool Provide a dotnet global tool version of ilrepack Jul 8, 2024
kzu added a commit to devlooped/SponsorLink that referenced this pull request Jul 8, 2024
This simplifies consumption and avoids having to create custom CI build steps to install the right tool.

If the PR to include this global tool in the main ILRepack distribution is merged (see gluck/il-repack#364), we can remove the --add-source and --prerelease switches.
@KirillOsenkov
Copy link
Collaborator

Thanks! I'll take a look soon. This would fix #289

@ThaDaVos
Copy link

Any ETA?

@KirillOsenkov
Copy link
Collaborator

I'm very busy these days but I'll try and take a look within a week or two.

Copy link
Collaborator

@KirillOsenkov KirillOsenkov 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 great, thanks!

@KirillOsenkov KirillOsenkov merged commit 15aef03 into gluck:master Jul 26, 2024
1 check passed
@KirillOsenkov
Copy link
Collaborator

@kzu I'm not an admin on the repo so I can't set the NUGET_API_KEY to publish. I'm OK with building .nupkg locally and publishing those, since it's infrequent.

Is it the Environment Secret mentioned in the Actions here?
image

image

Or maybe @gluck can help us set a secret in the Settings?

@KirillOsenkov
Copy link
Collaborator

I uploaded https://www.nuget.org/packages/dotnet-ilrepack/1.0.0 manually for now, could you please try it out?

@MrJul
Copy link

MrJul commented Jul 27, 2024

Not the OP, but I can confirm that the tool is working fine. Thanks!

@kzu
Copy link
Contributor Author

kzu commented Aug 2, 2024

@KirillOsenkov it should be the secret in settings, not in env... not sure both map equally 🤔 .

kzu added a commit to devlooped/SponsorLink that referenced this pull request Aug 2, 2024
kzu added a commit to devlooped/SponsorLink that referenced this pull request Aug 2, 2024
kzu added a commit to devlooped/SponsorLink that referenced this pull request Aug 2, 2024
@kzu
Copy link
Contributor Author

kzu commented Aug 2, 2024

Published package works like a charm. If some day you the nuget secret in the repo, future publishing is just a matter of creating a release (for both packages) 👌

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.

4 participants