Skip to content

Commit

Permalink
Use "ContinuousIntegrationBuild" env variable instead of "CI"
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienBraillard committed Jul 8, 2024
1 parent 43ea054 commit 1403109
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:

env:
Configuration: Release
ContinuousIntegrationBuild: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
Expand Down
14 changes: 7 additions & 7 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PropertyGroup Label="Restoring">
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<!-- https://devblogs.microsoft.com/nuget/enable-repeatable-package-restores-using-a-lock-file/#how-does-nuget-use-the-lock-file -->
<RestoreLockedMode Condition="$(CI) == 'true'">true</RestoreLockedMode>
<RestoreLockedMode Condition="$(ContinuousIntegrationBuild) == 'true'">true</RestoreLockedMode>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -70,13 +70,13 @@
<PropertyGroup Label="Test results and coverage">
<!-- Sets the test results directory -->
<VSTestResultsDirectory>$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), 'results', $(TargetFramework)))</VSTestResultsDirectory>
<VSTestResultsDirectory Condition="$(CI) == 'true'">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), 'results'))</VSTestResultsDirectory>
<VSTestResultsDirectory Condition="$(ContinuousIntegrationBuild) == 'true'">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), 'results'))</VSTestResultsDirectory>
<!-- Sets up the test results loggers -->
<VSTestLogger>
Console%3Bverbosity=normal;
html%3BLogFileName=TestResultsReport.html
</VSTestLogger>
<VSTestLogger Condition="$(CI) == 'true'">
<VSTestLogger Condition="$(ContinuousIntegrationBuild) == 'true'">
GitHubActions%3Bsummary.includePassedTests=true%3Bsummary.includeSkippedTests=true%3Bsummary.includeNotFoundTests=true;
</VSTestLogger>
<!-- Defines the coverage output path -->
Expand All @@ -103,13 +103,13 @@
</Delete>
<Message Condition="'@(_TestResultsFilesDeleted)' != ''" Importance="normal" Text="Cleaned up previous test results files: @(_TestResultsFilesDeleted)" />
<!-- Add a global title to the Github summary -->
<WriteToGitHubSummary Condition="$(CI) == 'true'" Text="# ❔ &lt;b&gt;Test and coverage results&lt;/b&gt;"/>
<WriteToGitHubSummary Condition="$(ContinuousIntegrationBuild) == 'true'" Text="# ❔ &lt;b&gt;Test and coverage results&lt;/b&gt;"/>
</Target>

<!-- Action run before each framework test run -->
<Target Name="FrameworkTestPreRun" BeforeTargets="VSTest" Condition="$(TargetFramework) != ''">
<!-- Add a title to the Github summary for each framework run -->
<WriteToGitHubSummary Condition="$(CI) == 'true'" Text="## ➡️ $(TargetFramework)"/>
<WriteToGitHubSummary Condition="$(ContinuousIntegrationBuild) == 'true'" Text="## ➡️ $(TargetFramework)"/>
</Target>

<!-- Generate coverage report -->
Expand All @@ -119,9 +119,9 @@
TargetDirectory="$(CoverageOutputDir)"
ReportTypes="HtmlInline;MarkdownSummary" />
<!-- Inform user where the reports are (NON CI run) or push coverage report to GitHub Summary (CI run) -->
<Message Condition="$(CI) != 'true'" Importance="high" Text="ℹ️ Test result reports location: $(VSTestResultsDirectory)" />
<Message Condition="$(ContinuousIntegrationBuild) != 'true'" Importance="high" Text="ℹ️ Test result reports location: $(VSTestResultsDirectory)" />
<SendCoverageToGitHubSummary
Condition="$(CI) == 'true'"
Condition="$(ContinuousIntegrationBuild) == 'true'"
Title="Code Coverage ($(TargetFramework))"
InputFile="$([System.IO.Path]::Combine($(CoverageOutputDir), 'Summary.md'))" />
</Target>
Expand Down

0 comments on commit 1403109

Please sign in to comment.