add CodeCov reports

This commit is contained in:
OCram85 2020-06-04 14:38:16 +02:00
parent b0a5ccd192
commit 117f29886b
2 changed files with 24 additions and 10 deletions

View File

@ -1,6 +1,8 @@
# pre release version:
version: 1.0.{build}
cache:
#branches:
# only:
# - master
@ -40,6 +42,17 @@ build_script:
- ps: Invoke-AppVeyorBuild
test_script:
- ps: |
$CodeCoverage = Invoke-AppVeyorTests
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..."
}
$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
#- ps: |
# $CodeCoverage = Invoke-AppVeyorTests
# if ($null -ne $Env:CoverallsToken) {
@ -48,11 +61,11 @@ test_script:
# 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
#- 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:
#- provider: GitHub

View File

@ -23,12 +23,12 @@ Function Invoke-InstallDependencies() {
Import-PackageProvider -Name NuGet -RequiredVersion '2.8.5.208' -Force
Write-Host 'Installing build deps...' -ForegroundColor Red -BackgroundColor Black
Install-Module -Name 'Pester' -Scope CurrentUser -RequiredVersion '4.10.1' -Force -SkipPublisherCheck -AllowClobber -Verbose
Install-Module -Name 'posh-git' -Scope CurrentUser -RequiredVersion '1.0.0-beta2' -Force -SkipPublisherCheck -AllowClobber -AllowPrerelease
#Install-Module -Name 'PSCoverage' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber -RequiredVersion '1.0.78'
Install-Module -Name 'posh-git' -Scope CurrentUser -RequiredVersion '0.7.3' -Force -SkipPublisherCheck -AllowClobber -AllowPrerelease
Install-Module -Name 'PSCoverage' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber -RequiredVersion '1.1.89' -Verbose
Import-Module -Name 'posh-git'
#Import-Module -Name 'PSCoverage'
Remove-Module -Name 'Pester' -Force -ErrorAction SilentlyContinue
Import-Module -Name 'Pester' -RequiredVersion '4.10.1' -Verbose
Import-Module -Name 'Pester' -RequiredVersion '4.10.1' -Verbose -Force
Import-Module -Name 'PSCoverage' -RequiredVersion '1.1.89' -Verbose -Force
}
Catch {
$MsgParams = @{
@ -119,6 +119,7 @@ Function Invoke-AppVeyorTests() {
Write-Warning -Message ('Could not find file: {0} !' -f $File.FullName)
}
}
Write-Host '===== Preload done. =====' -ForegroundColor Black -BackgroundColor Yellow
}
catch {
$_.Exception.Message | Write-Error
@ -128,7 +129,7 @@ Function Invoke-AppVeyorTests() {
#$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'
$TestResults = Invoke-Pester -Path $testFiles -CodeCoverage $srcFiles -PassThru
$TestResults = Invoke-Pester -Path $testFiles -CodeCoverage $srcFiles -PassThru -CodeCoverageOutputFile ".\coverage.xml" -CodeCoverageOutputFileEncoding ascii -CodeCoverageOutputFileFormat JaCoCo
ForEach ($Item in $TestResults.TestResult) {
Switch ($Item.Result) {
"Passed" {