ci: fix NuGet cache path with NUGET_PACKAGES env var
CI / test (push) Successful in 50s
CI / build (push) Successful in 1m15s
CI / release (push) Successful in 1m24s

- Add NUGET_PACKAGES env var at job level to pin package cache location
- Change cache path from ~/.nuget/packages to runner.temp/.nuget/packages
- Add id to cache steps and diagnostic 'Cache status' step to show hit/miss
- Add DOTNET_NOLOGO and DOTNET_CLI_TELEMETRY_OPT_OUT for cleaner logs
- Applied to build, test, and release jobs uniformly
This commit is contained in:
fristy committed 2026-09-05 00:59:36 +03:00
1 parent a84fabcd3f
commit 283c2d744b
2 files changed
+37 -3

No files matched your search

+36 -3
View File
@@ -14,6 +14,10 @@ on:
jobs: jobs:
build: build:
runs-on: windows-latest runs-on: windows-latest
env:
NUGET_PACKAGES: ${{ runner.temp }}/.nuget/packages
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPT_OUT: true
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -28,14 +32,21 @@ jobs:
DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet
- name: Cache NuGet packages - name: Cache NuGet packages
id: nuget-cache
uses: actions/cache@v4 uses: actions/cache@v4
continue-on-error: true continue-on-error: true
with: with:
path: ~/.nuget/packages path: ${{ runner.temp }}/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }}
restore-keys: | restore-keys: |
nuget-${{ runner.os }}- nuget-${{ runner.os }}-
- name: Cache status
if: always()
shell: pwsh
run: |
Write-Host "NuGet cache hit: ${{ steps.nuget-cache.outputs.cache-hit }}"
- name: Restore tools - name: Restore tools
run: dotnet tool restore run: dotnet tool restore
@@ -47,6 +58,10 @@ jobs:
test: test:
runs-on: windows-latest runs-on: windows-latest
env:
NUGET_PACKAGES: ${{ runner.temp }}/.nuget/packages
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPT_OUT: true
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -61,14 +76,21 @@ jobs:
DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet
- name: Cache NuGet packages - name: Cache NuGet packages
id: nuget-cache
uses: actions/cache@v4 uses: actions/cache@v4
continue-on-error: true continue-on-error: true
with: with:
path: ~/.nuget/packages path: ${{ runner.temp }}/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }}
restore-keys: | restore-keys: |
nuget-${{ runner.os }}- nuget-${{ runner.os }}-
- name: Cache status
if: always()
shell: pwsh
run: |
Write-Host "NuGet cache hit: ${{ steps.nuget-cache.outputs.cache-hit }}"
- name: Run tests (if any test projects exist) - name: Run tests (if any test projects exist)
shell: pwsh shell: pwsh
run: | run: |
@@ -89,6 +111,10 @@ jobs:
- test - test
if: startsWith(gitea.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' if: startsWith(gitea.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
runs-on: windows-latest runs-on: windows-latest
env:
NUGET_PACKAGES: ${{ runner.temp }}/.nuget/packages
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPT_OUT: true
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -103,14 +129,21 @@ jobs:
DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet
- name: Cache NuGet packages - name: Cache NuGet packages
id: nuget-cache
uses: actions/cache@v4 uses: actions/cache@v4
continue-on-error: true continue-on-error: true
with: with:
path: ~/.nuget/packages path: ${{ runner.temp }}/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }}
restore-keys: | restore-keys: |
nuget-${{ runner.os }}- nuget-${{ runner.os }}-
- name: Cache status
if: always()
shell: pwsh
run: |
Write-Host "NuGet cache hit: ${{ steps.nuget-cache.outputs.cache-hit }}"
- name: Restore tools - name: Restore tools
run: dotnet tool restore run: dotnet tool restore
+1
View File
@@ -45,3 +45,4 @@ Desktop.ini
# Internal dev memory (stays local, not published) # Internal dev memory (stays local, not published)
memory-bank/ memory-bank/
memorybank.md