Repository navigation
Expand file tree
/
Copy pathbuild.ps1
More file actions
60 lines (50 loc) · 1.64 KB
/
Copy pathbuild.ps1
File metadata and controls
60 lines (50 loc) · 1.64 KB
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
function packProj () {
$branch = $($env:APPVEYOR_REPO_BRANCH)
$config = "Debug"
if ($branch -eq "master") {
$config = "Release"
}
# download link files
downloadFiles
$packVersion = $env:APPVEYOR_BUILD_VERSION
if ($env:APPVEYOR_REPO_BRANCH -ne "master") {
$packVersion += "-beta"
}
$projName = "src\$($env:APPVEYOR_PROJECT_NAME)"
write-host "dotnet pack $projName -c $config" -ForegroundColor Cyan
dotnet pack $projName -c $config -p:Version=$packVersion
}
function downloadFiles () {
$projectName = $($env:APPVEYOR_PROJECT_NAME)
$longbow = ("Longbow.Logging","Longbow.Web","Longbow.Data","Longbow.Tasks","Bootstrap.Security.Mvc")
if ($longbow -contains $projectName) {
downloadFromLongbow
}
}
function downloadFromLongbow ($file) {
$repoUrl = "https://github.com/LongbowGroup/Longbow.git"
write-host "git clone $repoUrl" -ForegroundColor Cyan
git clone -q --depth=1 --branch=master $repoUrl c:\projects\Longbow
}
function testProj ($target) {
$projName = "test\$($env:APPVEYOR_PROJECT_NAME).Test"
write-host "dotnet test $projName -f $target" -ForegroundColor Cyan
dotnet test $projName -f $target
}
function runUniTest () {
$branch = $($env:APPVEYOR_REPO_BRANCH)
if ($branch -eq "master") {
testProj net472
testProj netcoreapp2.2
}
else {
write-host """$($env:APPVEYOR_REPO_PROVIDER)"" UnitTest has been skipped as environment variable has not matched (""APPVEYOR_REPO_BRANCH"" is ""$($env:APPVEYOR_REPO_BRANCH)"", should be ""master"")" -BackgroundColor yellow -ForegroundColor black
}
}
$action = $args[0]
if ($action -eq "UnitTest") {
runUniTest
}
else {
packProj
}