This repository has been archived by the owner on Jun 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
appveyor.yml
78 lines (61 loc) · 3.02 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
#---------------------------------#
# environment configuration #
#---------------------------------#
# This is necessary to use WMF5
os: WMF 5
version: 1.1.{build}.0
install:
- cinst -y pester
- git clone https://github.com/PowerShell/DscResource.Tests
- ps: Push-Location
- cd DscResource.Tests
- ps: Import-Module .\TestHelper.psm1 -force
- ps: Pop-Location
#---------------------------------#
# build configuration #
#---------------------------------#
build_script:
- ps: New-Item -Path "$Env:ProgramFiles\AppVeyor\BuildAgent\Modules\PackageManagementProviderResource" -ItemType Directory -Force
- ps: Copy-Item -Recurse "$env:APPVEYOR_BUILD_FOLDER\*" "$Env:ProgramFiles\AppVeyor\BuildAgent\Modules\PackageManagementProviderResource" -Force -Verbose
- ps: Get-Module PackageManagementProviderResource -ListAvailable
- ps: Write-Verbose -Verbose "$env:PSModulepath"
#---------------------------------#
# test configuration #
#---------------------------------#
test_script:
- ps: |
Push-Location
cd $env:APPVEYOR_BUILD_FOLDER
$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."
}
Pop-Location
#---------------------------------#
# deployment configuration #
#---------------------------------#
# scripts to run before deployment
deploy_script:
- ps: |
# Creating project artifact
$stagingDirectory = (Resolve-Path ..).Path
$manifest = Join-Path $pwd "PackageManagementProviderResource.psd1"
(Get-Content $manifest -Raw).Replace("1.8.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
$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-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -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 $_
}