forked from CodeCavePro/revitless-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
150 lines (129 loc) · 5.68 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Operating system (build VM template)
os: Windows Server 2019
# If the build configuration does not specify build worker image
# then Visual Studio 2015 image is used.
image: Visual Studio 2019
# Restrict to Git branches below
branches:
only:
- master
# Scripts that run after cloning repository
install:
- nuget restore
# Cache files until appveyor.yml is modified.
cache:
- packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
- '%LocalAppData%\NuGet\Cache' # NuGet < v3
- '%LocalAppData%\NuGet\v3-cache' # NuGet v3
environment:
VERSION_SIMPLE: '{version}'
VERSION_INFORMATIONAL: '{version}'
VERSION_UNSTABLE_SUFFIX: '-preview-$(APPVEYOR_BUILD_NUMBER)'
COVERALLS_REPO_TOKEN:
secure: rI17LigDiGiYdTsDrZVCfQkdldPrlgJ8lGXfdcOSldQQu1iDiTMIYEAA7ZkBq4st
init:
- ps: |
$env:VERSION_INFORMATIONAL = $env:APPVEYOR_BUILD_VERSION
$env:VERSION_SIMPLE = "$env:APPVEYOR_BUILD_VERSION.$env:APPVEYOR_BUILD_NUMBER"
$env:GITHUB_REPO_API = "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/releases/latest"
if ($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_REPO_TAG_NAME) {
### CHECK IF A IT'S A TAGGED BUILD
$git_current_tag = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v")
Write-Host "Building a tagged Git commit: $git_current_tag";
if ($git_current_tag -match '^([0-9]+\.[0-9]+\.[0-9]+)$' -Or $git_current_tag -match '([0-9]+[\.-][0-9]+[\.-][0-9]+-[-A-Za-z0-9]+)') {
$env:VERSION_INFORMATIONAL = "$git_current_tag"
}
} else {
### OTHERWISE IT'S A REGULAR BUILD
try {
### TRY TO GET VERSION FROM THE LATEST GITHUB TAG/REALEASE
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$github_last_release=(Invoke-WebRequest -Uri $env:GITHUB_REPO_API) -join '`n' | ConvertFrom-Json
$github_last_tag=$github_last_release.tag_name.TrimStart("v")
if ($github_last_tag -match '^([0-9]+\.[0-9]+\.[0-9]+)$') {
$github_tag_ver = [version]$github_last_tag
$github_last_tag = "{0}.{1}.{2}" -f $github_tag_ver.Major, $github_tag_ver.Minor, ($github_tag_ver.Build + 1)
}
$env:VERSION_INFORMATIONAL = $github_last_tag
} catch {
$env:VERSION_INFORMATIONAL = "1.0.0"
Write-Host "Failed to get version from the last GitHub release falling back on '$env:VERSION_INFORMATIONAL' base version";
}
$env:VERSION_INFORMATIONAL = "$env:VERSION_INFORMATIONAL$env:VERSION_UNSTABLE_SUFFIX"
}
### MAKE CALCULATED INFORMATIONAL VERSION THE ACTUAL BUILD VERSION
Update-AppveyorBuild -Version $env:VERSION_INFORMATIONAL
Write-Host "Using build version: $env:APPVEYOR_BUILD_VERSION";
dotnet_csproj:
patch: true
file: '**\*.csproj'
assembly_version: $(VERSION_SIMPLE)
file_version: $(VERSION_SIMPLE)
version: $(VERSION_INFORMATIONAL)
package_version: $(VERSION_INFORMATIONAL)
informational_version: $(VERSION_INFORMATIONAL)
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
assembly_version: $(VERSION_SIMPLE)
assembly_file_version: $(VERSION_SIMPLE)
assembly_informational_version: $(VERSION_INFORMATIONAL)
# Run scripts below before
before_build:
- where dotnet
- cmd: dotnet clean
# To run your custom scripts instead of automatic MSBuild
build_script:
- cmd: dotnet build --configuration Debug
# NuGet files qualified as artifacts
artifacts:
- path: 'bin\**\*.nupkg' # find the NuGet files
name: Revit_Toolkit
# Deploy to GitHub releases
deploy:
-
provider: GitHub
auth_token:
secure: 2+d0KgCbWQpUR8TZfzvUEzbi4NQP6F/Tt0PUwLn6jXZCyO8FnrFVFJPsFa0QBQFl
artifact: Revit_Toolkit
description: |-
* for .NET Standard 2.0 (.NET Core 2.0, .NET Framework >= 4.6.1 etc) use CodeCave.Revit.Toolkit.$(APPVEYOR_BUILD_VERSION).nupkg file
* for .NET Framework 4.5.x use CodeCave.Revit.Toolkit.NetFramework.$(APPVEYOR_BUILD_VERSION).nupkg file
draft: false
force_update: true
prerelease: false
release: "Revit Toolkit v$(APPVEYOR_REPO_TAG_NAME)"
tag: $(APPVEYOR_REPO_TAG_NAME)
on:
appveyor_repo_tag: true
-
provider: NuGet
api_key:
secure: i6oWn60J7ZOM4UuYcvxbuk9OAEp6or+Wq7izyJDPNlcLIhG2UKsxz7G/8erhdY3M
artifact: Revit_Toolkit
server: # remove to push to NuGet.org
skip_symbols: false
symbol_server: # remove to push symbols to SymbolSource.org
on:
appveyor_repo_tag: true
-
provider: NuGet
server: https://ci.appveyor.com/nuget/salaros/api/v2/package
symbol_server: https://ci.appveyor.com/nuget/salaros/api/v2/package
api_key:
secure: 3zmnmVBweTgdk4SBM/rWHdC9JOM9s0pxm1bw1d+WHDo=
artifact: Revit_Toolkit
# Start builds on tags only (GitHub and BitBucket)
skip_non_tags: false
# Tests
test_script:
- ps: dotnet test tests
# CCoverage: OpenCover + Coveralls
after_test:
- ps: |
# Install NuGet pacakges and tools
nuget install OpenCover -Version 4.6.519 -OutputDirectory packages
dotnet tool install coveralls.net --tool-path tools
# Set variables
.\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:dotnet.exe -targetargs:"test tests" -register:user -filter:"+[*]* -[xunit*]*" -output:"tests\coverage.xml" -oldStyle
.\tools\csmacnz.Coveralls.exe --opencover --input .\tests\coverage.xml --repoToken $env:COVERALLS_REPO_TOKEN --commitId $env:APPVEYOR_REPO_COMMIT --commitBranch $env:APPVEYOR_REPO_BRANCH --commitAuthor $env:APPVEYOR_REPO_COMMIT_AUTHOR --commitEmail $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL --commitMessage $env:APPVEYOR_REPO_COMMIT_MESSAGE --jobId $env:APPVEYOR_JOB_ID