diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..29a05dd --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,24 @@ +codecov: + notify: + require_ci_to_pass: no + +comment: + layout: "reach, diff" + behavior: default + +coverage: + range: 50..80 + round: down + precision: 0 + + status: + project: + default: + # Set the overall project code coverage requirement to 70% + target: 70 + patch: + default: + # Set the pull request requirement to not regress overall coverage by more than 5% + # and let codecov.io set the goal for the code changed in the patch. + target: auto + threshold: 5 diff --git a/README.md b/README.md index 0c673f2..59ccc04 100644 --- a/README.md +++ b/README.md @@ -500,6 +500,8 @@ The following parameters will be the same for each process in the set: ### Unreleased +* Enable codecov.io code coverage reporting + ### 2.4.0.0 * Cleaned User diff --git a/appveyor.yml b/appveyor.yml index c69b266..15cab34 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,8 +14,8 @@ install: { throw 'WMF 5.1 install failed' } - - ps: Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force - - ps: Install-Module -Name Pester -Repository PSGallery -Force + - ps: Import-Module "$env:APPVEYOR_BUILD_FOLDER\DscResource.Tests\AppVeyor.psm1" + - ps: Invoke-AppveyorInstallTask #---------------------------------# # build configuration # @@ -29,12 +29,7 @@ build: false test_script: - ps: | - $testResultsFile = ".\TestsResults.xml" - $res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru - (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) - if ($res.FailedCount -gt 0) { - throw "$($res.FailedCount) tests failed." - } + Invoke-AppveyorTestScriptTask -CodeCoverage -CodeCovIo #---------------------------------# # deployment configuration # @@ -42,29 +37,5 @@ test_script: # scripts to run before deployment deploy_script: - - ps: | - # Creating project artifact - $stagingDirectory = (Resolve-Path ..).Path - $manifest = Join-Path $pwd "PSDscResources.psd1" - (Get-Content $manifest -Raw).Replace("2.4.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest - $zipFilePath = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" - Add-Type -assemblyname System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) - - # Creating NuGet package artifact - New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . - nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory . - $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName - - @( - # You can add other artifacts here - $zipFilePath, - $nuGetPackagePath - ) | % { - Write-Host "Pushing package $_ as Appveyor artifact" - Push-AppveyorArtifact $_ - } - - - + - ps: | + Invoke-AppveyorAfterTestTask