Skip to content

Commit

Permalink
Adding scripts to build website and unit test project on VSTS build s…
Browse files Browse the repository at this point in the history
…ystem.
  • Loading branch information
EMaher committed Jan 26, 2016
1 parent 22dbf7e commit f3ced3d
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 149 deletions.
29 changes: 0 additions & 29 deletions Prebuild.ps1

This file was deleted.

30 changes: 0 additions & 30 deletions build.cmd

This file was deleted.

11 changes: 11 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)] [string] $BuildConfiguration
)

#Install dnvm
& scripts/Install-Dnvm.ps1

# Restore and build projects
& scripts/Call-Dnu.ps1 restore .\src
& scripts/Call-Dnu.ps1 build .\src\PartsUnlimitedWebsite --configuration $BuildConfiguration
38 changes: 0 additions & 38 deletions build.sh

This file was deleted.

8 changes: 0 additions & 8 deletions makefile.shade

This file was deleted.

19 changes: 19 additions & 0 deletions scripts/Call-Dnu.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#Add dnu to path
Write-Verbose "Add dnu to path for this session."
Invoke-Expression "$env:USERPROFILE\.dnx\bin\dnvm.ps1 use default"

# Temporarily, add web tools to path, if not already included.
$pathToWebTools = "$env:VS140COMNTOOLS..\IDE\Extensions\Microsoft\Web Tools\External\"
if (!$env:Path.Contains($pathToWebTools)){
Write-Verbose "Adding '$pathToWebTools' to path for this session."
$env:Path += ";$pathToWebTools"
}
Write-Debug "Current Path: $env:Path"

#Setting npm loglevel to 'error' to avoid build failures due to package warnings.
Write-Verbose "Setting npm log level to 'error'"
$env:npm_config_loglevel="error"

#Call dnu
Write-Verbose "Executing: dnu $args"
& dnu $args
15 changes: 15 additions & 0 deletions scripts/Call-Dnx.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#Add dnu to path
Write-Verbose "Add dnx to path for this session."
Invoke-Expression "$env:USERPROFILE\.dnx\bin\dnvm.ps1 use default"

# Temporarily, add web tools to path, if not already included.
$pathToWebTools = "$env:VS140COMNTOOLS..\IDE\Extensions\Microsoft\Web Tools\External\"
if (!$env:Path.Contains($pathToWebTools)){
Write-Verbose "Adding '$pathToWebTools' to path for this session."
$env:Path += ";$pathToWebTools"
}
Write-Debug "Current Path: $env:Path"

#Call dnu
Write-Verbose "Executing: dnx $args"
& dnx $args
19 changes: 19 additions & 0 deletions scripts/Install-Dnvm.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# bootstrap DNVM into this session.
Write-Debug "Install DNVM into this session."
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
# load up the global.json so we can find the DNX version
$globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore
if($globalJson.sdk.version)
{
Write-Debug = "Using $globalJson.sdk.version"
$dnxVersion = $globalJson.sdk.version
}
else
{
Write-Warning "Unable to locate global.json to determine target version. Using 'latest'."
$dnxVersion = "latest"
}

# Install DNVM. Alias as 'default' for so projects are built with this version later.
& $env:USERPROFILE\.dnx\bin\dnvm.ps1 install $dnxVersion -Persistent -Alias default

48 changes: 20 additions & 28 deletions test/PartsUnlimited.UnitTests/PartsUnlimited.UnitTests.xproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>0c64e1a0-7791-457b-bd8a-60cba4979702</ProjectGuid>
<RootNamespace>PartsUnlimited</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AssemblyName>PartsUnlimited.UnitTests</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
<ProjectExtensions>
<VisualStudio>
<UserProperties project_1json__JSONSchema="http://www.asp.net/media/4878834/project.json" />
</VisualStudio>
</ProjectExtensions>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>0c64e1a0-7791-457b-bd8a-60cba4979702</ProjectGuid>
<RootNamespace>PartsUnlimited.UnitTests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public void AltTagDisplayed()
const string src = "somepath.png";
const string alt = "some alternate text";

ContentDeliveryNetworkExtensions.Configuration = null;

var tag = _myHtmlHelper.Image(src, alt);

Assert.Null(ContentDeliveryNetworkExtensions.Configuration);
Expand Down
38 changes: 22 additions & 16 deletions test/PartsUnlimited.UnitTests/project.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
"version": "1.0.0-*",
"dependencies": {
"xunit": "2.1.0-*",
"xunit.runner.dnx": "2.1.0-*",
"NSubstitute": "1.8.1",
"PartsUnlimitedWebsite": ""
},
"commands": {
"test": "xunit.runner.dnx"
},
"frameworks": {
"dnx451": { }
}
}

{
"authors": [
"Microsoft"
],
"license": "MIT",
"description": "Parts Unlimited unit tests",
"version": "1.0.0-*",
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.dnx": "2.1.0-rc1-build204",
"xunit.runner.visualstudio": "2.1.0-rc1-build1124",
"NSubstitute": "1.8.1",
"PartsUnlimitedWebsite": ""
},
"commands": {
"test": "xunit.runner.dnx"
},
"frameworks": {
"dnx451": { }
}
}

0 comments on commit f3ced3d

Please sign in to comment.