forked from gitextensions/gitextensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.experimental.yml
161 lines (133 loc) · 6.54 KB
/
appveyor.experimental.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
151
152
153
154
155
156
157
158
159
160
161
version: 66.66.66.{build}
# Do not build on tags (GitHub, Bitbucket, GitLab, Gitea)
skip_tags: true
# set clone depth
clone_depth: 1 # clone entire repository history if not defined
branches:
only:
- /experimental\/*/
matrix:
fast_finish: false
# https://www.appveyor.com/docs/build-environment/#build-worker-images
image: Visual Studio 2019
environment:
# The following entries define the default values of the environment variables.
# They can be overridden in AppVeyor | Settings | Environment.
GE_TEST_SLEEP_SECONDS_ON_HANG: 0
GE_TEST_LAUNCH_DEBUGGER_ON_HANG: 0
# How many times to execute tests
TEST_RUN_COUNT: 1
# Execute unit tests
RUN_UNIT_TESTS: 1
# Execute integration tests
RUN_INTEGRATION_TESTS: 1
# Fail the build if any of the tests fail
FAIL_BUILD_IF_TESTS_FAIL: 1
init:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# 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:
- cmd: echo %APPVEYOR_REPO_COMMIT%
- cmd: echo %APPVEYOR_PULL_REQUEST_HEAD_COMMIT%
- cmd: git submodule update --init --recursive
- cmd: echo /logger:"%ProgramFiles%\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll">> Directory.Build.rsp
- cmd: |-
cd eng
C:\\Python35\\python set_version_to.py -v %APPVEYOR_BUILD_VERSION% -t %APPVEYOR_BUILD_VERSION%
cd ..
# to run your custom scripts instead of automatic MSBuild
build_script:
- ps: |
# for release branches mark the repo as clean
if (!$env:APPVEYOR_PULL_REQUEST_TITLE -and $env:APPVEYOR_REPO_BRANCH.StartsWith("release/")) {
& .\eng\Mark-RepoClean.ps1
}
# if building a temporary merge with master, soft reset to the PR commit 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))
{
git reset --soft "$env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT" --
}
# build
& .\cibuild.cmd -restore -build -buildNative -logFileName build.binlog
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# if we have reset above we need to reset English xlfs, otherwise the loc verification step will fail
# refer to https://github.com/gitextensions/gitextensions/issues/7979
if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) {
git reset $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT --quiet -- "GitUI/Translation/English.xlf" "GitUI/Translation/English.Plugins.xlf"
git checkout --force -- "GitUI/Translation/English.xlf" "GitUI/Translation/English.Plugins.xlf"
}
# it would be nice to run '.\cibuild.cmd -loc -logFileName localise.binlog /p:NoBuild=true' but it doesn't work without `-build` switch :\
Push-Location .\src\app\GitExtensions
msbuild /p:Configuration=Release /t:_UpdateEnglishTranslations /p:RunTranslationApp=true /p:ContinuousIntegrationBuild=true /v:m /bl:..\artifacts\log\localise.binlog
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
Pop-Location
# to run your custom scripts instead of automatic tests
test_script:
- ps: |
$failBuildIfTestsFail = $env:FAIL_BUILD_IF_TESTS_FAIL
$runUnitTests = $env:RUN_UNIT_TESTS
$runIntegrationTests = $env:RUN_INTEGRATION_TESTS
$testRunCount = $env:TEST_RUN_COUNT
Write-Host "FAIL_BUILD_IF_TESTS_FAIL: ${failBuildIfTestsFail}"
Write-Host "RUN_UNIT_TESTS: ${runUnitTests}"
Write-Host "RUN_INTEGRATION_TESTS: ${runIntegrationTests}"
Write-Host "TEST_RUN_COUNT: ${testRunCount}"
Write-Host "GE_TEST_SLEEP_SECONDS_ON_HANG: ${env:GE_TEST_SLEEP_SECONDS_ON_HANG}"
Write-Host "GE_TEST_LAUNCH_DEBUGGER_ON_HANG: ${env:GE_TEST_LAUNCH_DEBUGGER_ON_HANG}"
$testErrorsTotal = 0
for ($testRun = 1; $testRun -le $testRunCount; $testRun++)
{
$failedBefore = if ($testRun -ne 1) { ", ${testErrorsTotal} test(s) failed before" }
Write-Host ""
Write-Host "[INFO]: Test Run ${testRun}/${testRunCount}${failedBefore}"
if ($runUnitTests -ne 0) { & .\cibuild.cmd /p:NoBuild=true -test -logFileName UnitTest.binlog }
if ($runIntegrationTests -ne 0) { & .\cibuild.cmd /p:NoBuild=true -integrationTest -logFileName IntegrationTest.binlog }
Get-ChildItem -recurse artifacts\tests\TestResult.xml -ErrorAction SilentlyContinue `
| ForEach-Object {
$resultFilePath = "$_"
Get-Content $resultFilePath `
| Select-String -Pattern '<test-run id="[^"]*"\s+testcasecount="(\d+)"\s+result="([^"]*)"\s+total="(\d+)"\s+passed="(\d+)"\s+failed="(\d+)".*' `
| foreach {
$result = $_.Matches.Groups
#$result[0].Value
$total = $result[1].Value
$passed = $result[4].Value
$failed = $result[5].Value
$notPassed = $total - $passed
$testErrors = $failed
$testProjectName = $resultFilePath.Split('\\')[-3]
$artifactName = "TestResult#${testRun}.${testErrors}err.${testProjectName}"
Push-AppveyorArtifact $resultFilePath -FileName "${artifactName}.xml"
if ($notPassed -ne 0) {
$logFile = Get-ChildItem -recurse artifacts\$testProjectName*.log
if ($testErrors -ne 0) { Push-AppveyorArtifact $logFile -FileName "${artifactName}.log" }
}
$testErrorsTotal += $testErrors
}
}
}
if ($testErrorsTotal -ne 0 -and $failBuildIfTestsFail -ne 0) { $host.SetShouldExit($testErrorsTotal) }
# scripts to run after tests
after_test:
- ps: |
Write-Host "Preparing build artifacts..."
& .\cibuild.cmd -publish -logFileName publish.binlog
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
artifacts:
- path: artifacts\log\**\*.binlog
- path: artifacts\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 "$_"
}