forked from PlayFab/consuldotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
89 lines (86 loc) · 3.78 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
version: 0.7.2.{build}-{branch}
pull_requests:
do_not_increment_build_number: true
nuget:
disable_publish_on_pr: true
configuration: Release
platform: Any CPU
clone_depth: 1
clone_folder: C:\consul
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
assembly_version: $(APPVEYOR_BUILD_VERSION)
assembly_file_version: $(APPVEYOR_BUILD_VERSION)
assembly_informational_version: $(APPVEYOR_BUILD_VERSION)
environment:
CONSUL_BIN: c:\consul\consul.test\consul.exe
CONSUL_VERSION: 0.7.2
CLI_VERSION: Latest
install:
- cinst: 7zip.commandline
- ps: mkdir -Force c:\consul_install | Out-Null
- ps: |-
$consul_zip = "consul_$($env:CONSUL_VERSION)_windows_386.zip"
$consul_url = "https://releases.hashicorp.com/consul/$($env:CONSUL_VERSION)/$consul_zip"
if (!(test-path "c:\consul_install\$consul_zip")) {
write-output "Downloading $consul_url"
[Net.ServicePointManager]::SecurityProtocol = 'Tls12'
Invoke-WebRequest $consul_url -OutFile "c:\consul_install\$consul_zip"
} else {write-output "Using cached $consul_zip"}
7z x -y c:\consul_install\$consul_zip -oc:\consul\consul.test
cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
- C:\consul_install -> appveyor.yml
- '%USERPROFILE%\.nuget\packages -> **\project.json'
init:
- ps: if ($Env:APPVEYOR_REPO_TAG -eq $true) {$Env:APPVEYOR_BUILD_VERSION = $Env:APPVEYOR_REPO_TAG_NAME} else {$Env:LABEL = "CI" + $Env:APPVEYOR_BUILD_NUMBER.PadLeft(4, "0")}
before_build:
- dotnet --info
- appveyor-retry dotnet restore Consul
- appveyor-retry dotnet restore Consul.Test
build_script:
- dotnet build Consul --configuration %CONFIGURATION% --no-dependencies
- cmd: |-
move "%APPVEYOR_BUILD_FOLDER%\Consul\bin\Any CPU\release\net45" "%APPVEYOR_BUILD_FOLDER%\Consul\bin\Any CPU\release\net45unmerged"
cd "%APPVEYOR_BUILD_FOLDER%\Consul\bin\Any CPU\release\net45unmerged"
%USERPROFILE%\.nuget\packages\ILRepack\2.0.10\tools\ILRepack.exe /keyfile:%APPVEYOR_BUILD_FOLDER%\assets\consuldotnet.snk /parallel /internalize /out:"%APPVEYOR_BUILD_FOLDER%\Consul\bin\Any CPU\release\net45\Consul.dll" Consul.dll Newtonsoft.Json.dll
cd %APPVEYOR_BUILD_FOLDER%
copy "%APPVEYOR_BUILD_FOLDER%\Consul\bin\Any CPU\release\net45unmerged\Consul.pdb" "%APPVEYOR_BUILD_FOLDER%\Consul\bin\Any CPU\release\net45\"
del /s /q "%APPVEYOR_BUILD_FOLDER%\Consul\bin\Any CPU\release\net45unmerged"
after_build:
- ps: >-
if ($Env:APPVEYOR_REPO_TAG -eq $true) {
dotnet pack Consul --configuration $Env:CONFIGURATION --no-build -o $([System.IO.Path]::Combine($Env:APPVEYOR_BUILD_FOLDER, "artifacts"))
} else {
dotnet pack Consul --configuration $Env:CONFIGURATION --no-build --version-suffix $Env:LABEL -o $([System.IO.Path]::Combine($Env:APPVEYOR_BUILD_FOLDER, "artifacts"))
}
before_test:
- ps: >-
$consulJob = Start-Job {C:\consul\Consul.Test\consul.exe agent -dev -config-file C:\consul\Consul.Test\test_config.json}
$running = $false
do {
Receive-Job -Job $consulJob
if ($running -and $consulJob.State -ne "Running") {break}
if ($consulJob.State -eq "Running") {
$running = $true
try {$result = convertfrom-json (invoke-webrequest -UseBasicParsing -TimeoutSec 1 -Uri http://localhost:8500/v1/status/leader).Content; sleep 1} catch {write-output "Waiting for Consul to come up..."}
}
} until (![string]::IsNullOrEmpty($result))
Receive-Job $consulJob
test_script:
- dotnet build Consul.Test --configuration Release
- dotnet test Consul.Test/Consul.Test.csproj --configuration Release
after_test:
- ps: Get-Job | Stop-Job
- ps: Get-Job | Receive-Job
artifacts:
- path: artifacts\*.nupkg
name: NuGet
deploy:
- provider: NuGet
api_key:
secure: dv44i0f5BvM3LZRUU/B0emsLEIbO9geASxNnMd074SXPligvsk81P8nzY/3m2z/z
on:
APPVEYOR_REPO_TAG: true