forked from gitextensions/gitextensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
139 lines (120 loc) · 5.27 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
version: 4.1.0.{build}
branches:
except:
- configdata
- gh-pages
- /experimental\/*/
- /translations_*/
matrix:
fast_finish: true
# https://www.appveyor.com/docs/build-environment/#build-worker-images
image: Visual Studio 2022
environment:
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Use latest version of current used .NET version. 6.0 could use the latest of 6.0. See .\Scripts\Update-DotnetVersion.ps1
GE_USE_LATEST_DOTNET: true
init:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
cache:
# preserve "GitExtensions.PluginManager" directory, will be reset if appveyor.yml is modified
- .\artifacts\publish\GitExtensions.PluginManager -> appveyor.yml
# Build settings, not to be confused with "before_build" and "after_build".
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
build:
# enable MSBuild parallel builds
parallel: true
# MSBuild verbosity level
verbosity: minimal
install:
- ps: |
if($env:GE_USE_LATEST_DOTNET -eq $true)
{
.\scripts\Update-DotnetVersion.ps1
}
- ps: |
# Install the required .NET SDK
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1"
./dotnet-install.ps1 -JsonFile global.json -InstallDir 'C:\Program Files\dotnet'
# Remove the script so it doesn't "pollute" the build
Remove-Item -Path .\dotnet-install.ps1
- cmd: git submodule update --init --recursive
- cmd: |-
cd scripts
C:\\Python311\\python set_version_to.py -v %APPVEYOR_BUILD_VERSION% -t %APPVEYOR_BUILD_VERSION%
cd ..
git --version
# to run your custom scripts instead of automatic MSBuild
build_script:
- ps: |
$buildArgs = '/p:ContinuousIntegrationBuild=true'
# if building a PR override the hash with the PR commit's so the build contains the PR's hash instead of the merge-commit's hash
if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -and ($env:APPVEYOR_REPO_COMMIT -ne $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT))
{
$gitCommit = $(git rev-parse --short $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT)
$buildArgs += " /p:GitCommit=$gitCommit /p:GitSha=$($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT)"
}
- ps: |
# build VC++
dotnet build .\scripts\native.proj -c Release --verbosity q --nologo /bl:.\artifacts\log\native.binlog
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
- ps: |
# build .NET
$cmd = "dotnet build -c Release --verbosity q --nologo /bl:.\artifacts\log\build.binlog $buildArgs"
Invoke-Expression $cmd
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
- ps: |
# We are done with the build, reset all pending changes
git reset --hard HEAD
- ps: |
# Verify that new strings (if any) have been processed and ready for localisation
Push-Location .\GitExtensions
dotnet msbuild /p:Configuration=Release /t:_UpdateEnglishTranslations /p:RunTranslationApp=true /p:ContinuousIntegrationBuild=true /v:m /bl:..\artifacts\log\localise.binlog
Pop-Location
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# to run your custom scripts instead of automatic tests
test_script:
- ps: |
dotnet test -c Release --no-restore --no-build --nologo --verbosity q --test-adapter-path:. --logger:Appveyor --logger:trx /bl:.\artifacts\log\tests.binlog
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# scripts to run after tests
after_test:
- ps: |
Write-Host "Preparing build artifacts..."
$cmd = "dotnet publish -c Release --no-build /bl:.\artifacts\log\publish.binlog $buildArgs"
Invoke-Expression $cmd
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
- ps: |
if ([bool]$env:APPVEYOR_PULL_REQUEST_TITLE -and [bool]$env:ARTIFACT_PUBLISH_PULL_REQUEST_MSI) {
$msi = (Resolve-Path .\artifacts\Release\publish\GitExtensions-*.msi)[0].Path;
Get-ChildItem $msi | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
}
artifacts:
- path: artifacts\Release\publish\*.zip
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# on build failure
on_failure:
- ps: |
Get-ChildItem -recurse artifacts\log\*.binlog -ErrorAction SilentlyContinue `
| ForEach-Object {
Push-AppveyorArtifact "$_"
}
- ps: |
Get-ChildItem -recurse English*.xlf -ErrorAction SilentlyContinue `
| ForEach-Object {
Push-AppveyorArtifact "$_"
}
- ps: |
Get-ChildItem -recurse artifacts\Release\TestsResults\*.trx | `
ForEach-Object {
$file = $_.FullName.Replace('[', '``[').Replace(']', '``]')
#Write-Output "Processing $file"
[xml]$xml = Get-Content -Path $file
$xml.TestRun.Results.UnitTestResult | Where-Object outcome -eq 'Failed' | ForEach-Object {
$errorMessage = "$($_.Output.ErrorInfo.Message)`r`n$($_.Output.ErrorInfo.StackTrace)`r`n"
Write-Host $errorMessage -ForegroundColor Red
}
}