-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
82 lines (64 loc) · 2.27 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
$ENV:DNX_FEED='https://www.nuget.org/api/v2'
if (Test-Path artifacts) {
Remove-Item artifacts -Force -Recurse
}
mkdir artifacts > $null
if (!(Get-Command "dvnm")) {
$Branch='dev';
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'));
$ENV:PATH="$ENV:PATH;$ENV:USERPROFILE\.dnx\bin";
$ENV:DNX_HOME="$ENV:USERPROFILE\.dnx";
}
dnvm install 1.0.0-beta5
dnvm use 1.0.0-beta5
$ENV:PATH="$ENV:USERPROFILE\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta5\bin;$ENV:PATH"
$configuration="Debug"
$ENV:DNX_BUILD_VERSION="alpha"
if ($ENV:APPVEYOR) {
$paddedBuildNumber = $ENV:APPVEYOR_BUILD_NUMBER.PadLeft(5, '0');
IF ($ENV:APPVEYOR_REPO_TAG -eq "false" -or $ENV:APPVEYOR_REPO_TAG -eq "False") {
if ($ENV:APPVEYOR_REPO_BRANCH -eq "master") {
$ENV:DNX_BUILD_VERSION="beta-$paddedBuildNumber";
} else {
$ENV:DNX_BUILD_VERSION="beta-branch-$ENV:APPVEYOR_REPO_BRANCH-$paddedBuildNumber";
}
}
IF ($ENV:APPVEYOR_REPO_TAG -eq "true" -or $ENV:APPVEYOR_REPO_TAG -eq "True") {
$ENV:DNX_BUILD_VERSION=$paddedBuildNumber;
}
}
echo "DNX_BUILD_VERSION: $ENV:DNX_BUILD_VERSION"
dnu restore
if ($lastexitcode -gt 0) { exit $lastexitcode }
$buildFailed = $false;
foreach ($srcFolder in Get-ChildItem src\* -Directory) {
dnu build $srcFolder.FullName
if ($lastexitcode -gt 0) { $buildFailed = $lastexitcode; }
}
if ($buildFailed) {
exit 1;
}
$testsFailed = $false;
foreach ($testFolder in Get-ChildItem test\* -Directory) {
dnx $testFolder.FullName test
if ($lastexitcode -gt 0) { $testsFailed = $lastexitcode; }
}
if ($testsFailed) {
exit 1;
}
$packFailed = $false;
foreach ($srcFolder in Get-ChildItem src\* -Directory) {
dnu pack $srcFolder.FullName --out artifacts\build --configuration $configuration
if ($lastexitcode -gt 0) { $packFailed = $lastexitcode; }
}
if ($packFailed) {
exit 1;
}
foreach ($item in Get-ChildItem artifacts\build\$configuration\*.nupkg -Exclude *.symbols.nupkg) {
copy $item.FullName artifacts\build
}
mkdir artifacts\symbols > $null
foreach ($item in Get-ChildItem artifacts\build\$configuration\*.symbols.nupkg) {
copy $item.FullName artifacts\symbols
}
Remove-Item artifacts\build\$configuration -Force -Recurse