This repository has been archived by the owner on Jul 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
appveyor.yml
56 lines (47 loc) · 2.41 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
build: false
configuration:
- Release
environment:
PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.8"
PYTHON_ARCH: "32"
NUGET_API_KEY:
secure: QXiv4MV3IX8V/7hl+CGMAH9vcLaUJ12ZEk2ohcKiumfT0jS3AzfkJ13qES92E5Pt
VS150COMNTOOLS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\"
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PUBLISH_TO_NUGET: "false"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PUBLISH_TO_NUGET: "true"
before_build:
- nuget restore
build_script:
- SET PATH=%PATH%;%PYTHON%/Scripts/
- dotnet build bitprim.sln /property:Platform=x64
install:
- "%PYTHON%/Scripts/pip.exe install conan --upgrade"
- icacls "%APPVEYOR_BUILD_FOLDER%"\bitprim.tests /grant Everyone:F
- icacls "%APPVEYOR_BUILD_FOLDER%"\bitprim.tests\* /grant Everyone:F
test_script:
- cd bitprim.tests
- dotnet test /property:Platform=x64 -f netcoreapp2.0
after_test:
- ps: >-
if($env:PUBLISH_TO_NUGET -eq "true"){
Write-Host "Publishing to NuGet..."
cmd.exe /c "del $env:APPVEYOR_BUILD_FOLDER\bitprim\bin\x64\Release\*.nupkg"
Write-Host "Incrementing version..."
# Get the current patch version
$response = Invoke-RestMethod -method get -uri https://api.nuget.org/v3-flatcontainer/bitprim/index.json
$last_version = $response.versions[-1]
$patch = $last_version.Split(".")[-1]
# Add 1 to it
$nextVersion = [int]$patch + 1;
# Replace the new value in the project metadata
(Get-Content -path "$env:APPVEYOR_BUILD_FOLDER\bitprim\bitprim.csproj") -replace '<Version>([0-9]+)\.([0-9]+)\.([0-9]+)</Version>', '<Version>$1.$2.%%PATCH_PLACEHOLDER%%</Version>' | Set-Content "$env:APPVEYOR_BUILD_FOLDER\bitprim\bitprim.csproj"
(Get-Content -path "$env:APPVEYOR_BUILD_FOLDER\bitprim\bitprim.csproj") -replace '%%PATCH_PLACEHOLDER%%', "$nextVersion" | Set-Content "$env:APPVEYOR_BUILD_FOLDER\bitprim\bitprim.csproj"
Write-Host "Patch version updated to $nextVersion"
cmd.exe /c "dotnet build $env:APPVEYOR_BUILD_FOLDER\bitprim\bitprim.csproj /property:Platform=x64"
cmd.exe /c "dotnet nuget push $env:APPVEYOR_BUILD_FOLDER\bitprim\bin\x64\Release\*.nupkg -s https://api.nuget.org/v3/index.json -k $env:NUGET_API_KEY"
}
Get-Content $env:APPVEYOR_BUILD_FOLDER\bitprim.tests\bin\x64\Release\netcoreapp2.0\bitprim-cs-log.txt