Skip to content

Commit

Permalink
improve behavior in case when the test logs are not output
Browse files Browse the repository at this point in the history
  • Loading branch information
smdn committed Jan 26, 2023
1 parent 9a01055 commit 4294243
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ SPDX-License-Identifier: MIT

<ItemGroup>
<LiquidTestReportsLogFileCandidate Include="$(LiquidTestReportsTestReportDirectory)*$(LiquidTestReportsTestReportFileExtensionWithTargetFramework)" />
</ItemGroup>

<ItemGroup Condition=" '@(LiquidTestReportsLogFileCandidate)' != '' ">
<!-- extract only log files that are created after the started time and before the finished time -->
<LiquidTestReportsLogFile
Include="@(LiquidTestReportsLogFileCandidate)"
Expand All @@ -73,13 +76,30 @@ SPDX-License-Identifier: MIT
($([System.DateTimeOffset]::Parse(%(CreatedTime)).Ticks)) &lt; ($(LiquidTestReportsTestFinishedAt))
"
/>
<LiquidTestReportsLogFileContent Include="$([System.IO.File]::ReadAllText('%(LiquidTestReportsLogFile.Identity)'))"/>
</ItemGroup>

<PropertyGroup>
<_HasLiquidTestReportsLogFileGenerated>false</_HasLiquidTestReportsLogFileGenerated>
<_HasLiquidTestReportsLogFileGenerated Condition=" '@(LiquidTestReportsLogFile)' != '' ">true</_HasLiquidTestReportsLogFileGenerated>
</PropertyGroup>

<Warning
Text="No test logs were output to directory '$(LiquidTestReportsTestReportDirectory)'. Make sure that the configurations are valid and there are no syntax errors in the template file."
File="$(MSBuildProjectFullPath)"
Condition=" '$(_HasLiquidTestReportsLogFileGenerated)' != 'true' "
/>

<ItemGroup Condition=" '$(_HasLiquidTestReportsLogFileGenerated)' == 'true' ">
<LiquidTestReportsLogFileContent Include="$([System.IO.File]::ReadAllText('%(LiquidTestReportsLogFile.Identity)'))" />
</ItemGroup>

<PropertyGroup>
<LiquidTestReportsStepSummaryContents>%0A%0A@(LiquidTestReportsLogFileContent, '%0A%0A----%0A%0A')</LiquidTestReportsStepSummaryContents>
</PropertyGroup>

<GitHubActionsStepSummaryAppendContent Contents="$(LiquidTestReportsStepSummaryContents)" />
<GitHubActionsStepSummaryAppendContent
Contents="$(LiquidTestReportsStepSummaryContents)"
Condition=" '$(_HasLiquidTestReportsLogFileGenerated)' == 'true' "
/>
</Target>
</Project>

0 comments on commit 4294243

Please sign in to comment.