-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
65 additions
and
72 deletions.
There are no files selected for viewing
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
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
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,61 @@ | ||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('DscResource.AnalyzerRules\Measure-ParameterBlockParameterAttribute', '', Scope='Function', Target='*')] | ||
param ( | ||
$ModuleName, | ||
$ModuleBase, | ||
$ModuleManifest, | ||
$ProjectPath, | ||
$SourcePath, | ||
$SourceManifest, | ||
$Tag, | ||
$ExcludeTag, | ||
$ExcludeModuleFile, | ||
$ExcludeSourceFile | ||
) | ||
|
||
if (!$ProjectPath) | ||
{ | ||
# Invoke-DscResourceTest is only looking at a built module, skipping this test file. | ||
Write-Verbose "No Project path set: $ProjectPath. Skipping changelog checks." | ||
return | ||
} | ||
else | ||
{ | ||
Write-Verbose "Pushing location $ProjectPath on Stack ProjectTest" | ||
Push-Location -StackName ProjectTest -Path $ProjectPath | ||
} | ||
|
||
try | ||
{ | ||
Describe 'Changelog Management' -Tag 'Changelog' { | ||
|
||
It 'Changelog has been updated' -skip:( | ||
!([bool](Get-Command git -EA SilentlyContinue) -and | ||
[bool](&(Get-Process -id $PID).Path -NoProfile -Command 'git rev-parse --is-inside-work-tree 2>$null')) | ||
) { | ||
# Get the list of changed files compared with master | ||
$HeadCommit = &git rev-parse HEAD | ||
$MasterCommit = &git rev-parse origin/master | ||
$filesChanged = &git diff $MasterCommit...$HeadCommit --name-only | ||
|
||
if ($HeadCommit -ne $MasterCommit) | ||
{ | ||
# if we're not testing same commit (i.e. master..master) | ||
$filesChanged.Where{ | ||
(Split-Path $_ -Leaf) -match '^changelog.md' | ||
} | Should -Not -BeNullOrEmpty | ||
} | ||
} | ||
|
||
It 'Changelog format compliant with keepachangelog format' -skip:( | ||
![bool](Get-Command git -EA SilentlyContinue) -or | ||
!(Import-Module -Name ChangelogManagement -ErrorAction SilentlyContinue -PassThru) | ||
) { | ||
{ Get-ChangelogData (Join-Path $ProjectPath 'CHANGELOG.md') -ErrorAction Stop } | Should -Not -Throw | ||
} | ||
} | ||
} | ||
finally | ||
{ | ||
Write-Debug "Poping location on Stack ProjectTest" | ||
Pop-Location -StackName ProjectTest | ||
} |
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
This file was deleted.
Oops, something went wrong.