Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tweak appveyor abstractions, [releaseme]
- Loading branch information
1 parent
8ac7a40
commit bf72cdc
Showing
6 changed files
with
141 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# When performing both PS2 and PS5 tests, use this from PS5 to save the path to the Pester module | ||
# We then use that path in PS2 | ||
# cinst seems to fail, presumably pester is found, in a path PS2 doesn't like | ||
|
||
$PesterPath = @( (Get-Module Pester -ListAvailable).Path )[0] | ||
[Environment]::SetEnvironmentVariable("PesterPath", $PesterPath, "Machine") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
$Verbose = @{} | ||
if($env:APPVEYOR_REPO_BRANCH -and $env:APPVEYOR_REPO_BRANCH -notlike "master") | ||
{ | ||
$Verbose.add("Verbose",$True) | ||
} | ||
|
||
# Deploy! | ||
|
||
if($ENV:APPVEYOR_REPO_COMMIT_MESSAGE -notmatch '\[ReleaseMe\]') | ||
{ | ||
Write-Verbose 'Skipping deployment, include [ReleaseMe] in your commit message to deploy.' | ||
} | ||
elseif($env:APPVEYOR_REPO_BRANCH -notlike 'master') | ||
{ | ||
Write-Verbose 'Skipping deployment, not master!' | ||
} | ||
else | ||
{ | ||
|
||
$PublishParams = @{ | ||
Path = Join-Path $ENV:APPVEYOR_BUILD_FOLDER $ENV:ModuleName | ||
NuGetApiKey = $ENV:NugetApiKey | ||
} | ||
if($ENV:ReleaseNotes) { $PublishParams.ReleaseNotes = $ENV:ReleaseNotes } | ||
if($ENV:LicenseUri) { $PublishParams.LicenseUri = $ENV:LicenseUri } | ||
if($ENV:ProjectUri) { $PublishParams.ProjectUri = $ENV:ProjectUri } | ||
if($ENV:Tags) | ||
{ | ||
# split it up, remove whitespace | ||
$PublishParams.Tags = $ENV:Tags -split ',' | where { $_ } | foreach {$_.trim()} | ||
} | ||
|
||
#Publish! | ||
Publish-Module @PublishParams | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#Initialize some variables, move to the project root | ||
$ProjectRoot = $ENV:APPVEYOR_BUILD_FOLDER | ||
$Timestamp = Get-date -uformat "%Y%m%d-%H%M%S" | ||
$PSVersion = $PSVersionTable.PSVersion.Major | ||
$TestFile = "TestResults_PS$PSVersion`_$TimeStamp.xml" | ||
|
||
$Address = "https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)" | ||
Set-Location $ProjectRoot | ||
|
||
$Verbose = @{} | ||
if($env:APPVEYOR_REPO_BRANCH -and $env:APPVEYOR_REPO_BRANCH -notlike "master") | ||
{ | ||
$Verbose.add("Verbose",$True) | ||
} | ||
|
||
# Load up Pester | ||
# PS less than 4? Load from the path we found | ||
if($PSVersionTable.PSVersion.Major -lt 4) | ||
{ | ||
$PesterPath = [Environment]::GetEnvironmentVariable("PesterPath","Machine") | ||
if(Test-Path $PesterPath) | ||
{ | ||
Import-Module $PesterPath | ||
} | ||
else | ||
{ | ||
Throw "Where is pester! '$PesterPath' not found" | ||
} | ||
} | ||
# cinst didn't seem to work, install a new flavor and import it. | ||
elseif(-not (Get-Module Pester -ListAvailable)) | ||
{ | ||
$null = Install-Module Pester -Force -Confirm:$False | ||
Import-Module Pester -force | ||
} | ||
# Module is there, import it | ||
else | ||
{ | ||
Import-Module Pester -force | ||
} | ||
|
||
#Run a test with the current version of PowerShell, upload results | ||
"`n`tSTATUS: Testing with PowerShell $PSVersion" | ||
|
||
Invoke-Pester @Verbose -Path "$ProjectRoot\Tests" -OutputFormat NUnitXml -OutputFile "$ProjectRoot\$TestFile" -PassThru | | ||
Export-Clixml -Path "$ProjectRoot\PesterResults_PS$PSVersion`_$Timestamp.xml" | ||
|
||
If($env:APPVEYOR_JOB_ID) | ||
{ | ||
(New-Object 'System.Net.WebClient').UploadFile( $Address, "$ProjectRoot\$TestFile" ) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#If finalize is specified, display errors and fail build if we ran into any | ||
|
||
#Show status... | ||
$ProjectRoot = $ENV:APPVEYOR_BUILD_FOLDER | ||
$AllFiles = Get-ChildItem -Path $ProjectRoot\PesterResults*.xml | Select -ExpandProperty FullName | ||
"`n`tSTATUS: Finalizing results" | ||
"COLLATING FILES:`n$($AllFiles | Out-String)" | ||
|
||
#What failed? | ||
$Results = @( Get-ChildItem -Path "$ProjectRoot\PesterResults_PS*.xml" | Import-Clixml ) | ||
|
||
$FailedCount = $Results | | ||
Select -ExpandProperty FailedCount | | ||
Measure-Object -Sum | | ||
Select -ExpandProperty Sum | ||
|
||
if ($FailedCount -gt 0) { | ||
|
||
$FailedItems = $Results | | ||
Select -ExpandProperty TestResult | | ||
Where {$_.Passed -notlike $True} | ||
|
||
"FAILED TESTS SUMMARY:" | ||
$FailedItems | ForEach-Object { | ||
$Item = $_ | ||
[pscustomobject]@{ | ||
Describe = $Item.Describe | ||
Context = $Item.Context | ||
Name = "It $($Item.Name)" | ||
Result = $Item.Result | ||
} | ||
} | | ||
Sort Describe, Context, Name, Result | | ||
Format-List | ||
|
||
throw "$FailedCount tests failed." | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters