forked from simpleidserver/EFCore.Cassandra
-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.ps1
56 lines (44 loc) · 1.76 KB
/
default.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
properties {
$base_dir = resolve-path .
$build_dir = "$base_dir\build"
$source_dir = "$base_dir\src"
$result_dir = "$build_dir\results"
$global:config = "debug"
$tag = $(git tag -l --points-at HEAD)
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$suffix = @{ $true = ""; $false = "ci-$revision"}[$tag -ne $NULL -and $revision -ne "local"]
$commitHash = $(git rev-parse --short HEAD)
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
$versionSuffix = @{ $true = "--version-suffix=$($suffix)"; $false = ""}[$suffix -ne ""]
}
task default -depends local
task local -depends compile, test
task ci -depends clean, release, local, pack
# task ci -depends clean, release, local, pack, benchmark
task clean {
rd "$source_dir\artifacts" -recurse -force -ErrorAction SilentlyContinue | out-null
rd "$base_dir\build" -recurse -force -ErrorAction SilentlyContinue | out-null
}
task release {
$global:config = "release"
}
task compile -depends clean {
echo "build: Tag is $tag"
echo "build: Package version suffix is $suffix"
echo "build: Build version suffix is $buildSuffix"
exec { dotnet --version }
exec { dotnet --info }
exec { msbuild -version }
exec { dotnet build .\EFCore.Cassandra.sln -c $config --version-suffix=$buildSuffix }
}
task pack -depends compile {
exec { dotnet pack $source_dir\EFCore.Cassandra\EFCore.Cassandra.csproj -c $config --no-build $versionSuffix --output $result_dir }
}
task test {
Push-Location -Path $base_dir\tests\EFCore.Cassandra.Tests
try {
exec { & dotnet test -c $config --no-build --no-restore }
} finally {
Pop-Location
}
}