-
Notifications
You must be signed in to change notification settings - Fork 17
/
appveyor.yml
98 lines (79 loc) · 3.1 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
version: 1.1.{build}
branches:
only:
- master
image: WMF 5
init:
- ps: >-
# Only publish from ASOS repo
if ($env:APPVEYOR_REPO_NAME -eq "ASOS/OctopusStepTemplateCi") {
$env:Publish = "true"
# Only publish a new release if a tag (new version) is being built
$env:PublishRelease = $env:APPVEYOR_REPO_TAG
}
environment:
PowerShellGalleryApiKey:
secure: hpjzyINysy/YqCBScdQj3xfAoOxKx1fdfNJzmJb7wX0HPo0q0t+tIN7mOyTKGsnG
Publish: false
PublishRelease: false
install:
- ps: >-
cinst pester
cinst psget
build_script:
- ps: >-
$moduleFile = Resolve-Path '.\OctopusStepTemplateCi\OctopusStepTemplateCi.psd1'
Set-Content -Path $moduleFile -Value (Get-Content -Path $moduleFile | % {
if ($_.StartsWith('ModuleVersion')) { "ModuleVersion = '{0}'" -f $env:APPVEYOR_BUILD_VERSION }
else { $_ }
})
nuget.exe pack OctopusStepTemplateCi.nuspec -version $env:APPVEYOR_BUILD_VERSION -NoPackageAnalysis
$nupkg = "OctopusStepTemplateCi.{0}.nupkg" -f $env:APPVEYOR_BUILD_VERSION
Push-AppveyorArtifact (Resolve-Path $nupkg) -FileName $nupkg
test_script:
- ps: >-
$res = Invoke-Pester -Path ".\OctopusStepTemplateCi\Cmdlets" -OutputFormat NUnitXml -OutputFile TestsResults.xml -PassThru -CodeCoverage (Get-ChildItem -Path ".\OctopusStepTemplateCi\Cmdlets" -File -Recurse -Include "*.ps1" -Exclude "*.Tests.ps1" | % FullName)
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestsResults.xml))
if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed."}
$nupkg = Resolve-Path (".\OctopusStepTemplateCi.{0}.nupkg" -f $env:APPVEYOR_BUILD_VERSION)
Import-Module PsGet
PsGet\Install-Module -ModuleName OctopusStepTemplateCi -ModulePath $nupkg -Type ZIP -DoNotImport
# Try loading module to validate
Import-Module .\OctopusStepTemplateCi -Force -Verbose
artifacts:
- path: OctopusStepTemplateCi.%APPVEYOR_BUILD_VERSION%.nupkg
deploy:
- provider: GitHub
release: Rolling CI Build
description: Rolling CI build release
auth_token:
secure: zJghEg4jSFdkNek+BVf4xK75EhYaNNJxhfbkWQmqmGt3z/ESjO4LePGIm2R1LpI9
draft: false
prerelease: true
force_update: true
on:
branch: master
Publish: true
PublishRelease: true
- provider: GitHub
release: Release - $(APPVEYOR_REPO_TAG_NAME) - ($(APPVEYOR_BUILD_VERSION))
description: 'TODO: Enter description before publishing release'
auth_token:
secure: zJghEg4jSFdkNek+BVf4xK75EhYaNNJxhfbkWQmqmGt3z/ESjO4LePGIm2R1LpI9
draft: true
force_update: true
on:
branch: master
Publish: true
PublishRelease: true
after_deploy:
- ps: >-
if ($env:Publish -eq "true") {
Install-PackageProvider -Name NuGet -Force
Publish-Module -Path '.\OctopusStepTemplateCi' -NuGetApiKey $env:PowerShellGalleryApiKey -LicenseUri "http://www.apache.org/licenses/LICENSE-2.0.html"
}
on_failure:
- ps: >-
Get-ChildItem | Out-Host
$blockRdp = $true
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))