1+ param (
2+ [ValidateSet (" debug" , " release" )]
3+ [string ]$Configuration = ' release'
4+ )
5+
6+ $RepoRoot = $PSScriptRoot
7+
8+ $ArtifactsDir = Join-Path $RepoRoot ' artifacts'
9+ $CLIRoot = Join-Path $RepoRoot ' cli'
10+ $DotNetExe = Join-Path $CLIRoot ' dotnet.exe'
11+ $NuGetExe = Join-Path $RepoRoot ' .nuget\nuget.exe'
12+
13+ New-Item - ItemType Directory - Force - Path $CLIRoot | Out-Null
14+ New-Item - ItemType Directory - Force - Path $ArtifactsDir | Out-Null
15+
16+ if (-not (Test-Path $NuGetExe ))
17+ {
18+ wget https:// dist.nuget.org/ win- x86- commandline/ latest/ nuget.exe - OutFile $NuGetExe
19+ }
20+
21+ & $NuGetExe restore (Join-Path $RepoRoot ' .nuget\packages.config' ) - SolutionDirectory $RepoRoot
22+
23+ # install dotnet CLI
24+ $env: DOTNET_HOME = $CLIRoot
25+
26+ $installDotnet = Join-Path $CLIRoot " install.ps1"
27+ $env: DOTNET_INSTALL_DIR = $NuGetClientRoot
28+
29+ New-Item - ItemType Directory - Force - Path $CLIRoot
30+
31+ wget https:// raw.githubusercontent.com / dotnet/ cli/ rel/ 1.0 .0 / scripts/ obtain/ install.ps1 - OutFile cli/ install.ps1
32+
33+ & cli/ install.ps1 - Channel beta - i $CLIRoot - Version 1.0 .0 - preview1- 002702
34+
35+ if (-not (Test-Path $DotNetExe )) {
36+ Write-Host " Unable to find dotnet.exe. The CLI install may have failed."
37+ Exit 1
38+ }
39+
40+ # Display build info
41+ & $DotNetExe -- info
42+
43+
44+ # download nuget packages
45+ & $DotNetExe restore $RepoRoot
46+
47+ # Run tests
48+ $TestDir = Join-Path $RepoRoot test\JsonLDTests
49+ pushd $TestDir
50+
51+ # core clr
52+
53+ & $DotNetExe test -- configuration $Configuration -f netcoreapp1.0
54+
55+ if (-not $? ) {
56+ Error- Log " Tests failed!!!"
57+ Exit 1
58+ }
59+
60+ # net46
61+ & $DotNetExe build -- configuration $Configuration -f net46 -- runtime win7- x64
62+
63+ $xunit = Join-Path $RepoRoot packages\xunit.runner.console.2.1 .0 \tools\xunit.console.x86.exe
64+
65+ & $xunit bin\release\net46\win7- x64\JsonLDTests.dll - html (Join-Path $ArtifactsDir " testresults.html" )
66+
67+ if (-not $? ) {
68+ Error- Log " Tests failed!!!"
69+ Exit 1
70+ }
71+
72+ popd
73+
74+ # Pack
75+
76+ Write-Host " Creating nupkg"
77+
78+ & $DotNetExe pack (Join-Path $RepoRoot src\JsonLD) -- configuration $Configuration -- output $ArtifactsDir
79+
80+ Write-Host " Success!"
0 commit comments