-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
81 lines (70 loc) · 3 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
# See http://www.appveyor.com/docs/appveyor-yml for many more options
# Skip on updates to the readme.
# We can force this by adding [skip ci] or [ci skip] anywhere in commit message
skip_commits:
message: /updated readme.*|update readme.*s/
#---------------------------------#
# environment configuration #
#---------------------------------#
version: '1.0.{build}'
os: WMF 5
pull_requests:
do_not_increment_build_number: true
environment:
my_secvariable:
secure: exKd6wdRVbZTS5qJV/Lkvr/NcaVHK6paUkVAjTWyT4AAlcB7pMLOi9gZfscByrA7
install:
- ps: |
$VerbosePreference = 'SilentlyContinue'
$env:psmodulepath = $env:psmodulepath + ';' + 'C:\projects'
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name Pester -Repository PSGallery -Force
#---------------------------------#
# build configuration #
#---------------------------------#
build: false
#---------------------------------#
# test configuration #
#---------------------------------#
test_script:
- ps: $res = Invoke-Pester -Path '.\Tests' -OutputFormat NUnitXml -OutputFile TestsResults.xml -PassThru
- ps: (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestsResults.xml))
- ps: if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed."}
#---------------------------------#
# deployment configuration #
#---------------------------------#
# scripts to run before deployment
deploy_script:
- ps: |
Write-Verbose -Message 'Creating project artifact' -Verbose
$stagingDirectory = (Resolve-Path -Path ..).Path
$manifest = Join-Path -Path $pwd -ChildPath '*.psd1' -Resolve
Update-ModuleManifest -path $manifest -ModuleVersion $env:APPVEYOR_BUILD_VERSION
$zipFilePath = Join-Path -Path $stagingDirectory -ChildPath "$env:APPVEYOR_PROJECT_NAME-$env:APPVEYOR_BUILD_VERSION.zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath)
@(
# You can add other artifacts here
$zipFilePath
) | ForEach-Object -Process {
Write-Verbose -Message "Pushing package $_ as Appveyor artifact" -Verbose
Push-AppveyorArtifact $_
}
if($Env:APPVEYOR_REPO_TAG -eq 'true')
{
if(Get-Command -Name Get-PackageProvider -ErrorAction SilentlyContinue)
{
Get-PackageProvider -Name NuGet -ForceBootstrap
$module = Join-Path -Path $pwd -ChildPath '\DSCResources\*\*.psm1' -Resolve
Import-Module $module
Publish-Module -Name $env:APPVEYOR_PROJECT_NAME -NuGetApiKey $env:my_secvariable
}
else
{
Write-Verbose -Message 'PSGallery not supported' -Verbose
}
}
else
{
Write-Verbose -Message 'Commit is not a tag, skipping deploy!' -Verbose
}