Modernize Build Pipeline #48

Merged
OCram85 merged 20 commits from updmeta into master 2020-10-02 15:48:59 +02:00
2 changed files with 24 additions and 10 deletions
Showing only changes of commit 117f29886b - Show all commits

View File

@ -1,6 +1,8 @@
# pre release version: # pre release version:
version: 1.0.{build} version: 1.0.{build}
cache:
#branches: #branches:
# only: # only:
# - master # - master
@ -40,6 +42,17 @@ build_script:
- ps: Invoke-AppVeyorBuild - ps: Invoke-AppVeyorBuild
test_script: 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: | #- ps: |
# $CodeCoverage = Invoke-AppVeyorTests # $CodeCoverage = Invoke-AppVeyorTests
# if ($null -ne $Env:CoverallsToken) { # if ($null -ne $Env:CoverallsToken) {
@ -48,11 +61,11 @@ 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..."
# } # }
- ps: | #- ps: |
Invoke-CodeCoveTests # Invoke-CodeCoveTests
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH # $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh # Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
bash codecov.sh -f "coverage.xml" -t $Env:CodeCovToken # bash codecov.sh -f "coverage.xml" -t $Env:CodeCovToken
deploy: deploy:
#- provider: GitHub #- provider: GitHub

View File

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