Repository navigation
Open
Description
Why
No job in dotnet.yml caches NuGet packages, so every test leg downloads the whole dependency graph again. Over 50 runs between 29 and 31 Oct, the Restore step's median was 51 s on Windows, 13 s on Linux and 14 s on macOS (8 runs). The Pack job's Build restores the same way. setup-dotnet's built-in cache: true needs packages.lock.json files, which this repository does not have.
Proposal
- An
actions/cachestep (pinned to a SHA, with its# vX.Y.Zcomment, like the other actions) after Setup .NET in the test legs and the Pack job. It caches~/.nuget/packages, keyed on the runner OS andhashFiles('Directory.Packages.props', '**/*.csproj', '**/Directory.Build.props', 'global.json', '.config/dotnet-tools.json'). Itsrestore-keysare the OS prefix, so a changed pin restores most packages and downloads the rest. - The smoke test is untouched: it sets its own
NUGET_PACKAGESunder its work folder (tools/ConsumerSmokeTest/Program.cs), and that private cache is the point of its two modes. The Consumer job gets no cache. - No cache in a run that publishes.
dotnet.ymlgets aworkflow_callinputpublishing(boolean, default false).release.yml'scijob passespublishing: true, and every cache step carriesif: ${{ !inputs.publishing }}(under any other event the input is unset, so the cache is used). After Release: publish the packages CI packed instead of building them again, and check the tag before CI #247, that run's Pack job builds the packages nuget.org receives. They are then restored from nuget.org, so NuGet checks every package's signature as it extracts it. Nothing comes from an Actions cache, whose contents skipped that check and which any run on the default branch can write. This covers the tag push and a non-dry-run dispatch ofrelease.ymlfrom a branch, which a ref check would miss. - Fresh means two different things here. The smoke consumers restore into their own empty folder in every run, cached or not, which is what their two modes test. The publishing run restores everything from nuget.org, which is what the packages it publishes are built from. The test legs of that run go without a cache too, so one rule covers the whole run.
ReleaseWiringTestshold both halves:release.yml'scipassespublishing: true, and everyactions/cachestep indotnet.ymlcarries the condition. Each is shown failing on a seeded omission.
Done when
The Restore step is measured before and after on each leg, in this issue. A cache hit and a miss (after a change to Directory.Packages.props) both pass. The smoke test's two modes still restore from their own folders. A dry-run dispatch of release.yml restores no cache in any job.
Metadata
Metadata
Assignees
Labels
choreBuild, CI, tooling, packaging, refactoring with no behaviour change
Activity