From 283c2d744b34f3b7592472b76a0f746926a2306b Mon Sep 17 00:00:00 2001 From: fristyxd Date: Sat, 5 Sep 2026 00:56:34 +0300 Subject: [PATCH] ci: fix NuGet cache path with NUGET_PACKAGES env var - 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 --- .gitea/workflows/ci.yml | 39 ++++++++++++++++++++++++++++++++++++--- .gitignore | 1 + 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 961fc6f..5aa5927 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -14,6 +14,10 @@ on: jobs: build: runs-on: windows-latest + env: + NUGET_PACKAGES: ${{ runner.temp }}/.nuget/packages + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPT_OUT: true steps: - name: Checkout uses: actions/checkout@v4 @@ -28,14 +32,21 @@ jobs: DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet - name: Cache NuGet packages + id: nuget-cache uses: actions/cache@v4 continue-on-error: true with: - path: ~/.nuget/packages + path: ${{ runner.temp }}/.nuget/packages key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} restore-keys: | 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 run: dotnet tool restore @@ -47,6 +58,10 @@ jobs: test: runs-on: windows-latest + env: + NUGET_PACKAGES: ${{ runner.temp }}/.nuget/packages + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPT_OUT: true steps: - name: Checkout uses: actions/checkout@v4 @@ -61,14 +76,21 @@ jobs: DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet - name: Cache NuGet packages + id: nuget-cache uses: actions/cache@v4 continue-on-error: true with: - path: ~/.nuget/packages + path: ${{ runner.temp }}/.nuget/packages key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} restore-keys: | 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) shell: pwsh run: | @@ -89,6 +111,10 @@ jobs: - test if: startsWith(gitea.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' runs-on: windows-latest + env: + NUGET_PACKAGES: ${{ runner.temp }}/.nuget/packages + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPT_OUT: true steps: - name: Checkout uses: actions/checkout@v4 @@ -103,14 +129,21 @@ jobs: DOTNET_INSTALL_DIR: ${{ runner.temp }}\dotnet - name: Cache NuGet packages + id: nuget-cache uses: actions/cache@v4 continue-on-error: true with: - path: ~/.nuget/packages + path: ${{ runner.temp }}/.nuget/packages key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} restore-keys: | 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 run: dotnet tool restore diff --git a/.gitignore b/.gitignore index a8a0dd9..1983b7f 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ Desktop.ini # Internal dev memory (stays local, not published) memory-bank/ +memorybank.md