Skip to content

Commit d686d4a

Browse files
Copilotatifaziz
andcommitted
Improve comments for clarity: explain AllowTestFailures usage and CI shell context
Co-authored-by: atifaziz <20511+atifaziz@users.noreply.github.com>
1 parent 18203ad commit d686d4a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ jobs:
4848
run: dotnet tool restore
4949

5050
- name: Build
51+
# Uses 'dotnet pwsh' because the default shell (bash/cmd) is not PowerShell
5152
run: dotnet pwsh ./build.ps1 -Build -Configuration ${{ env.CONFIGURATION }}
5253

5354
- name: Pack (Windows only)
5455
if: runner.os == 'Windows'
56+
# Uses 'shell: pwsh' so commands run in PowerShell context
5557
shell: pwsh
5658
run: |
5759
$commitTimestamp = git log -1 --format=%cI
@@ -93,6 +95,7 @@ jobs:
9395
ForEach-Object { dotnet sourcelink test $_; if ($LASTEXITCODE) { throw "SourceLink test failed for $_" } }
9496
9597
- name: Test
98+
# Uses 'dotnet pwsh' because the default shell (bash/cmd) is not PowerShell
9699
run: dotnet pwsh ./build.ps1 -Test -NoBuild -Configuration ${{ env.CONFIGURATION }}
97100

98101
- name: Integration Tests (Windows)

build.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ try {
9191
Write-Host "dotnet $($Arguments -join ' ')" -ForegroundColor Cyan
9292
& dotnet @Arguments
9393
if ($LASTEXITCODE -ne 0) {
94-
# On non-Windows platforms, net47 tests may fail due to missing mono,
95-
# but this is expected. For test commands, we allow exit code 1.
94+
# Some test frameworks (e.g., net47) may not run on all platforms (Linux/macOS require mono).
95+
# Allow exit code 1 for test commands when the runnable tests passed but some frameworks couldn't execute.
9696
if ($AllowTestFailures -and $LASTEXITCODE -eq 1) {
9797
Write-Host "Test command returned exit code 1 (this may be due to net47 requiring mono on Linux)" -ForegroundColor Yellow
9898
} else {
@@ -115,6 +115,8 @@ try {
115115
}
116116

117117
Write-Host "`n=== Running Tests ===" -ForegroundColor Green
118+
# AllowTestFailures handles the case where net47 tests cannot run (requires mono on Linux/macOS)
119+
# while still ensuring that tests that can run actually pass
118120
Invoke-DotNet 'test', '--no-build', '--configuration', $Configuration -AllowTestFailures
119121

120122
# Note: Roslyn 4.4 analyzer is validated through integration tests

0 commit comments

Comments
 (0)