Cleanup helper function

This commit is contained in:
OCram85 2020-10-01 14:06:51 +02:00
parent bc6ac5cd73
commit 42f47eb95a
2 changed files with 22 additions and 54 deletions

View File

@ -11,9 +11,7 @@ cache:
skip_tags: true skip_tags: true
#image: WMF 5 image: Visual Studio 2017
# Test ne build image:
image: Visual Studio 2013
# Install pester module and init the Appveyor support. # Install pester module and init the Appveyor support.
@ -50,22 +48,12 @@ test_script:
else { else {
Write-Warning "No CoverallsToken found. This build seems to be triggered by a PR. Skipping this step..." Write-Warning "No CoverallsToken found. This build seems to be triggered by a PR. Skipping this step..."
} }
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH if ($null -neq $Env:CodeCovToken) {
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh Invoke-CodeCove
Invoke-Expression "bash codecov.sh -f 'coverage.xml' -t $Env:CodeCovToken" 2>&1 }
#- ps: | else {
# $CodeCoverage = Invoke-AppVeyorTests Write-Warning "No CodeCovToken found. This build seems to be triggered by a PR. Skipping this step..."
# if ($null -ne $Env:CoverallsToken) { }
# Invoke-CoverageReport -PesterCoverageReport $CodeCoverage
# }
# else {
# Write-Warning "No CoverallsToken found. This build seems to be triggered by a PR. Skipping this step..."
# }
#- ps: |
# Invoke-CodeCoveTests
# $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
# Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
# bash codecov.sh -f "coverage.xml" -t $Env:CodeCovToken
deploy: deploy:
#- provider: GitHub #- provider: GitHub

View File

@ -182,41 +182,6 @@ Function Invoke-AppVeyorTests() {
} }
Function Invoke-CodeCoveTests() {
[CmdletBinding()]
Param()
$MsgParams = @{
Message = 'Starting Pester tests'
Category = 'Information'
Details = 'Now running all test found in .\tests\ dir.'
}
Add-AppveyorMessage @MsgParams
try {
Write-Host '===== Preload internal private functions =====' -ForegroundColor Black -BackgroundColor Yellow
$Privates = Get-ChildItem -Path (Join-Path -Path $Env:APPVEYOR_BUILD_FOLDER -ChildPath '/src/Private/*') -Include "*.ps1" -Recurse
foreach ($File in $Privates) {
if (Test-Path -Path $File.FullName) {
. $File.FullName
Write-Verbose -Message ('Private function dot-sourced: {0}' -f $File.FullName) -Verbose
}
else {
Write-Warning -Message ('Could not find file: {0} !' -f $File.FullName)
}
}
}
catch {
$_.Exception.Message | Write-Error
throw 'Could not load required private functions!'
}
#$testresults = Invoke-Pester -Path ( Get-ChildItem -Path ".\tests\*.Tests.ps1" -Recurse | Sort-Object -Property Name ) -ExcludeTag 'Disabled' -PassThru
$srcFiles = Get-ChildItem -Path ".\src\*.ps1" -Recurse | Sort-Object -Property 'Name' | Select-Object -ExpandProperty 'FullName'
$testFiles = Get-ChildItem -Path ".\tests\*.Tests.ps1" -Recurse | Sort-Object -Property 'Name' | Select-Object -ExpandProperty 'FullName'
$PesterRes = Invoke-Pester -Path $testFiles -CodeCoverage $srcFiles -CodeCoverageOutputFile ".\coverage.xml" -CodeCoverageOutputFileEncoding ascii -CodeCoverageOutputFileFormat JaCoCo
}
Function Invoke-CoverageReport() { Function Invoke-CoverageReport() {
[CmdletBinding()] [CmdletBinding()]
Param( Param(
@ -236,6 +201,21 @@ Function Invoke-CoverageReport() {
Publish-CoverageReport -CoverageReport $CoverageReport Publish-CoverageReport -CoverageReport $CoverageReport
} }
Function Invoke-CodeCove() {
[CmdletBinding()]
Param()
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile 'codecov.sh' -ErrorAction 'Stop'
if (Test-Path -Path 'coverage.xml') {
Invoke-Expression "bash codecov.sh -f 'coverage.xml' -t $Env:CodeCovToken" 2>&1
}
else {
Write-Error -Message 'Could not find pester coverage report!' -ErrorAction 'Stop'
}
}
Function Invoke-AppVeyorPSGallery() { Function Invoke-AppVeyorPSGallery() {
[CmdletBinding()] [CmdletBinding()]
Param( Param(