forked from nhibernate/NHibernate-Caches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
134 lines (125 loc) · 5.43 KB
/
appveyor.yml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
version: 5.9.0.{build}
image: Visual Studio 2022
configuration:
- Debug
- Release
environment:
global:
netTargetFx: net461
coreTargetFx: net8.0
matrix:
- tests: net
- tests: core
matrix:
exclude:
- tests: core
configuration: Release
install:
# memcache server
- curl -L -O -S -s https://github.com/jefyt/memcached-windows/releases/download/1.6.8_mingw/memcached-1.6.8-win64-mingw.zip
- 7z x memcached-1.6.8-win64-mingw.zip
- ps: $MemCached = Start-Process memcached-1.6.8-win64-mingw\bin\memcached.exe -PassThru
# redis server
- curl -L -O -S -s https://github.com/ServiceStack/redis-windows/raw/master/downloads/redis64-2.8.17.zip
- 7z x redis64-2.8.17.zip
- ps: $Redis = Start-Process redis-server.exe redis.windows.conf -PassThru
before_build:
- which msbuild.exe
- nuget restore NHibernate.Caches.Everything.sln
# Disable automated build, use build script instead
build: off
build_script:
- ps: >-
Invoke-Command -ScriptBlock {
$nugetFolderName = 'nuget_gallery'
$nugetPath = (Join-Path $env:APPVEYOR_BUILD_FOLDER $nugetFolderName)
$generatePackage = 'False'
If ($env:CONFIGURATION -eq 'Release') {
$generatePackage = 'True'
}
mkdir $nugetPath
dotnet msbuild (Join-Path $env:APPVEYOR_BUILD_FOLDER 'NHibernate.Caches.Everything.sln') /verbosity:minimal `
'/p:Platform="Any CPU"' "/p:Configuration=$env:CONFIGURATION" "/p:GeneratePackageOnBuild=$generatePackage" `
/p:IncludeSymbols=True /p:IncludeSource=True "/p:PackageOutputPath=$nugetPath"
}
after_build:
- ps: >-
Invoke-Command -ScriptBlock {
# Package artificats if this is a release build.
If ($env:CONFIGURATION -ne 'Release') {
return
}
$version = ($env:APPVEYOR_BUILD_VERSION).Substring(0, ($env:APPVEYOR_BUILD_VERSION).lastIndexOf('.'))
$netTargetFx = 'net461'
$nugetFolderName = 'nuget_gallery'
$nugetPath = (Join-Path $env:APPVEYOR_BUILD_FOLDER $nugetFolderName)
$binPackage = (Join-Path $env:APPVEYOR_BUILD_FOLDER "NHCH-$version-bin")
mkdir $binPackage
cp (Join-Path $env:APPVEYOR_BUILD_FOLDER 'readme.md') $binPackage
cp (Join-Path $env:APPVEYOR_BUILD_FOLDER 'LICENSE.txt') $binPackage
cd $env:APPVEYOR_BUILD_FOLDER
7z a "NHCH-$version-bin.zip" "NHCH-$version-bin\"
#NuGet push bat
cd $nugetPath
$wc = New-Object System.Net.WebClient
$nugetExe = Join-Path $nugetPath 'NuGet.exe'
$wc.DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', $nugetExe)
Add-Content 'NuGetPush.bat' "rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey'"
Get-Item '*.nupkg' | ForEach-Object {
Add-Content 'NuGetPush.bat' "nuget push -source https://api.nuget.org/v3/index.json $($_.Name)"
}
cd $env:APPVEYOR_BUILD_FOLDER
7z a "$nugetFolderName.zip" "$nugetFolderName\"
}
test_script:
- ps: >-
Invoke-Command -ScriptBlock {
$TestsFailed = $FALSE
$target = If ($env:TESTS -eq 'net') {$env:NETTARGETFX} Else {$env:CORETARGETFX}
$projects = @{}
$projects.Add('Common', "NHibernate.Caches.Common.Tests\bin\$env:CONFIGURATION\$target\NHibernate.Caches.Common.Tests.dll")
$projects.Add('Util.JsonSerializer', "Util\NHibernate.Caches.Util.JsonSerializer.Tests\bin\$env:CONFIGURATION\$target\NHibernate.Caches.Util.JsonSerializer.Tests.dll")
#netFx tests
If ($env:TESTS -eq 'net') {
@('EnyimMemcached', 'RtMemoryCache', 'SysCache', 'SysCache2', 'CoreMemoryCache', 'CoreDistributedCache', 'StackExchangeRedis') | ForEach-Object {
$projects.Add($_, "$_\NHibernate.Caches.$_.Tests\bin\$env:CONFIGURATION\$target\NHibernate.Caches.$_.Tests.dll")
}
ForEach ($project in $projects.GetEnumerator()) {
nunit3-console (Join-Path $env:APPVEYOR_BUILD_FOLDER $project.Value) "--result=$($project.Name)-NetTestResult.xml;format=AppVeyor"
If ($LASTEXITCODE -ne 0) {
$TestsFailed = $TRUE
}
}
}
#core tests
If ($env:TESTS -eq 'core') {
@('CoreMemoryCache', 'CoreDistributedCache', 'RtMemoryCache', 'StackExchangeRedis') | ForEach-Object {
$projects.Add($_, "$_\NHibernate.Caches.$_.Tests\bin\$env:CONFIGURATION\$target\NHibernate.Caches.$_.Tests.dll")
}
ForEach ($project in $projects.GetEnumerator()) {
dotnet (Join-Path $env:APPVEYOR_BUILD_FOLDER $project.Value) --labels=before --nocolor "--result=$($project.Name)-CoreTestResult.xml"
If ($LASTEXITCODE -ne 0) {
$TestsFailed = $TRUE
}
}
}
$wc = New-Object 'System.Net.WebClient'
#core tests (others are real-time reported)
Get-Item '*-CoreTestResult.xml' | ForEach-Object {
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", $_)
}
If ($TestsFailed) {
Write-Host 'Tests have failed' -foregroundcolor 'white' -backgroundcolor 'red'
exit 1
}
}
artifacts:
- path: 'nuget_gallery\*.nupkg'
- path: 'nuget_gallery\*.snupkg'
- path: 'nuget_gallery.zip'
name: NuGet packages
- path: 'NHCH-*-bin.zip'
name: Binaries
on_finish:
- ps: Stop-Process -Id $MemCached.Id
- ps: Stop-Process -Id $Redis.Id