mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-24 10:23:26 +08:00
caea515a93
I originally used `deploy_script:` section for publishing artifacts. This section is not invoked on Pull Requests. Hence, use `on_finish` section instead, so we can consume artifacts from PRs as well.
63 lines
2.8 KiB
YAML
63 lines
2.8 KiB
YAML
environment:
|
|
priv_key:
|
|
secure: <encryped-value>
|
|
|
|
notifications:
|
|
- provider: Slack
|
|
incoming_webhook:
|
|
secure: bwwXBTeJBtRFea6FSQKzVENLwL0AOeusUSUFIh/TeHA4y0UFk7bC9+OcxgZW+YfIC0VZyTpZClJHlPFFHSgiQs4g9om17RxzJEeq4EjsW5g=
|
|
|
|
install:
|
|
- ps: $fileContent = "-----BEGIN RSA PRIVATE KEY-----`n"
|
|
- ps: $fileContent += $env:priv_key.Replace(' ', "`n")
|
|
- ps: $fileContent += "`n-----END RSA PRIVATE KEY-----`n"
|
|
- ps: Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent
|
|
- git config --global url.git@github.com:.insteadOf https://github.com/
|
|
- git submodule update --init --recursive -- src/monad src/windows-build test/Pester
|
|
- ps: Invoke-WebRequest -Uri https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-win-x64.latest.zip -OutFile dotnet.zip
|
|
- 7z x dotnet.zip -odotnet > nul
|
|
|
|
build_script:
|
|
- ps: Set-Alias -Name dotnet -Value "$pwd\dotnet\bin\dotnet.exe"
|
|
- ps: dotnet restore
|
|
- ps: .\build.ps1
|
|
- ps: .\build.fullCLR.ps1
|
|
|
|
test_script:
|
|
- ps: |
|
|
# CoreCLR
|
|
$testResultsFile = ".\TestsResults.xml"
|
|
.\bin\powershell.exe --noprofile -c "Invoke-Pester test/powershell -OutputFormat NUnitXml -OutputFile $testResultsFile"
|
|
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
|
|
# For now we don't fail the build if these tests failed
|
|
#
|
|
# FullCLR
|
|
Import-Module .\PowerShellGithubDev.psm1
|
|
$testResultsFile = ".\TestsResults.FullCLR.xml"
|
|
Start-DevPSGithub -binDir $pwd\binFull -NoNewWindow -ArgumentList '-command', "Import-Module .\test\Pester; Invoke-Pester test/fullCLR -OutputFormat NUnitXml -OutputFile $testResultsFile"
|
|
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
|
|
# we want to fail the build, if these tests failed
|
|
$x = [xml](cat -raw .\TestsResults.FullCLR.xml)
|
|
if ([int]$x.'test-results'.failures -gt 0)
|
|
{
|
|
throw "$($x.'test-results'.failures) tests in test/fullCLR failed"
|
|
}
|
|
|
|
on_finish:
|
|
- ps: |
|
|
# Creating project artifact
|
|
$zipFilePath = Join-Path $pwd "$(Split-Path $pwd -Leaf).zip"
|
|
$zipFileFullPath = Join-Path $pwd "$(Split-Path $pwd -Leaf).FullCLR.zip"
|
|
Add-Type -assemblyname System.IO.Compression.FileSystem
|
|
[System.IO.Compression.ZipFile]::CreateFromDirectory("$pwd\bin", $zipFilePath)
|
|
[System.IO.Compression.ZipFile]::CreateFromDirectory("$pwd\binFull", $zipFileFullPath)
|
|
|
|
@(
|
|
# You can add other artifacts here
|
|
$zipFilePath,
|
|
$zipFileFullPath
|
|
) | % {
|
|
Write-Host "Pushing package $_ as Appveyor artifact"
|
|
Push-AppveyorArtifact $_
|
|
}
|