Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 507da9f

Browse files
authored
Merge pull request #389 from github/grokys/appveyor
Adds Appveyor support.
2 parents 6e47b96 + 0fcf204 commit 507da9f

File tree

5 files changed

+122
-3
lines changed

5 files changed

+122
-3
lines changed

appveyor.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '{build}'
2+
install:
3+
- ps: >-
4+
$full_build = Test-Path env:GHFVS_KEY
5+
6+
git submodule init
7+
8+
if ($full_build) {
9+
$fileContent = "-----BEGIN RSA PRIVATE KEY-----`n"
10+
$fileContent += $env:GHFVS_KEY.Replace(' ', "`n")
11+
$fileContent += "`n-----END RSA PRIVATE KEY-----`n"
12+
Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent
13+
} else {
14+
git submodule deinit script
15+
}
16+
17+
git submodule update
18+
19+
nuget restore GitHubVS.sln
20+
build_script:
21+
- cmd: msbuild "GitHubVS.sln" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Configuration=Release /p:DeployExtension=false /verbosity:minimal /p:VisualStudioVersion=14.0
22+
test_script:
23+
- ps: >-
24+
scripts\Run-Nunit.ps1 TrackingCollectionTests 180 Release
25+
26+
scripts\Run-Xunit.ps1 UnitTests 180 Release

script

scripts/Run-NUnit.ps1

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<#
2+
.SYNOPSIS
3+
Runs NUnit
4+
#>
5+
6+
[CmdletBinding()]
7+
Param(
8+
[Parameter(Mandatory=$true)]
9+
[ValidateNotNullOrEmpty()]
10+
[string]
11+
$project,
12+
[int]$timeoutDuration,
13+
[string]$configuration
14+
)
15+
16+
$rootDirectory = Split-Path (Split-Path $MyInvocation.MyCommand.Path)
17+
Push-Location $rootDirectory
18+
$dll = "src\$project\bin\$configuration\$project.dll"
19+
20+
$nunitDirectory = Join-Path $rootDirectory packages\NUnit.Runners.2.6.4\tools
21+
$consoleRunner = Join-Path $nunitDirectory nunit-console-x86.exe
22+
$xml = Join-Path $rootDirectory "nunit-$project.xml"
23+
$outputPath = [System.IO.Path]::GetTempFileName()
24+
25+
$args = "-noshadow", "-xml:$xml", "-framework:net-4.5", "-exclude:Timings", $dll
26+
[object[]] $output = "$consoleRunner " + ($args -join " ")
27+
28+
$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $outputPath $consoleRunner ($args | %{ "`"$_`"" })
29+
Wait-Process -InputObject $process -Timeout $timeoutDuration -ErrorAction SilentlyContinue
30+
if ($process.HasExited) {
31+
$output += Get-Content $outputPath
32+
$exitCode = $process.ExitCode
33+
} else {
34+
$output += "Tests timed out. Backtrace:"
35+
$output += Get-DotNetStack $process.Id
36+
$exitCode = 9999
37+
}
38+
39+
Stop-Process -InputObject $process
40+
Remove-Item $outputPath
41+
Pop-Location
42+
43+
$result = New-Object System.Object
44+
$result | Add-Member -Type NoteProperty -Name Output -Value $output
45+
$result | Add-Member -Type NoteProperty -Name ExitCode -Value $exitCode
46+
$result
47+

scripts/Run-XUnit.ps1

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<#
2+
.SYNOPSIS
3+
Runs xUnit
4+
#>
5+
6+
[CmdletBinding()]
7+
Param(
8+
[Parameter(Mandatory=$true)]
9+
[ValidateNotNullOrEmpty()]
10+
[string]
11+
$project,
12+
[int]$timeoutDuration,
13+
[string]$configuration
14+
)
15+
16+
$rootDirectory = Split-Path (Split-Path $MyInvocation.MyCommand.Path)
17+
Push-Location $rootDirectory
18+
19+
$dll = "src\$project\bin\$configuration\$project.dll"
20+
21+
$xunitDirectory = Join-Path $rootDirectory packages\xunit.runner.console.2.1.0\tools
22+
$consoleRunner = Join-Path $xunitDirectory xunit.console.x86.exe
23+
$xml = Join-Path $rootDirectory "nunit-$project.xml"
24+
$outputPath = [System.IO.Path]::GetTempFileName()
25+
26+
$args = $dll, "-noshadow", "-xml", $xml, "-parallel", "all"
27+
[object[]] $output = "$consoleRunner " + ($args -join " ")
28+
29+
$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $outputPath $consoleRunner ($args | %{ "`"$_`"" })
30+
Wait-Process -InputObject $process -Timeout $timeoutDuration -ErrorAction SilentlyContinue
31+
if ($process.HasExited) {
32+
$output += Get-Content $outputPath
33+
$exitCode = $process.ExitCode
34+
} else {
35+
$output += "Tests timed out. Backtrace:"
36+
$output += Get-DotNetStack $process.Id
37+
$exitCode = 9999
38+
}
39+
Stop-Process -InputObject $process
40+
Remove-Item $outputPath
41+
Pop-Location
42+
43+
$result = New-Object System.Object
44+
$result | Add-Member -Type NoteProperty -Name Output -Value $output
45+
$result | Add-Member -Type NoteProperty -Name ExitCode -Value $exitCode
46+
$result
47+

src/UnitTests/GitHub.App/ViewModels/RepositoryCloneViewModelTests.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ public async Task DisplaysErrorMessageWhenExceptionOccurs()
339339

340340
await vm.CloneCommand.ExecuteAsync(null);
341341

342-
notificationService.Received().ShowError(@"Failed to clone the repository 'octokit'
343-
Email [email protected] if you continue to have problems.");
342+
notificationService.Received().ShowError("Failed to clone the repository 'octokit'\r\nEmail [email protected] if you continue to have problems.");
344343
}
345344

346345
[Fact]

0 commit comments

Comments
 (0)