version: 0.5.0.{build}

install:
- cinst -y pester
- git clone https://github.com/PowerShell/DscResource.Tests

build: off

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."
        }
deploy: off
on_finish:
    - ps: |
        $pwd = Join-Path $pwd "modules\xSharePoint"
        Remove-Item (Join-Path $pwd "xSharePoint.pssproj")
        $manifest = Join-Path $pwd "xSharePoint.psd1"
        (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
    - 7z a xSharePoint.zip %APPVEYOR_BUILD_FOLDER%\modules\xSharePoint
    - artifacts:
      - path: xSharePoint.zip
        name: PSModule
        type: zip
        
version: 0.5.0.{build}

install:
- cinst -y pester
- git clone https://github.com/PowerShell/DscResource.Tests

build: off

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."
        }
deploy: off
on_finish:
    - ps: |
        $pwd = Join-Path $pwd "modules\xSharePoint"
        Remove-Item (Join-Path $pwd "xSharePoint.pssproj")
        $manifest = Join-Path $pwd "xSharePoint.psd1"
        (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
    - 7z a xSharePoint.zip %APPVEYOR_BUILD_FOLDER%\modules\xSharePoint
    - ps: Get-ChildItem .\xSharePoint.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
        
Use PS to publish artifact
Use PS to publish artifact
