-
Notifications
You must be signed in to change notification settings - Fork 3
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
7 changed files
with
209 additions
and
16 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,179 @@ | ||
param | ||
( | ||
# Project path | ||
[Parameter()] | ||
[System.String] | ||
$ProjectPath = (property ProjectPath $BuildRoot), | ||
|
||
[Parameter()] | ||
# Base directory of all output (default to 'output') | ||
[System.String] | ||
$OutputDirectory = (property OutputDirectory (Join-Path $BuildRoot 'output')), | ||
|
||
[Parameter()] | ||
[System.String] | ||
$BuiltModuleSubdirectory = (property BuiltModuleSubdirectory ''), | ||
|
||
[Parameter()] | ||
[System.Management.Automation.SwitchParameter] | ||
$VersionedOutputDirectory = (property VersionedOutputDirectory $true), | ||
|
||
[Parameter()] | ||
[System.String] | ||
$ProjectName = (property ProjectName ''), | ||
|
||
[Parameter()] | ||
[System.String] | ||
$PesterOutputFolder = (property PesterOutputFolder 'testResults'), | ||
|
||
[Parameter()] | ||
[System.String] | ||
$PesterOutputFormat = (property PesterOutputFormat ''), | ||
|
||
[Parameter()] | ||
[System.Object[]] | ||
$PesterScript = (property PesterScript ''), | ||
|
||
[Parameter()] | ||
[System.String[]] | ||
$PesterTag = (property PesterTag @()), | ||
|
||
[Parameter()] | ||
[System.String[]] | ||
$PesterExcludeTag = (property PesterExcludeTag @()), | ||
|
||
[Parameter()] | ||
[System.String] | ||
$CodeCoverageThreshold = (property CodeCoverageThreshold ''), | ||
|
||
# Build Configuration object | ||
[Parameter()] | ||
[System.Collections.Hashtable] | ||
$BuildInfo = (property BuildInfo @{ }) | ||
) | ||
|
||
|
||
# Synopsis: Merging several code coverage files together. | ||
task Generate_Composite_Resource_Module { | ||
# Get the vales for task variables, see https://github.com/gaelcolas/Sampler#task-variables. | ||
. Set-SamplerTaskVariable | ||
|
||
"`tOutput Path = '$OutputDirectory'" | ||
|
||
Write-Build White 'Generating Composite Resource Module' | ||
|
||
$result = New-CompositeResourceModule -OutputPath $OutputDirectory | ||
|
||
if ($result) | ||
{ | ||
Write-Build Green "Module generation completed." | ||
} | ||
else | ||
{ | ||
throw "Error occurred during module generation! Please check the log output." | ||
} | ||
|
||
# $osShortName = Get-OperatingSystemShortName | ||
|
||
# $powerShellVersion = 'PSv.{0}' -f $PSVersionTable.PSVersion | ||
|
||
# $moduleFileName = '{0}.psm1' -f $ProjectName | ||
|
||
# $PesterOutputFolder = Get-SamplerAbsolutePath -Path $PesterOutputFolder -RelativeTo $OutputDirectory | ||
|
||
# "`tPester Output Folder = '$PesterOutputFolder'" | ||
|
||
# $GetCodeCoverageThresholdParameters = @{ | ||
# RuntimeCodeCoverageThreshold = $CodeCoverageThreshold | ||
# BuildInfo = $BuildInfo | ||
# } | ||
|
||
# $CodeCoverageThreshold = Get-CodeCoverageThreshold @GetCodeCoverageThresholdParameters | ||
|
||
# if (-not $CodeCoverageThreshold) | ||
# { | ||
# $CodeCoverageThreshold = 0 | ||
# } | ||
|
||
# "`tCode Coverage Threshold = '$CodeCoverageThreshold'" | ||
|
||
# if ($CodeCoverageThreshold -gt 0) | ||
# { | ||
# $getPesterOutputFileFileNameParameters = @{ | ||
# ProjectName = $ProjectName | ||
# ModuleVersion = $ModuleVersion | ||
# OsShortName = $osShortName | ||
# PowerShellVersion = $powerShellVersion | ||
# } | ||
|
||
# $pesterOutputFileFileName = Get-PesterOutputFileFileName @getPesterOutputFileFileNameParameters | ||
|
||
# $getCodeCoverageOutputFile = @{ | ||
# BuildInfo = $BuildInfo | ||
# PesterOutputFolder = $PesterOutputFolder | ||
# } | ||
|
||
# $CodeCoverageOutputFile = Get-SamplerCodeCoverageOutputFile @getCodeCoverageOutputFile | ||
|
||
# if (-not $CodeCoverageOutputFile) | ||
# { | ||
# $CodeCoverageOutputFile = (Join-Path -Path $PesterOutputFolder -ChildPath "CodeCov_$pesterOutputFileFileName") | ||
# } | ||
|
||
# "`tCode Coverage Output File = $CodeCoverageOutputFile" | ||
|
||
# $CodeCoverageMergedOutputFile = 'CodeCov_Merged.xml' | ||
|
||
# if ($BuildInfo.CodeCoverage.CodeCoverageMergedOutputFile) | ||
# { | ||
# $CodeCoverageMergedOutputFile = $BuildInfo.CodeCoverage.CodeCoverageMergedOutputFile | ||
# } | ||
|
||
# $CodeCoverageMergedOutputFile = Get-SamplerAbsolutePath -Path $CodeCoverageMergedOutputFile -RelativeTo $PesterOutputFolder | ||
|
||
# "`tCode Coverage Merge Output File = $CodeCoverageMergedOutputFile" | ||
|
||
# $CodeCoverageFilePattern = 'Codecov*.xml' | ||
|
||
# if ($BuildInfo.ContainsKey('CodeCoverage') -and $BuildInfo.CodeCoverage.ContainsKey('CodeCoverageFilePattern')) | ||
# { | ||
# $CodeCoverageFilePattern = $BuildInfo.CodeCoverage.CodeCoverageFilePattern | ||
# } | ||
|
||
# "`tCode Coverage File Pattern = $CodeCoverageFilePattern" | ||
|
||
# if (-not [System.String]::IsNullOrEmpty($CodeCoverageFilePattern)) | ||
# { | ||
# $codecovFiles = Get-ChildItem -Path $PesterOutputFolder -Include $CodeCoverageFilePattern -Recurse | ||
# } | ||
|
||
# "`tMerging Code Coverage Files = '{0}'" -f ($codecovFiles.FullName -join ', ') | ||
# "" | ||
|
||
# if (Test-Path -Path $CodeCoverageMergedOutputFile) | ||
# { | ||
# Write-Build Yellow "File $CodeCoverageMergedOutputFile found, deleting file." | ||
|
||
# Remove-Item -Path $CodeCoverageMergedOutputFile -Force | ||
# } | ||
|
||
# Write-Build White "Processing folder: $OutputDirectory" | ||
|
||
# if ($codecovFiles.Count -gt 1) | ||
# { | ||
# Write-Build DarkGray "Started merging $($codecovFiles.Count) code coverage files!" | ||
|
||
# Start-CodeCoverageMerge -Files $codecovFiles -TargetFile $CodeCoverageMergedOutputFile | ||
|
||
# Write-Build Green "Merge completed. Saved merge result to: $CodeCoverageMergedOutputFile" | ||
# } | ||
# else | ||
# { | ||
# throw "Found $($codecovFiles.Count) code coverage file. Need at least two files to merge." | ||
# } | ||
# } | ||
# else | ||
# { | ||
# Write-Build White 'Code coverage is not enabled, skipping.' | ||
# } | ||
} |
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 |
---|---|---|
|
@@ -6,10 +6,12 @@ | |
# SourcePath: ./Sampler/Sampler.psd1 | ||
# Output Directory where ModuleBuilder will build the Module, relative to module manifest | ||
# OutputDirectory: ../output/Sampler | ||
BuiltModuleSubdirectory: module | ||
#BuiltModuleSubdirectory: module | ||
CopyPaths: | ||
- en-US | ||
- Dependencies.psd1 | ||
- ../.build/tasks | ||
suffix: suffix.ps1 | ||
Encoding: UTF8 | ||
# Can be used to manually specify module's semantic version if the preferred method of | ||
# using GitVersion is not available, and it is not possible to set the session environment | ||
|
@@ -74,6 +76,7 @@ BuildWorkflow: | |
publish: | ||
- publish_module_to_gallery | ||
- Publish_Release_To_GitHub | ||
- Create_ChangeLog_GitHub_PR | ||
|
||
#################################################### | ||
# PESTER Configuration # | ||
|
@@ -83,6 +86,7 @@ Pester: | |
OutputFormat: NUnitXML | ||
# Excludes one or more paths from being used to calculate code coverage. | ||
ExcludeFromCodeCoverage: | ||
- tasks | ||
|
||
# If no scripts are defined the default is to use all the tests under the project's | ||
# tests folder or source folder (if present). Test script paths can be defined to | ||
|
@@ -115,14 +119,6 @@ Pester: | |
#CodeCoverageFilePattern: JaCoCo_Merge.xml # the pattern used to search all pipeline test job artifacts | ||
#CodeCoverageMergedOutputFile: JaCoCo_coverage.xml # the file that is created for the merged code coverage | ||
|
||
DscTest: | ||
ExcludeTag: | ||
- "Common Tests - New Error-Level Script Analyzer Rules" | ||
Tag: | ||
ExcludeSourceFile: | ||
- output | ||
# - Templates | ||
|
||
# Import ModuleBuilder tasks from a specific PowerShell module using the build | ||
# task's alias. Wildcard * can be used to specify all tasks that has a similar | ||
# prefix and or suffix. The module contain the task must be added as a required | ||
|
@@ -133,7 +129,6 @@ ModuleBuildTasks: | |
Sampler.GitHubTasks: | ||
- '*.ib.tasks' | ||
|
||
|
||
# Invoke-Build Header to be used to 'decorate' the terminal output of the tasks. | ||
TaskHeader: | | ||
param($Path) | ||
|
@@ -145,3 +140,12 @@ TaskHeader: | | |
Write-Build DarkGray " $Path" | ||
Write-Build DarkGray " $($Task.InvocationInfo.ScriptName):$($Task.InvocationInfo.ScriptLineNumber)" | ||
"" | ||
GitHubConfig: | ||
ReleaseAssets: | ||
- 'output/CHANGELOG.md' | ||
GitHubFilesToAdd: | ||
- 'CHANGELOG.md' | ||
GitHubConfigUserName: ykuijs | ||
GitHubConfigUserEmail: [email protected] | ||
UpdateChangelogOnPrerelease: false |
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
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,9 @@ | ||
# Inspired from https://github.com/nightroman/Invoke-Build/blob/64f3434e1daa806814852049771f4b7d3ec4d3a3/Tasks/Import/README.md#example-2-import-from-a-module-with-tasks | ||
Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'tasks\*') -Include '*.build.*' | | ||
ForEach-Object -Process { | ||
$ModuleName = ([System.IO.FileInfo] $MyInvocation.MyCommand.Name).BaseName | ||
$taskFileAliasName = "$($_.BaseName).$ModuleName.ib.tasks" | ||
Set-Alias -Name $taskFileAliasName -Value $_.FullName | ||
|
||
Export-ModuleMember -Alias $taskFileAliasName | ||
} |