Skip to content

Commit

Permalink
Merge pull request #586 from bothzoli/fix/failing-test-step-in-pipeline
Browse files Browse the repository at this point in the history
Fail pipeline if test results file is missing
  • Loading branch information
vkhorikov authored Dec 23, 2024
2 parents 7a6e26f + a215314 commit 607096b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<NoWarn>0618</NoWarn>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ stages:
- script: |
docker create --name build-container build-image
docker cp build-container:./app/CSharpFunctionalExtensions.Tests/TestResults ./testresults
# This will make sure that the pipeline fails if the tests were not executed for any reason
if [ ./testresults/testresults.trx ] && [ $(grep -E "<UnitTestResult" ./testresults/testresults.trx -c) -gt 0 ]; then
echo "Test results results found"
else
echo "No test results found"
exit 1
fi
displayName: Extract test results
- task: PublishTestResults@2
Expand Down

0 comments on commit 607096b

Please sign in to comment.