You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2025/09/07 15:23:19 UTC

(lucenenet) 20/21: .github/workflows/sonar.yml: Updated to use the same cache key as other workflows that require dotnet restore

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch ci/cache-nuget-packages
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 06309d67f29946b4905f0c7837897d5621a52a91
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Sep 7 21:45:59 2025 +0700

    .github/workflows/sonar.yml: Updated to use the same cache key as other workflows that require dotnet restore
---
 .github/workflows/sonar.yml | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
index cf116e81a..a39230a86 100644
--- a/.github/workflows/sonar.yml
+++ b/.github/workflows/sonar.yml
@@ -39,12 +39,11 @@ jobs:
     if: github.repository == 'apache/lucenenet' # Don't run on forks
     name: Build and analyze
     runs-on: windows-latest
+    env:
+      DOTNET_NOLOGO: 1
+      DOTNET_CLI_TELEMETRY_OPTOUT: 1
+      NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
     steps:
-      - name: Disable .NET SDK Telemetry and Logo
-        run: |
-          echo "DOTNET_NOLOGO=1" | Out-File -FilePath  $env:GITHUB_ENV -Encoding utf8 -Append
-          echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" | Out-File -FilePath  $env:GITHUB_ENV -Encoding utf8 -Append
-        shell: pwsh
       - name: Setup .NET 8 SDK
         uses: actions/setup-dotnet@v3
         with:
@@ -78,14 +77,15 @@ jobs:
           if (!(Test-Path $dir)) { New-Item -Path $dir -ItemType Directory }
           dotnet tool update dotnet-sonarscanner --tool-path $dir
       - name: Cache NuGet Packages
-        uses: actions/cache@v3
-        id: lucene-nuget-cache
+        uses: actions/cache@v4
         with:
-          path: |
-            ~/.nuget/packages
-          key: `${{ runner.os }}-nuget-`${{ hashFiles('**/packages.lock.json') }}
-          restore-keys: |
-            `${{ runner.os }}-nuget-lucene
+          # '**/*.*proj' includes .csproj, .vbproj, .fsproj, msbuildproj, etc.
+          # '**/*.props' includes Directory.Packages.props, Directory.Build.props and Dependencies.props
+          # '**/*.targets' includes Directory.Build.targets
+          # '**/*.sln' and '*.sln' ensure root solution files are included (minimatch glitch for file extension .sln)
+          # 'global.json' included for SDK version changes
+          key: nuget-${{ runner.os }}-${{ hashFiles('**/*.*proj', '**/*.props', '**/*.targets', '**/*.sln', '*.sln', 'global.json') }}
+          path: ${{ env.NUGET_PACKAGES }}
       - name: Restore dependencies
         run: dotnet restore
       - name: Build and analyze