Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 22, 2025

Adds GitHub Actions caching for NuGet packages and .NET tools to reduce CI build times.

Changes

Cache Configuration

  • NuGet packages: ~/.nuget/packages
    • Key: {OS}-nuget-{hash(*.csproj, *.sln)}
  • .NET tools: ~/.dotnet/tools
    • Key: {OS}-dotnet-tools-{hash(*.csproj, *.sln)}
  • Restore keys use OS-only prefix for partial cache hits across branches

Workflows Updated

  • dotnet.yml: Added caching to build, security-scan, and code-quality jobs
  • deploy.yml: Added caching to deploy job

Example

- name: Cache NuGet packages
  uses: actions/cache@v4
  with:
    path: ~/.nuget/packages
    key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.sln') }}
    restore-keys: |
      ${{ runner.os }}-nuget-

- name: Restore dependencies
  run: dotnet restore

Cache invalidates automatically when project files change. Expected restore time reduction: ~70-80% on cache hits.

Original prompt

This section details on the original issue you should resolve

<issue_title>Optimize CI with restore/build caching</issue_title>
<issue_description>Add actions/cache for NuGet and ~/.dotnet/tools to speed builds.

Acceptance Criteria:

  • Cache keys include OS and project hash
  • CI times reduced vs baseline</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 22, 2025
Copilot AI and others added 2 commits November 22, 2025 15:37
Co-authored-by: rbmathis <25754016+rbmathis@users.noreply.github.com>
Co-authored-by: rbmathis <25754016+rbmathis@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize CI with restore/build caching Add NuGet and .NET tools caching to CI workflows Nov 22, 2025
Copilot AI requested a review from rbmathis November 22, 2025 15:44
@rbmathis rbmathis marked this pull request as ready for review November 22, 2025 15:49
@rbmathis rbmathis merged commit d52db92 into main Nov 22, 2025
6 of 7 checks passed
@rbmathis rbmathis deleted the copilot/optimize-ci-caching branch November 22, 2025 15:49
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.

Optimize CI with restore/build caching

2 participants