Skip to content

Commit

Permalink
Add build and signing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd committed Dec 11, 2018
1 parent c6e7ab8 commit 4ac3298
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.4.3 (December 11, 2018)
- Add signing scripts
- Same as 4.4.3-beta1 but signed

## 4.4.3-beta1 (November 27, 2018)
- Fix InModuleScope when using unbound scriptBlock [GH-1146]
- Allow multiple aliases for an assertion [GH-1122]
Expand Down
2 changes: 1 addition & 1 deletion Pester.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -585,4 +585,4 @@ InModuleScope -ModuleName Pester {
Should -BeTrue
}
}
}
}
4 changes: 2 additions & 2 deletions Pester.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ PrivateData = @{
LicenseUri = "https://www.apache.org/licenses/LICENSE-2.0.html"

# Release notes for this particular version of the module
ReleaseNotes = 'https://github.com/pester/Pester/releases/tag/4.4.3-beta1'
ReleaseNotes = 'https://github.com/pester/Pester/releases/tag/4.4.3'

# Prerelease string of this module
Prerelease = 'beta1'
Prerelease = ''
}
}

Expand Down
10 changes: 6 additions & 4 deletions cleanUpBeforeBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@
# each package then decides what will be part of it

$buildDir = "$PSScriptRoot\build"
$ErrorActionPreference = 'Stop'

if (Test-Path $buildDir) {
Write-Verbose "Removing build dir"
Remove-Item $buildDir -Recurse -Force -Confirm:$false -Verbose
Remove-Item $buildDir -Recurse -Force -Confirm:$false -Verbose -ErrorAction 'Stop'
}

if (Test-Path "$PSScriptRoot\Examples") {
Write-Verbose "Removing all examples"
Remove-Item "$PSScriptRoot\Examples" -Recurse -Force -Confirm:$false -Verbose
Remove-Item "$PSScriptRoot\Examples" -Recurse -Force -Confirm:$false -Verbose -ErrorAction 'Stop'
}

if (Test-Path "$PSScriptRoot\doc") {
Write-Verbose "Removing docs"
Remove-Item "$PSScriptRoot\doc" -Recurse -Force -Confirm:$false -Verbose
Remove-Item "$PSScriptRoot\doc" -Recurse -Force -Confirm:$false -Verbose -ErrorAction 'Stop'
}

Write-Verbose "Removing all Test Files"
Get-ChildItem $PSScriptRoot -Recurse -Filter *.Tests.ps1 | Remove-Item -Force -Verbose
Get-ChildItem $PSScriptRoot -Recurse -Filter *.Tests.ps1 | Remove-Item -Force -Verbose -ErrorAction 'Stop'
32 changes: 32 additions & 0 deletions release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# build should provide '%system.teamcity.build.checkoutDir%'
param (
[Parameter(Mandatory)]
[String] $CertificateThumbprint,
[Parameter(Mandatory)]
[String] $NugetApiKey,
[String] $ChocolateyApiKey,
[Parameter(Mandatory)]
[String] $PsGalleryApiKey



)

$ErrorActionPreference = 'Stop'
# run this in seperate instance otherwise Gherkin.dll is loaded and
$process = Start-Process powershell -ArgumentList "-c", ".\testRelease.ps1 -LocalBuild" -NoNewWindow -Wait -PassThru

if ($process.ExitCode -ne 0) {
throw "Testing failed with exit code $($process.ExitCode)."
}

.\getNugetExe.ps1
.\cleanUpBeforeBuild.ps1
.\signModule.ps1 -Thumbprint $CertificateThumbprint
.\buildNugetPackage.ps1
.\buildPSGalleryPackage.ps1


# .\publishPSGalleryPackage.ps1 $PsGalleryApiKey
# publish nuget
# publish chocolatey
6 changes: 4 additions & 2 deletions signModule.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
param($Thumbprint)
$ErrorActionPreference = 'Stop'
$cert = Get-ChildItem Cert:\CurrentUser\My |
Where Thumbprint -eq "CC1168BAFCDA3B1A5E532DA87E80A4DD69BCAEB1"

$cert = Get-ChildItem Cert:\CurrentUser\My |
where Thumbprint -eq $Thumbprint

if ($null -eq $cert) {
throw "No certificate was found."
Expand Down
45 changes: 45 additions & 0 deletions testRelease.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
param(
[switch] $LocalBuild
)

$ErrorActionPreference = 'Stop'

$psd1 = Join-Path $PSScriptRoot Pester.psd1

Get-Module Pester | Remove-Module
Import-Module $psd1 -ErrorAction Stop

$xml = Join-Path $PSScriptRoot Test.Version.xml
$result = Invoke-Pester -Path $PSScriptRoot -Tag VersionChecks, StyleRules -OutputFile $xml -OutputFormat NUnitXml -PassThru -Strict -ErrorAction Stop

if ($LocalBuild) {
# when I build release locally I don't want to
# think about removing the xml all the time
Remove-Item $xml
}

if ($result.TotalCount -lt 1)
{
$m = "No tests were run."

if ($LocalBuild) {
$m
exit 9999
}
else {
throw $m
}
}

if ($result.FailedCount -gt 0)
{
$m = "$($result.FailedCount) tests did not pass."
if ($LocalBuild) {
$m
exit $result.FailedCount
}
else
{
throw $m
}
}

0 comments on commit 4ac3298

Please sign in to comment.