Skip to content

Commit 607096b

Browse files
authored
Merge pull request #586 from bothzoli/fix/failing-test-step-in-pipeline
Fail pipeline if test results file is missing
2 parents 7a6e26f + a215314 commit 607096b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<NoWarn>0618</NoWarn>
6+
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
67
</PropertyGroup>
78

89
<ItemGroup>

azure-pipelines.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ stages:
4444
- script: |
4545
docker create --name build-container build-image
4646
docker cp build-container:./app/CSharpFunctionalExtensions.Tests/TestResults ./testresults
47+
48+
# This will make sure that the pipeline fails if the tests were not executed for any reason
49+
if [ ./testresults/testresults.trx ] && [ $(grep -E "<UnitTestResult" ./testresults/testresults.trx -c) -gt 0 ]; then
50+
echo "Test results results found"
51+
else
52+
echo "No test results found"
53+
exit 1
54+
fi
4755
displayName: Extract test results
4856
4957
- task: PublishTestResults@2

0 commit comments

Comments
 (0)