Skip to content

Conversation

@xC0dex
Copy link

@xC0dex xC0dex commented Jan 23, 2026

Pull request description

This PR switches from the actions/setup-dotnet GitHub Action to fast-actions/setup-dotnet to improve performance and reduce setup time.

bUnit is a multi-targeted project, and the current workflow downloads three full SDKs (10, 9, and 8). In practice, bUnit only requires the latest SDK, along with the .NET 8 and 9 Runtimes, to run its tests. The existing setup also requires maintaining both a global.json file and explicit SDK version inputs, which adds unnecessary duplication.

fast-actions/setup-dotnet supports decoupling SDK and Runtime installation and integrates cleanly with global.json, simplifying the configuration.

This PR introduces the following changes:

  • Use fast-actions/-setup instead of actions/setup-dotnet
  • Use global.json to determine the SDK version
  • Use aspnetcore-version to install the required runtimes

Of course, I completely understand if you'd prefer not to rely on a lesser-known GitHub Action.

PR meta checklist

  • Pull request is targeted at main branch for code
    or targeted at stable branch for documentation that is live on bunit.dev.
  • Pull request is linked to all related issues, if any.
  • I have read the CONTRIBUTING.md document.

Code PR specific checklist

  • My code follows the code style of this project and AspNetCore coding guidelines.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I have updated the appropriate sub section in the CHANGELOG.md.
  • I have added, updated or removed tests to according to my changes.
    • All tests passed.

@linkdotnet
Copy link
Collaborator

Hey @xC0dex thanks for the PR.

Cool initiative for sure. I am not sure if the action for us brings much benefit. Checking our setup time for dotnet, it ranges from around 3 seconds on linux/macos to 13 seconds on Windows.

So we would optimize for the smaller chunk of 3% of our runtime at best.

If you are checking against the initial run on this PR, it is even slower (maybe due to caching, ...). So right now, we can keep an eye on your new action, but I don't see any major benefit for us ATM.

@xC0dex
Copy link
Author

xC0dex commented Jan 23, 2026

Hey @linkdotnet,

Thanks a lot for the feedback, it’s greatly appreciated.

Checking our setup time for dotnet, it ranges from around 3 seconds on linux/macos to 13 seconds on Windows

I’m curious where these numbers come from, because I’m seeing higher timings in recent runs. For example, this run (current action) shows 21 seconds:
https://github.com/bUnit-dev/bUnit/actions/runs/21142410018/job/60799599402

And this one (new action) shows 16 seconds:
https://github.com/bUnit-dev/bUnit/actions/runs/21285706442/job/61266925527

It’s also worth noting that the very first run needs to upload the cache. All subsequent runs are faster. I ran some benchmarks using a similar setup, and here are the results:

Scenario Official Action fast-actions (without cache) fast-actions (with cache)
Multiple SDKs (10.x, 9.x, 8.x) ~24s ~15s ~6s
Single SDK + Runtimes (SDK 10.x, ASP.NET Core 9.x + 8.x) Not possible ~9s ~4s

@linkdotnet
Copy link
Collaborator

Yeah :D maybe I was a bit tooooo lucky :D
See: https://github.com/bUnit-dev/bUnit/actions/runs/20680858130/job/59374844949

I assume also that there is some caching in the "official" version.

@linkdotnet
Copy link
Collaborator

Here other two runs:
https://github.com/bUnit-dev/bUnit/actions/runs/20267037661/job/58192761333
https://github.com/bUnit-dev/bUnit/actions/runs/20267270970/job/58193568265

<10 seconds each.

The >20s might be because it was the first run after the monthly patch update.

@xC0dex
Copy link
Author

xC0dex commented Jan 23, 2026

That's interesting. Thanks for sharing.
The official action doesn't support caching .NET installations at all but it checks if the requested version ist already installed. Definitely something I should consider to add to fast-actions.

I fully understand that there is no need for bUnit to switch 👍 It's probably more interesting if you have to pay for the execution time.

@linkdotnet
Copy link
Collaborator

That's interesting. Thanks for sharing. The official action doesn't support caching .NET installations at all but it checks if the requested version ist already installed. Definitely something I should consider to add to fast-actions.

I fully understand that there is no need for bUnit to switch 👍 It's probably more interesting if you have to pay for the execution time.

Ah good to know.

I really appreciate that you took the time and even went forward and did the implementation and I still think that it fills a gap! For sure, something I will keep an eye on!

@xC0dex
Copy link
Author

xC0dex commented Jan 23, 2026

Once again, thank you very much for your feedback!

fast-actions now also skips the installation if the requested versions are already installed on the machine 🥳

image

I noticed that the validate-template job requires the .NET 9 runtime to be installed 👀

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