1010- powershell : Set-Location ${{ parameters.pathToSrc }}
1111 displayName : ' Set Location to CLI Folder'
1212
13+ - powershell : Move-Item -Path $(Build.SourcesDirectory)\README.md -Destination ${{ parameters.pathToSrc }}\README.md
14+ displayName : Move README into CLI Folder
15+
1316- task : PowerShell@2
1417 displayName : ' Execute Build Runner'
1518 inputs :
@@ -19,14 +22,64 @@ steps:
1922 dart run build_runner build --delete-conflicting-outputs
2023
2124 - script : |
25+ export PATH="$PATH:$HOME/.pub-cache/bin"
2226 dart pub global activate pana
2327 cd ${{ parameters.pathToSrc }}
24- %LOCALAPPDATA%\Pub\Cache\bin\ pana > $(Build.SourcesDirectory)/pana-analysis.md
28+ pana --no-warning . > $(Build.SourcesDirectory)/pana-analysis.md
2529 displayName : ' Run Pana Analysis'
26-
30+
2731- task : PublishBuildArtifacts@1
2832 displayName : ' Publish Pana Analysis'
2933 inputs :
3034 pathToPublish : ' $(Build.SourcesDirectory)/pana-analysis.md'
3135 artifactName : ' ${{ parameters.artifactName }}_PanaAnalysis'
32- condition : and(succeeded(), ne('${{ parameters.artifactName }}', ''))
36+ condition : and(succeeded(), ne('${{ parameters.artifactName }}', ''))
37+
38+ - task : PowerShell@2
39+ displayName : ' Validate Pana Score and Display Details'
40+ inputs :
41+ targetType : ' inline'
42+ script : |
43+ $panaFile = "$(Build.SourcesDirectory)/pana-analysis.md"
44+ if (Test-Path $panaFile) {
45+ $content = Get-Content $panaFile
46+
47+ # Extract the total score
48+ $scoreLine = $content | Select-String -Pattern "Points: (\d+)/160"
49+ if ($scoreLine -match "Points: (\d+)/160") {
50+ $score = [int]$Matches[1]
51+ Write-Host ""
52+ Write-Host "Current Pana Score: $score/160"
53+ Write-Host ""
54+
55+ # Check if the score is below the threshold
56+ if ($score -lt 160) {
57+ Write-Host "The score is below the threshold of 160."
58+ Write-Host ""
59+
60+ # Extract sections with less than full points
61+ $lowScores = $content | Select-String -Pattern "### \[x\] \d+/\d+ points: .*"
62+ if ($lowScores) {
63+ Write-Host "Areas with reduced scores:"
64+ foreach ($line in $lowScores) {
65+ Write-Host $line.Line
66+ }
67+ Write-Host ""
68+ } else {
69+ Write-Host "No specific areas with reduced scores were found."
70+ Write-Host ""
71+ }
72+
73+ exit 1
74+ } else {
75+ Write-Host "The score meets the threshold. Build passed."
76+ Write-Host ""
77+ }
78+ } else {
79+ Write-Error "Unable to find a valid score in the pana-analysis.md file."
80+ exit 1
81+ }
82+ } else {
83+ Write-Error "pana-analysis.md file not found."
84+ exit 1
85+ }
0 commit comments