forked from mkevenaar/chocolatey-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.appveyor.yml
156 lines (139 loc) · 6.31 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# AU template: https://github.com/majkinetor/au-packages-template
version: '{build}'
pull_requests:
do_not_increment_build_number: true
max_jobs: 1
image: Visual Studio 2017
# History plugin requires complete log
#clone_depth: 5
branches:
only:
- master
#build:
# verbosity: minimal
environment:
# Set au version to use or omit to use the latest. Specify branch name to use development version from Github
au_version: master
au_push: true
# Use 1 to test all, or N to split testing into N groups
au_test_groups: 4
# Github token to commit pushed packages to repository
github_user_repo: mkevenaar/chocolatey-packages
github_api_key:
secure: 7oV5GC2DtX+5pFTHz3FnHijMV1LNjHyiyH/oUsVw9dMPh6r3AImgahHCbtHT+/d7
# VT API Key
VT_APIKEY:
secure: MEUgRkA5U5KH8U9bfV6IvExA1QgTPDp57sCslnXDtri0n8qbaVcwThsxKeLQPjjRDE5urfec5xsspKd4lqD62DVAxPJMfwWmpGsgy6OCBgY
# Mail credentials - for error notifications
mail_user:
secure: C63MvLXNIMEeED8LB4SNzyIiCS7ZVtviDbeSYIUlTqw=
mail_pass:
secure: VXGNYEqh1p/j5pO+qr83+A==
mail_server:
secure: GNiWz1x2PgXg54QO7xmVziamgDCJlvPL0NKBXh8WhQI=
mail_port: 587
mail_enablessl: true
#ID of the gist used to save run results
gist_id: 675e3f672bda54270f8d7f5415f9374d
#ID of the gist used to save test run results
gist_id_test: 7ca34bddbf76f8ae30a1573e7474e1aa
#Chocolatey API key - to push updated packages
api_key:
secure: qkGqdhoPE+AUlbq/DmMV9jvUGmBj5/oRAP6ndRbAxeMi2shb7xwMMxR07pwG0O6B # https://ci.appveyor.com/tools/encrypt
#Chocolatey version we want to use when checking for updates.
choco_version: '1.1.0'
choco_version_pr: '0.11.3' # Should be kept to the version available one year ago
nupkg_cache_path: C:\packages
init:
- git config --global user.email "[email protected]"
- git config --global user.name "Maurice Kevenaar"
- git config --global core.safecrlf false
install:
- ps: |
$chocoVersion = if (($Env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null) -or ($ENV:APPVEYOR_PULL_REQUEST_NUMBER -eq '')) { $Env:choco_version } else { $Env:choco_version_pr }
if (!(Test-Path "$env:nupkg_cache_path")) { mkdir -Force "$env:nupkg_cache_path" }
@{
'chocolatey' = $chocoVersion
'wormies-au-helpers' = '0.4.1'
'chocolatey-compatibility.extension' = '1.0.0'
'chocolatey-core.extension' = '1.4.0'
'autohotkey.portable' = '1.1.34.03'
'vt-cli' = '0.10.3'
}.GetEnumerator() | % {
if (!(Test-Path "${env:nupkg_cache_path}\$($_.Key).$($_.Value).nupkg")) { rm "${env:nupkg_cache_path}\$($_.Key).*.nupkg" ; Invoke-WebRequest "https://chocolatey.org/api/v2/package/$($_.Key)/$($_.Value)" -OutFile "${env:nupkg_cache_path}\$($_.Key).$($_.Value).nupkg" }
if ($_.Key -eq 'chocolatey') { cup $_.Key --version $_.Value --source "'${env:nupkg_cache_path};http://chocolatey.org/api/v2/'" --allow-downgrade }
else { cinst $_.Key --version $_.Value --source "'${env:nupkg_cache_path};http://chocolatey.org/api/v2/'" --ignore-dependencies }
}
rm "$env:ChocolateyInstall\logs\*.log"
- ps: 'Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version'
- ps: $PSVersionTable
- git --version
- choco --version
- ps: |
git clone -q https://github.com/majkinetor/au.git $Env:TEMP/au
. "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version
- ps: |
"Build info"
' {0,-20} {1}' -f 'SCHEDULED BUILD:', ($Env:APPVEYOR_SCHEDULED_BUILD -eq 'true')
' {0,-20} {1}' -f 'FORCED BUILD:' , ($Env:APPVEYOR_FORCED_BUILD -eq 'true')
' {0,-20} {1}' -f 'RE BUILD:' , ($Env:APPVEYOR_RE_BUILD -eq 'true')
build_script:
- ps: |
$ErrorActionPreference = 'Continue'
. ./scripts/EventLogs.ps1
Clear-EventLogs
if ($Env:APPVEYOR_PROJECT_NAME -like '*test*') { ./test_all.ps1 "random $Env:au_test_groups"; return }
if (($Env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -ne '')) {
Set-Service wuauserv -StartupType Manual
./scripts/Test-RepoPackage.ps1 -CleanFiles -TakeScreenshots
return
} else {
# Clean the choco logs as it's quite large
rm "$env:ChocolateyInstall\logs\*.log"
}
if ( ($Env:APPVEYOR_SCHEDULED_BUILD -ne 'true') -and ($Env:APPVEYOR_FORCED_BUILD -ne 'true') ) {
switch -regex ($Env:APPVEYOR_REPO_COMMIT_MESSAGE)
{
'\[AU (.+?)\]' { $forced = $Matches[1] }
'\[PUSH (.+?)\]' {
$packages = $Matches[1] -split ' '
Write-Host "PUSHING PACKAGES: $packages"
foreach ($package in $packages) {
Write-Host ("{0}`n{1}`n" -f ('-'*60), "PACKAGE: $package")
$package_dir = ls -recurse | ? { $_.Name -eq "$package.nuspec"} | select -First 1 | % Directory
if (!$package_dir) { Write-Warning "Can't find package '$package'"; continue }
pushd $package_dir
if (Test-Path update.ps1 -ea 0) { ./update.ps1 }
choco pack; Push-Package -All;
popd
}
return
}
}
}
./update_all.ps1 -ForcedPackages $forced
Get-EventLogs * | ? Source -eq 'Schannel' | fl * | out-file eventlogs.txt
on_finish:
- ps: |
if (Test-Path $Env:TEMP\chocolatey\au) { 7z a -mx9 au_temp.7z $Env:TEMP\chocolatey\au\* }
$paths = @(
Resolve-Path "$env:TEMP\artifacts\*" -ea 0
Resolve-Path "$env:ChocolateyInstall\logs\*.log" -ea 0
'au_temp.7z'
'update_info.xml'
'Update-AUPackages.md'
'Update-History.md'
'eventlogs.txt'
)
$paths | ? { Test-Path $_ } | % { Push-AppveyorArtifact $_ }
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
notifications:
- provider: Email
on_build_success: false
on_build_failure: true
on_build_status_changed: true
- provider: GitHubPullRequest
template: "{{#passed}}:white_check_mark: Package verification completed without issues. PR is now pending human review{{/passed}}{{#failed}}:x: Package verification failed, please review the [Appveyor Logs]({{buildUrl}}) and the provided [Artifacts]({{buildUrl}}/artifacts) before requesting a human reviewer to take a look.{{/failed}}"
cache:
- '%nupkg_cache_path% -> .appveyor.yml'