Update CI process to fix issues #4 (#7)

- Fix build script
- Add tests to build
- Allow pre-release versions of PSDocs and PSRule
This commit is contained in:
Bernie White 2019-05-11 18:00:43 +10:00 коммит произвёл GitHub
Родитель d8bc03507f
Коммит 956adade04
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 17 добавлений и 7 удалений

10
.vscode/tasks.json поставляемый
Просмотреть файл

@ -30,6 +30,16 @@
"clear": true,
"panel": "dedicated"
}
},
{
"label": "build-rule-docs",
"type": "shell",
"command": "Invoke-Build BuildRuleDocs",
"problemMatcher": [ ],
"presentation": {
"clear": true,
"panel": "dedicated"
}
}
]
}

Просмотреть файл

@ -29,7 +29,7 @@ pool:
steps:
# Install pipeline dependencies and build module
- powershell: ./scripts/pipeline-build.ps1 -File ./PSRule.build.ps1 -Configuration $(buildConfiguration) -ModuleVersion $(Build.BuildNumber) -ReleaseVersion "$(Release.Version)"
- powershell: ./scripts/pipeline-build.ps1 -File ./pipeline.build.ps1 -Configuration $(buildConfiguration) -ModuleVersion $(Build.BuildNumber) -ReleaseVersion "$(Release.Version)"
displayName: 'Build module'
# Pester test results

Просмотреть файл

@ -126,7 +126,7 @@ task PSScriptAnalyzer NuGet, {
# Synopsis: Install PSRule
task PSRule NuGet, {
if ($Null -eq (Get-InstalledModule -Name PSRule -MinimumVersion 0.5.0 -ErrorAction Ignore)) {
Install-Module -Name PSRule -MinimumVersion 0.5.0 -Scope CurrentUser -Force;
Install-Module -Name PSRule -MinimumVersion 0.5.0 -AllowPrerelease -Scope CurrentUser -Force;
}
Import-Module -Name PSRule -Verbose:$False;
}
@ -134,7 +134,7 @@ task PSRule NuGet, {
# Synopsis: Install PSDocs
task PSDocs NuGet, {
if ($Null -eq (Get-InstalledModule -Name PSDocs -MinimumVersion 0.6.1 -ErrorAction Ignore)) {
Install-Module -Name PSDocs -MinimumVersion 0.6.1 -Scope CurrentUser -Force;
Install-Module -Name PSDocs -MinimumVersion 0.6.1 -AllowPrerelease -Scope CurrentUser -Force;
}
Import-Module -Name PSDocs -Verbose:$False;
}
@ -152,7 +152,7 @@ task BuildModule CopyModule
task TestRules PSRule, Pester, PSScriptAnalyzer, {
# Run Pester tests
$pesterParams = @{ Path = $PWD; OutputFile = 'reports/Pester.xml'; OutputFormat = 'NUnitXml'; PesterOption = @{ IncludeVSCodeMarker = $True }; PassThru = $True; };
$pesterParams = @{ Path = $PWD; OutputFile = 'reports/pester-unit.xml'; OutputFormat = 'NUnitXml'; PesterOption = @{ IncludeVSCodeMarker = $True }; PassThru = $True; };
if (!(Test-Path -Path reports)) {
$Null = New-Item -Path reports -ItemType Directory -Force;
@ -170,7 +170,7 @@ task TestRules PSRule, Pester, PSScriptAnalyzer, {
}
# Synopsis: Build table of content for rules
task BuildRuleDocs PSDocs, {
task BuildRuleDocs PSRule, PSDocs, {
Invoke-PSDocument -Name Kubernetes -OutputPath .\docs\rules\en-US\ -Path .\RuleToc.Document.ps1
}
@ -179,10 +179,10 @@ task Clean {
Remove-Item -Path out,reports -Recurse -Force -ErrorAction SilentlyContinue;
}
task Build Clean, BuildModule, BuildRuleDocs
task Build Clean, BuildModule
task Test Build, TestRules
task Release ReleaseModule
task . Build
task . Build, Test