Last active
February 7, 2022 14:51
-
-
Save asears/04f4a488c4987456c57bffa478eeaa55 to your computer and use it in GitHub Desktop.
Test Bicep Files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get-ChildItem -Recurse -Filter "*.bicep" | foreach { Test-BicepFile -Path $_.fullname } | |
| # https://github.com/Azure/bicep/issues/5828 | |
| $biceps = Get-ChildItem -Path . -Include "*.bicep" -r | |
| $errors = 0 | |
| $numberOfFiles = $biceps.Length | |
| foreach ($file in $biceps) { | |
| $fileName = $file.Name | |
| Write-Host "`n-------- Processing $fileName..." | |
| bicep build $file.FullName | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Warning "Compiling $fileName failed" | |
| $errors += 1 | |
| } | |
| } | |
| Write-Host "`n-------- Summary" | |
| Write-Host "Number of files:`t $numberOfFiles" | |
| Write-Host "Successful builds:`t $($numberOfFiles - $errors)" | |
| Write-Host "Failed builds:`t`t $errors" | |
| if ($errors -gt 0){ | |
| exit 1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment