.NET
.NET CI on GitHub Actions
NuGet restore is network-bound and the build is single-threaded.
110s → 8s
NuGet restore
6m → 2m
Build
NuGet restore is network-bound and the build is single-threaded.
Why it happens
Restore hits nuget.org for every package, and MSBuild does not parallelise projects unless told to.
What to change
- Cache ~/.nuget/packages keyed on the lockfile and restore with --locked-mode
- Build with -m to enable parallel project builds
- Exclude the workspace from Defender scanning on Windows runners
- Run tests with --parallel and a matrix over test projects
.NET on runnerhut
yaml
jobs: build: runs-on: runnerhut-8vcpu-windows-2022 steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: { dotnet-version: '9.0' } - run: dotnet restore --locked-mode - run: dotnet build -c Release --no-restore -mThe only runnerhut-specific line is `runs-on: runnerhut-8vcpu-windows-2022`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.
Your next build could be twice as fast, at half the price
Start free. Migrating away is the same one line, and we publish that diff too.