forked from icnocop/cuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
508 lines (438 loc) · 22.5 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
version: 2.0.{build}
branches:
only:
- master
image: Visual Studio 2015
init:
- ps: |
Function Get-IniContent {
<#
.Synopsis
Gets the content of an INI file
.Description
Gets the content of an INI file and returns it as a hashtable
.Notes
Author : Oliver Lipkau <[email protected]>
Blog : http://oliver.lipkau.net/blog/
Source : https://github.com/lipkau/PsIni
http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91
Version : 1.0 - 2010/03/12 - Initial release
1.1 - 2014/12/11 - Typo (Thx SLDR)
Typo (Thx Dave Stiff)
#Requires -Version 2.0
.Inputs
System.String
.Outputs
System.Collections.Hashtable
.Parameter FilePath
Specifies the path to the input file.
.Example
$FileContent = Get-IniContent "C:\myinifile.ini"
-----------
Description
Saves the content of the c:\myinifile.ini in a hashtable called $FileContent
.Example
$inifilepath | $FileContent = Get-IniContent
-----------
Description
Gets the content of the ini file passed through the pipe into a hashtable called $FileContent
.Example
C:\PS>$FileContent = Get-IniContent "c:\settings.ini"
C:\PS>$FileContent["Section"]["Key"]
-----------
Description
Returns the key "Key" of the section "Section" from the C:\settings.ini file
.Link
Out-IniFile
#>
[CmdletBinding()]
Param(
[ValidateNotNullOrEmpty()]
[ValidateScript({(Test-Path $_) -and ((Get-Item $_).Extension -eq ".ini")})]
[Parameter(ValueFromPipeline=$True,Mandatory=$True)]
[string]$FilePath
)
Begin
{Write-Verbose "$($MyInvocation.MyCommand.Name):: Function started"}
Process
{
Write-Verbose "$($MyInvocation.MyCommand.Name):: Processing file: $Filepath"
$ini = @{}
switch -regex -file $FilePath
{
"^\[(.+)\]$" # Section
{
$section = $matches[1]
$ini[$section] = @{}
$CommentCount = 0
}
"^(;.*)$" # Comment
{
if (!($section))
{
$section = "No-Section"
$ini[$section] = @{}
}
$value = $matches[1]
$CommentCount = $CommentCount + 1
$name = "Comment" + $CommentCount
$ini[$section][$name] = $value
}
"(.+?)\s*=\s*(.*)" # Key
{
if (!($section))
{
$section = "No-Section"
$ini[$section] = @{}
}
$name,$value = $matches[1..2]
$ini[$section][$name] = $value
}
}
Write-Verbose "$($MyInvocation.MyCommand.Name):: Finished Processing file: $FilePath"
Return $ini
}
End
{Write-Verbose "$($MyInvocation.MyCommand.Name):: Function ended"}
}
Function Out-IniFile {
<#
.Synopsis
Write hash content to INI file
.Description
Write hash content to INI file
.Notes
Author : Oliver Lipkau <[email protected]>
Blog : http://oliver.lipkau.net/blog/
Source : https://github.com/lipkau/PsIni
http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91
Version : 1.0 - 2010/03/12 - Initial release
1.1 - 2012/04/19 - Bugfix/Added example to help (Thx Ingmar Verheij)
1.2 - 2014/12/11 - Improved handling for missing output file (Thx SLDR)
#Requires -Version 2.0
.Inputs
System.String
System.Collections.Hashtable
.Outputs
System.IO.FileSystemInfo
.Parameter Append
Adds the output to the end of an existing file, instead of replacing the file contents.
.Parameter InputObject
Specifies the Hashtable to be written to the file. Enter a variable that contains the objects or type a command or expression that gets the objects.
.Parameter FilePath
Specifies the path to the output file.
.Parameter Encoding
Specifies the type of character encoding used in the file. Valid values are "Unicode", "UTF7",
"UTF8", "UTF32", "ASCII", "BigEndianUnicode", "Default", and "OEM". "Unicode" is the default.
"Default" uses the encoding of the system's current ANSI code page.
"OEM" uses the current original equipment manufacturer code page identifier for the operating
system.
.Parameter Force
Allows the cmdlet to overwrite an existing read-only file. Even using the Force parameter, the cmdlet cannot override security restrictions.
.Parameter PassThru
Passes an object representing the location to the pipeline. By default, this cmdlet does not generate any output.
.Example
Out-IniFile $IniVar "C:\myinifile.ini"
-----------
Description
Saves the content of the $IniVar Hashtable to the INI File c:\myinifile.ini
.Example
$IniVar | Out-IniFile "C:\myinifile.ini" -Force
-----------
Description
Saves the content of the $IniVar Hashtable to the INI File c:\myinifile.ini and overwrites the file if it is already present
.Example
$file = Out-IniFile $IniVar "C:\myinifile.ini" -PassThru
-----------
Description
Saves the content of the $IniVar Hashtable to the INI File c:\myinifile.ini and saves the file into $file
.Example
$Category1 = @{“Key1”=”Value1”;”Key2”=”Value2”}
$Category2 = @{“Key1”=”Value1”;”Key2”=”Value2”}
$NewINIContent = @{“Category1”=$Category1;”Category2”=$Category2}
Out-IniFile -InputObject $NewINIContent -FilePath "C:\MyNewFile.INI"
-----------
Description
Creating a custom Hashtable and saving it to C:\MyNewFile.INI
.Link
Get-IniContent
#>
[CmdletBinding()]
Param(
[switch]$Append,
[ValidateSet("Unicode","UTF7","UTF8","UTF32","ASCII","BigEndianUnicode","Default","OEM")]
[Parameter()]
[string]$Encoding = "Unicode",
[ValidateNotNullOrEmpty()]
[ValidatePattern('^([a-zA-Z]\:)?.+\.ini$')]
[Parameter(Mandatory=$True)]
[string]$FilePath,
[switch]$Force,
[ValidateNotNullOrEmpty()]
[Parameter(ValueFromPipeline=$True,Mandatory=$True)]
[Hashtable]$InputObject,
[switch]$Passthru
)
Begin
{Write-Verbose "$($MyInvocation.MyCommand.Name):: Function started"}
Process
{
Write-Verbose "$($MyInvocation.MyCommand.Name):: Writing to file: $Filepath"
if ($append) {$outfile = Get-Item $FilePath}
else {$outFile = New-Item -ItemType file -Path $Filepath -Force:$Force}
if (!($outFile)) {Throw "Could not create File"}
foreach ($i in $InputObject.keys)
{
if (!($($InputObject[$i].GetType().Name) -eq "Hashtable"))
{
#No Sections
Write-Verbose "$($MyInvocation.MyCommand.Name):: Writing key: $i"
Add-Content -Path $outFile -Value "$i=$($InputObject[$i])" -Encoding $Encoding
} else {
#Sections
Write-Verbose "$($MyInvocation.MyCommand.Name):: Writing Section: [$i]"
Add-Content -Path $outFile -Value "[$i]" -Encoding $Encoding
Foreach ($j in $($InputObject[$i].keys | Sort-Object))
{
if ($j -match "^Comment[\d]+") {
Write-Verbose "$($MyInvocation.MyCommand.Name):: Writing comment: $j"
Add-Content -Path $outFile -Value "$($InputObject[$i][$j])" -Encoding $Encoding
} else {
Write-Verbose "$($MyInvocation.MyCommand.Name):: Writing key: $j"
Add-Content -Path $outFile -Value "$j=$($InputObject[$i][$j])" -Encoding $Encoding
}
}
Add-Content -Path $outFile -Value "" -Encoding $Encoding
}
}
Write-Verbose "$($MyInvocation.MyCommand.Name):: Finished Writing to file: $path"
if ($PassThru) {Return $outFile}
}
End
{Write-Verbose "$($MyInvocation.MyCommand.Name):: Function ended"}
}
$webclient = New-Object System.Net.WebClient
# Allow Remote Desktop
Write-Host "Builds require a Remote Desktop Connection (RDP) to continue..."
$blockRdp = $true; iex ($webclient.DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# Microsoft Visual Studio 2013 Coded UI Test Plugin for Silverlight
Write-Host "Downloading Microsoft Visual Studio 2013 Coded UI Test Plugin for Silverlight..."
$msiFilePath = "$($env:USERPROFILE)\UITestPluginForSilverlightVS2013.msi"
$logFilePath = "$($env:TEMP)\UITestPluginForSilverlightVS2013.txt"
$webclient.DownloadFile('https://visualstudiogallery.msdn.microsoft.com/51b4a94a-1878-4dcc-81e0-7dc92131d2da/file/133666/1/UITestPluginForSilverlightVS2013.msi', $msiFilePath)
Write-Host "Installing Microsoft Visual Studio 2013 Coded UI Test Plugin for Silverlight..."
$process = (Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $msiFilePath /quiet /l*v $logFilePath" -Wait -Passthru)
$exitCode = $process.ExitCode
if ($exitCode -ne 0)
{
Get-Content $logFilePath
throw "Command failed with exit code $exitCode."
}
del $msiFilePath
del $logFilePath
Write-Host "Visual Studio 2013 Coded UI Test Plugin for Silverlight successfully installed" -ForegroundColor Green
# Microsoft Visual Studio 2015 Coded UI Test Plugin for Silverlight
Write-Host "Downloading Microsoft Visual Studio 2015 Coded UI Test Plugin for Silverlight..."
$msiFilePath = "$($env:USERPROFILE)\UITestPluginForSilverlightVS2015.msi"
$logFilePath = "$($env:TEMP)\UITestPluginForSilverlightVS2015.txt"
$webclient.DownloadFile('https://visualstudiogallery.msdn.microsoft.com/bf0caedc-90eb-46af-9c1a-8e68d013bb99/file/189320/1/UITestPluginForSilverlightVS2015.msi', $msiFilePath)
Write-Host "Installing Microsoft Visual Studio 2015 Coded UI Test Plugin for Silverlight..."
$process = (Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $msiFilePath /quiet /l*v $logFilePath" -Wait -Passthru)
$exitCode = $process.ExitCode
if ($exitCode -ne 0)
{
Get-Content $logFilePath
throw "Command failed with exit code $exitCode."
}
del $msiFilePath
del $logFilePath
Write-Host "Visual Studio 2015 Coded UI Test Plugin for Silverlight successfully installed" -ForegroundColor Green
# Microsoft Silverlight 5 Toolkit - December 2011
Write-Host "Downloading Microsoft Silverlight 5 Toolkit - December 2011..."
$msiFilePath = "$($env:USERPROFILE)\Silverlight_5_Toolkit_December_2011.msi"
$logFilePath = "$($env:TEMP)\Silverlight_5_Toolkit_December_2011.txt"
$webclient.DownloadFile('http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=silverlight&DownloadId=311823&FileTime=129679336571930000&Build=21050', $msiFilePath)
Write-Host "Installing Microsoft Silverlight 5 Toolkit - December 2011..."
$process = (Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $msiFilePath /quiet /l*v $logFilePath" -Wait -Passthru)
$exitCode = $process.ExitCode
if ($exitCode -ne 0)
{
Get-Content $logFilePath
throw "Command failed with exit code $exitCode."
}
del $msiFilePath
del $logFilePath
Write-Host "Microsoft Silverlight 5 Toolkit - December 2011 successfully installed" -ForegroundColor Green
# Microsoft Silverlight 5 Developer Runtime for Windows (64 bit)
Write-Host "Downloading Microsoft Silverlight 5 Developer Runtime for Windows (64 bit)..."
$exeFilePath = "$($env:USERPROFILE)\Silverlight_Developer_x64.exe"
$retry_attempts = 3
for($i=0; $i -lt $retry_attempts; $i++){
try {
$webclient.DownloadFile('http://download.microsoft.com/download/1/F/6/1F637DB3-8EF9-4D96-A8F1-909DFD7C5E69/50428.00/Silverlight_Developer_x64.exe', $exeFilePath)
break
}
Catch [Exception]{
Start-Sleep 1
}
}
Write-Host "Installing Microsoft Silverlight 5 Developer Runtime for Windows (64 bit)..."
$process = (Start-Process -FilePath $exeFilePath -ArgumentList "/q" -Wait -Passthru)
$exitCode = $process.ExitCode
if ($exitCode -ne 0)
{
throw "Command failed with exit code $exitCode."
}
del $exeFilePath
Write-Host "Microsoft Silverlight 5 Developer Runtime for Windows (64 bit) successfully installed" -ForegroundColor Green
# Google Chrome
Write-Host "Downloading Google Chrome..."
$msiFilePath = "$($env:USERPROFILE)\GoogleChromeStandaloneEnterprise.msi"
$logFilePath = "$($env:TEMP)\GoogleChromeStandaloneEnterprise.txt"
$webclient.DownloadFile('https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B7ACD904C-E309-ADA4-8671-783B10D723FD%7D%26lang%3Den%26browser%3D4%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers/edgedl/chrome/install/GoogleChromeStandaloneEnterprise.msi', $msiFilePath)
Write-Host "Installing Google Chrome..."
$process = (Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $msiFilePath /quiet /l*v $logFilePath" -Wait -Passthru)
$exitCode = $process.ExitCode
if ($exitCode -ne 0)
{
Get-Content $logFilePath
throw "Command failed with exit code $exitCode."
}
del $msiFilePath
del $logFilePath
Write-Host "Google Chrome successfully installed" -ForegroundColor Green
# Mozilla Firefox 47.0.1
Write-Host "Downloading Mozilla Firefox 47.0.1..."
$exeFilePath = "$($env:USERPROFILE)\Firefox Setup 47.0.1.exe"
$retry_attempts = 3
for($i=0; $i -lt $retry_attempts; $i++){
try {
$webclient.DownloadFile('http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/47.0.1/win32/es-ES/Firefox%20Setup%2047.0.1.exe', $exeFilePath)
break
}
Catch [Exception]{
Start-Sleep 1
}
}
Write-Host "Installing Mozilla Firefox 47.0.1..."
$process = (Start-Process -FilePath $exeFilePath -ArgumentList "-ms" -Wait -Passthru)
$exitCode = $process.ExitCode
if ($exitCode -ne 0)
{
throw "Command failed with exit code $exitCode."
}
del $exeFilePath
Write-Host "Mozilla Firefox 27.0.1 successfully installed" -ForegroundColor Green
# Disable Firefox First Run Import Settings and Data Wizard
Write-Host "Disabling Mozilla Firefox Profile Migrator..."
$ProgramFiles = ${Env:ProgramFiles(x86)}
$FilePath = $ProgramFiles + "\Mozilla Firefox\override.ini"
if (!(test-path ($FilePath)))
{
# create the override.ini per https://developer.mozilla.org/en/Command_Line_Options
$err=@()
New-Item -type file -force $FilePath -ErrorVariable err | Out-Null
if (!($err.count -eq 0))
{
throw "Failed to create override.ini."
}
}
# read in the override.ini file
$iniData = Get-IniContent $FilePath
if (!($iniData.XRE))
{
$iniData.XRE = @{}
}
if (!($iniData.XRE.EnableProfileMigrator -eq 0))
{
$iniData.XRE.EnableProfileMigrator = 0
Out-IniFile -InputObject $iniData -FilePath $FilePath -Append
}
Write-Host "Mozilla Firefox Profile Migrator disabled" -ForegroundColor Green
# Selenium components for Coded UI Cross Browser Testing Version 1.7
Write-Host "Downloading Selenium components for Coded UI Cross Browser Testing Version 1.7..."
$msiFilePath = "$($env:USERPROFILE)\CodedUITestCrossBrowserSetup.msi"
$logFilePath = "$($env:TEMP)\CodedUITestCrossBrowserSetup.txt"
$webclient.DownloadFile('https://visualstudiogallery.msdn.microsoft.com/11cfc881-f8c9-4f96-b303-a2780156628d/file/85444/13/CodedUITestCrossBrowserSetup.msi', $msiFilePath)
Write-Host "Installing Selenium components for Coded UI Cross Browser Testing Version 1.7..."
$process = (Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $msiFilePath /quiet /l*v $logFilePath" -Wait -Passthru)
$exitCode = $process.ExitCode
if ($exitCode -ne 0)
{
Get-Content $logFilePath
throw "Command failed with exit code $exitCode."
}
del $msiFilePath
del $logFilePath
Write-Host "Selenium components for Coded UI Cross Browser Testing Version 1.7 successfully installed" -ForegroundColor Green
# Chrome driver 2.27
Write-Host "Downloading Chrome driver 2.27..."
$zipPath = "$($env:USERPROFILE)\chromedriver_win32.zip"
$webclient.DownloadFile('http://chromedriver.storage.googleapis.com/2.27/chromedriver_win32.zip', $zipPath)
Write-Host "Installing Chrome driver 2.27..."
7z x $zipPath -y -o"$($ProgramFiles)\Common Files\Microsoft Shared\VSTT\Cross Browser Selenium Components" | Out-Null
Write-Host "Chrome driver 2.27 successfully installed" -ForegroundColor Green
if(-not $screen_resolution) {
$screen_resolution = '1024x768'
}
Write-Host "Setting up active Desktop..." -ForegroundColor cyan
# https://github.com/FreeRDP/FreeRDP/wiki/CommandLineInterface
#$zipPath = "$($env:USERPROFILE)\wfreerdp-1.1.zip"
#$webclient.DownloadFile('http://av1southus4workers.blob.core.windows.net/downloads/tools/wfreerdp-1.1.zip', $zipPath)
#7z x $zipPath -y -o"$env:TEMP" | Out-Null
#Write-Host "Starting Remote Desktop session..."
#$psw = (get-itemproperty -path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -name DefaultPassword).DefaultPassword
#Start-Process "$env:TEMP\wfreerdp.exe" -ArgumentList '/v:127.0.0.1','/u:appveyor',"/p:$psw","/size:$screen_resolution" -WindowStyle Hidden
#Write-Host "Waiting for RDP to connect..."
#Start-Sleep -s 5
#Write-Host "Desktop ready"-ForegroundColor green
# Load remote sources with full trust
$ConfigFilePath = ${Env:ProgramFiles(x86)} + "\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe.config"
[xml]$Configuration = Get-Content -Path $ConfigFilePath
$element = $Configuration.CreateElement('loadFromRemoteSources')
$element.Attributes.Append($Configuration.CreateAttribute("enabled"))
$element.enabled = "true"
$Configuration.configuration.runtime.AppendChild($element)
$Configuration.Save($ConfigFilePath)
# $blockRdp = $true; iex ($webclient.DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))"
assembly_info:
patch: true
file: src\CommonAssemblyInfo.cs
assembly_version: '{version}.0'
assembly_file_version: '{version}.0'
assembly_informational_version: '{version}-beta'
install:
- cmd: >-
REM Apply low integrity label on html files to mark them as accessible from an Enhanced Protected Mode process
REM http://blogs.msdn.com/b/ieinternals/archive/2012/06/20/loading-local-files-in-enhanced-protected-mode-in-internet-explorer-10.aspx
REM This circumvents the "Open File - Security Warning" dialog that appears when exes (applications under test) are launched
icacls "%appveyor_build_folder%" /setintegritylevel (CI)(OI)Medium
nuget:
disable_publish_on_pr: true
build_script:
- cmd: >-
setx see_mask_nozonechecks 1 /m
call "%VS140COMNTOOLS%VsDevCmd.bat"
msbuild.exe src\build.proj /t:Build;Pack
REM icacls src\Sut.HtmlTest\bin\Release\TestHtmlPage.html /setintegritylevel (CI)(OI)Low
test:
assemblies: '**\bin\Release\*Test.dll'
artifacts:
- path: '*.nupkg'
name: NuGet
deploy:
- provider: NuGet
api_key:
secure: g78LUTxqGPAeE0eliIasoLHL2fGxcWkPcojy06FwWUqtRUK3E4ToYSQ34GlEUYj5
artifact: NuGet
on_finish:
- ps: |
# Collect test results
Write-Host "Publishing test results..."
Get-ChildItem '.\TestResults\*\In' -Recurse -Include '*.*' | % { Push-AppveyorArtifact $_.FullName -FileName $(-Join $(Split-Path (Split-Path (Split-Path $_.FullName -Parent) -Parent ) -Leaf) + '_' + $_.Name) -DeploymentName TestResult }
# Collect UI test log
Write-Host "Publishing UI test log..."
Push-AppveyorArtifact $env:temp\UITestLogs\LastRun\UITestLog.html -DeploymentName UITestLog
Write-Host "Build finished."
on_failure:
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))