-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
130 lines (106 loc) · 5.08 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#---------------------------------#
# environment configuration #
#---------------------------------#
os: WMF 5
environment:
powershellgallery_api_token:
secure: +e4nc0IUMbnSjiaFaWwjb00GGYhkQnxxN09gsbTrn/qZ90vOsLoDlKdZiqCRASWr
powershellgalleryinternal_api_token:
secure: qH5skGAL0hSzcNxTYw9CQPNc8kKPWMe9pHC564sdzmVczWtEZ63rMYzAtHsz4eAK
encryption_test:
secure: rfVlKqBW/+KYbxwKzf6PUg==
install:
- cinst -y pester
- git clone https://github.com/KarolKaczmarek/AppVeyorSampleHelper
- ps: Push-Location
- cd AppVeyorSampleHelper
- ps: Import-Module .\TestHelper.psm1 -force
- ps: Pop-Location
#---------------------------------#
# build configuration #
#---------------------------------#
build: false
#---------------------------------#
# test configuration #
#---------------------------------#
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."
}
#---------------------------------#
# artifacts configuration #
#---------------------------------#
artifacts:
- path: lib
name: lib
type: zip
#---------------------------------#
# deployment configuration #
#---------------------------------#
# Script to run during the deployment
deploy_script:
- ps: |
# Publish to PowerShell Gallery on tag
Write-Host "Starting the deployment. Tag value is: $env:APPVEYOR_REPO_TAG_NAME";
if ($env:APPVEYOR_REPO_TAG_NAME -like "*-PSGallery")
{
Find-Package -Name SomeSamplePackage123 -ErrorAction Ignore -ForceBootstrap;
# Register internal PS Gallery repository (this is for testing purposes only, please use powershellgallery.com)
Write-Host "Register internal PSGallery repository"
Register-PSRepository -Name InternalPSGallery -SourceLocation https://dtlgalleryint.cloudapp.net/api/v2 -PublishLocation https://dtlgalleryint.cloudapp.net/api/v2/package/
$projectUri = "https://github.com/KarolKaczmarek/$env:APPVEYOR_PROJECT_NAME"
$licenseUri = "https://github.com/KarolKaczmarek/$env:APPVEYOR_PROJECT_NAME/blob/master/LICENSE"
$tag = 'AutoDeployed'
Write-Host "Publishing $env:APPVEYOR_PROJECT_NAME to PowerShellGallery"
Publish-Module -Path $env:APPVEYOR_BUILD_FOLDER -ProjectUri $projectUri -LicenseUri $licenseUri -Tag $tag -NuGetApiKey $env:powershellgalleryinternal_api_token -Repository InternalPSGallery -verbose
}
# Creating project artifact
$stagingDirectory = (Resolve-Path ..).Path
$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-Item nuget -ItemType Directory > $null
New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "MS" -owners "MS" -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 $_
}
# TODO remove after testing
Write-Host "APPVEYOR_REPO_TAG = $env:APPVEYOR_REPO_TAG; APPVEYOR_BUILD_FOLDER = $env:APPVEYOR_BUILD_FOLDER; PWD = $pwd"
deploy:
# Deploying to GitHub
# - provider: GitHub
# release: $(appveyor_project_name)-v$(appveyor_build_version)
# description: Release of $(appveyor_project_name)-v$(appveyor_build_version)
# tag: $(appveyor_project_name)-v$(appveyor_build_version)
# auth_token:
# secure: ++aemfGy5WMYfJLgZvP7ox7UwfNzn4uwIIFoobB1MEzewjMjl29oW0m98Fnz/NKb
# draft: false
# prerelease: false
# on:
# #branch: dev
# # Determines whether to deploy only on regular commits or commits with tags
# appveyor_repo_tag: false
# Deploying to NuGet
# - provider: NuGet
# server: https://ci.appveyor.com/nuget/karol-neqk5nffsnll
# api_key:
# secure: V4vwOTsPWWwWasVZPVTY949Fuc93lffGRT2UAfz28wM=
# skip_symbols: true
# on:
# appveyor_repo_tag: false
#---------------------------------#
# global handlers #
#---------------------------------#