Skip to content

Fix SmokeTest Projects to Use Version from CI #3658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions SmokeTests/SmokeTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<!-- When writting the SmokeTests, change this to whichever Toolkit project you want to build a test to, then reload the project -->
<CurrentProject>Microsoft.Toolkit.Uwp.UI.Controls</CurrentProject>
</PropertyGroup>
<PropertyGroup Condition="'$(NuGetPackageVersion)' == ''">
<NuGetPackageVersion>To Fill In With Local Version Number</NuGetPackageVersion>
</PropertyGroup>
<!-- - - - - - Don't check-in changes in between this lines. Used for development. - - - - - -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -112,8 +115,8 @@
<Version>2.4.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(CurrentProject)' != '' and '$(CurrentProject)' != 'UWPBaseline'">
<PackageReference Include="$(CurrentProject)" Version="7.*-*" />
<ItemGroup Condition="'$(CurrentProject)' != '' and '$(CurrentProject)' != 'UWPBaseline' and '$(NuGetPackageVersion)' != 'To Fill In With Local Version Number'">
<PackageReference Include="$(CurrentProject)" Version="$(NuGetPackageVersion)" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
Expand All @@ -125,5 +128,6 @@
<ToolkitNuget Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', `$(CurrentProject).([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?.nupkg`))" Include="@(ToolkitNugets)"/>
</ItemGroup>
<Error Condition="'@(ToolkitNuget)' == '' and $(CurrentProject) != 'UWPBaseline'" Text="NuGet $(CurrentProject).[SEMVER].nupkg doesn't exist!"/>
<Error Condition="'$(CurrentProject)' != 'UWPBaseline' and '$(NuGetPackageVersion)' == 'To Fill In With Local Version Number'" Text="Please set NuGetPackageVersion at the top of SmokeTest.csproj with the version to smoke test locally."/>
</Target>
</Project>
7 changes: 7 additions & 0 deletions SmokeTests/SmokeTest.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmokeTest", "SmokeTest.csproj", "{A6E4CB52-1025-4BBA-9C65-BB871D1FB53F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Configuration", "Configuration", "{86F3F991-6DDA-442D-A610-9309D6559522}"
ProjectSection(SolutionItems) = preProject
nuget.config = nuget.config
SmokeTestAnalysis.ps1 = SmokeTestAnalysis.ps1
SmokeTests.proj = SmokeTests.proj
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Expand Down
14 changes: 12 additions & 2 deletions SmokeTests/SmokeTests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,26 @@
<ToolkitPackages>UWPBaseline;Microsoft.Toolkit;Microsoft.Toolkit.HighPerformance;Microsoft.Toolkit.Parsers;Microsoft.Toolkit.Mvvm;Microsoft.Toolkit.Services;Microsoft.Toolkit.Uwp;Microsoft.Toolkit.Uwp.Connectivity;Microsoft.Toolkit.Uwp.DeveloperTools;Microsoft.Toolkit.Uwp.Input.GazeInteraction;Microsoft.Toolkit.Uwp.Notifications;Microsoft.Toolkit.Uwp.UI;Microsoft.Toolkit.Uwp.UI.Animations;Microsoft.Toolkit.Uwp.UI.Controls;Microsoft.Toolkit.Uwp.UI.Controls.DataGrid;Microsoft.Toolkit.Uwp.UI.Controls.Layout;Microsoft.Toolkit.Uwp.UI.Media;Microsoft.Toolkit.Uwp.UI.Controls.Markdown</ToolkitPackages>
</PropertyGroup>

<Target Name="GetNuGetVersion">
<Exec Command="powershell -Command &quot;&amp; { .\&quot;$(ProjectDir)..\build\tools\Nerdbank.GitVersioning\tools\Get-Version.ps1\&quot; | Select -ExpandProperty NuGetPackageVersion }&quot;"
ConsoleToMSBuild="true"
EchoOff="true"
Condition="'$(NuGetPackageVersion)' == ''">
<Output TaskParameter="ConsoleOutput" PropertyName="NuGetPackageVersion" />
</Exec>
<Message Text="Got GitBank Version... $(NuGetPackageVersion)" Importance="High" />
</Target>

<Target Name="Build"
DependsOnTargets="ChooseProjectsToBuild"
DependsOnTargets="ChooseProjectsToBuild;GetNuGetVersion"
Inputs="@(ProjectsToBuild)"
Outputs="%(Filename)">

<Message Importance="High" Text="Building project %(ProjectsToBuild.Identity): (%(ProjectsToBuild.Configuration)|%(ProjectsToBuild.Platform))" />

<MSBuild Projects="SmokeTest.csproj"
Targets="restore;build"
Properties="CurrentProject=%(ProjectsToBuild.Identity);Configuration=%(ProjectsToBuild.Configuration);Platform=%(ProjectsToBuild.Platform)"/>
Properties="CurrentProject=%(ProjectsToBuild.Identity);Configuration=%(ProjectsToBuild.Configuration);Platform=%(ProjectsToBuild.Platform);NuGetPackageVersion=$(NuGetPackageVersion)"/>
</Target>

<Target Name="ChooseProjectsToBuild" DependsOnTargets="CheckNugets">
Expand Down
13 changes: 11 additions & 2 deletions build/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ Task("Verify")

Task("Version")
.Description("Updates the version information in all Projects")
.IsDependentOn("Verify")
.Does(() =>
{
Information("\nDownloading NerdBank GitVersioning...");
Expand Down Expand Up @@ -210,6 +209,7 @@ Task("InheritDoc")

Task("Build")
.Description("Build all projects runs InheritDoc")
.IsDependentOn("Verify")
.IsDependentOn("BuildProjects")
.IsDependentOn("InheritDoc");

Expand Down Expand Up @@ -289,10 +289,19 @@ Task("UITest")

Task("SmokeTest")
.Description("Runs all Smoke Tests")
.IsDependentOn("Version")
.Does(() =>
{
// Need to do full NuGet restore here to grab proper UWP dependencies...
NuGetRestore(baseDir + "/SmokeTests/SmokeTest.csproj");
MSBuild(baseDir + "/SmokeTests/SmokeTests.proj");

var buildSettings = new MSBuildSettings()
{
Restore = true,
}
.WithProperty("NuGetPackageVersion", Version);

MSBuild(baseDir + "/SmokeTests/SmokeTests.proj", buildSettings);
}).DeferOnError();

Task("MSTestUITest")
Expand Down