Skip to content

Commit 270aa30

Browse files
committed
Test if token is available
WE2-964 Signed-off-by: Sven Mitt <[email protected]>
1 parent 17a44b0 commit 270aa30

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

.github/workflows/sonarcloud-analysis.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ jobs:
99
runs-on: windows-latest
1010

1111
steps:
12+
- name: Unset CACHE_VERSION
13+
shell: powershell
14+
run: |
15+
Remove-Item Env:CACHE_VERSION -ErrorAction SilentlyContinue
16+
Write-Host "CACHE_VERSION has been unset"
17+
1218
- uses: actions/checkout@v4
1319
with:
1420
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
@@ -42,16 +48,7 @@ jobs:
4248
key: ${{ runner.os }}-sonar
4349
restore-keys: ${{ runner.os }}-sonar
4450

45-
- name: Cache SonarCloud scanner
46-
id: cache-sonar-scanner
47-
uses: actions/cache@v4
48-
with:
49-
path: .\.sonar\scanner
50-
key: ${{ runner.os }}-sonar-scanner
51-
restore-keys: ${{ runner.os }}-sonar-scanner
52-
5351
- name: Install SonarCloud scanner
54-
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
5552
shell: powershell
5653
run: |
5754
New-Item -Path .\.sonar\scanner -ItemType Directory
@@ -61,18 +58,17 @@ jobs:
6158
env:
6259
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
6360
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
64-
CACHE_VERSION: ${{ vars.CACHE_VERSION }}
6561
shell: powershell
6662
run: |
6763
Write-Host "Branch: ${{ github.ref_name }}"
6864
Write-Host "Repository: ${{ github.repository }}"
6965
Write-Host "Event: ${{ github.event_name }}"
66+
Write-Host "CACHE_VERSION value: '$env:CACHE_VERSION'"
7067
if ("${{ secrets.SONAR_TOKEN }}" -eq "") {
7168
Write-Host "SONAR_TOKEN is missing"
7269
} else {
73-
Write-Host "SONAR_TOKEN is available -3 (length: $("${{ secrets.SONAR_TOKEN }}".Length))"
70+
Write-Host "SONAR_TOKEN is available -4 (length: $("${{ secrets.SONAR_TOKEN }}".Length))"
7471
}
75-
Remove-Item Env:CACHE_VERSION -ErrorAction SilentlyContinue
7672
.\.sonar\scanner\dotnet-sonarscanner begin /k:"web-eid_web-eid-authtoken-validation-dotnet" /o:"web-eid" /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/coverage.opencover.xml" /d:sonar.cs.vstest.reportsPaths="**/TestResults/*.trx" /d:sonar.verbose=true /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
7773
dotnet build --configuration Release --no-restore src/WebEid.Security.sln
7874
dotnet test src/WebEid.Security.sln --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover --results-directory "TestResults"

0 commit comments

Comments
 (0)