Skip to content
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

Run unit tests as part of the build (and CI) #789

Merged
merged 12 commits into from
Oct 15, 2019
13 changes: 11 additions & 2 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@

<Import Project="Directory.Build.targets" />

<ItemGroup>
<UnitTestProjects Include="$(MSBuildThisFileDirectory)src\devices\**\*.Tests.csproj" />
</ItemGroup>

<Target Name="BuildProduct">
<ItemGroup>
<_ExcludeBuildProductProjects Include="$(MSBuildThisFileDirectory)src\Iot.Device.Bindings\Iot.Device.Bindings.csproj" />
<_ExcludeBuildProductProjects Include="$(MSBuildThisFileDirectory)src\Native\build-native.proj" />
<_BuildProductProjects Include="$(MSBuildThisFileDirectory)src\**\*.csproj" Exclude="@(_ExcludeBuildProductProjects)" />
<_BuildProductProjects Include="$(MSBuildThisFileDirectory)src\**\*.csproj" Exclude="@(_ExcludeBuildProductProjects);@(UnitTestProjects)" />
</ItemGroup>

<MSBuild Projects="@(_BuildProductProjects)" />
Expand Down Expand Up @@ -56,7 +60,12 @@
<MSBuild Projects="@(_ProjectsToRestore)" Targets="Restore" />
</Target>

<Target Name="Test" />
<Target Name="Test">
<MSBuild Projects="@(UnitTestProjects)" Targets="VSTest"
ContinueOnError="ErrorAndContinue" />
<Error Condition="$(MSBuildLastTaskResult) != 'true'"
Text="Unit tests failed. Please check the detailed log to find out which ones failed." />
</Target>

<Target Name="Pack">
<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/devices/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target Name="Test" />
</Project>