-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy path.appveyor.yml
More file actions
285 lines (261 loc) · 13.7 KB
/
Copy path.appveyor.yml
File metadata and controls
285 lines (261 loc) · 13.7 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# AU template: https://github.com/majkinetor/au-packages-template
version: '{build}'
pull_requests:
do_not_increment_build_number: true
max_jobs: 1
#build_cloud: V-10-MAYNV
image: Visual Studio 2022
# 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: tunisiano187/Chocolatey-packages
github_api_key:
secure: k80gVFMer6/9wd07GMUlUXKjJx0iLLAlENh1RoBB9vMbpD/OZCA3aWPiZpsW3HYk52D/3qDcWCZRWjH9SFklaDBEkX6fl/oOpAOwUcz2auuSAdVtg0WO1VZqCdw/5ukT
# Gitter Integration
gitter_webhook:
secure: SuvLP4KrBXFvRRG7tcBiTUJvh8urQl3gOu4WYjLO9ZEXX0wZB3CwmIx1VnoA4I009yKsuPdPZ1P6NTuE7Vt9Cg==
# Hash
hash_algo: sha256
# VT API Key
VT_APIKEY:
secure: L/54pv851SIun4fRQsrx3kbmvBjuPRYE0bwuH/tDwSZCDbqSsHFE2udKIXnGLNL9AFRz9bBLJmVPUqXabn3tBqO45DJpCq0XjUSDDseoBCg=
# Mail credentials - for error notifications
mail_user: helpdesk.choc@gmail.com
mail_pass:
secure: g3q4/u5581iqgaHEOXANHdd+AGhRVUT8osLi+AmmNdQ=
mail_server: smtp.gmail.com
mail_port: 587
mail_enablessl: $true
#ID of the gist used to save run results
gist_id: 7032dea203873812b435f152ee3794bf
#ID of the gist used to save test run results
gist_id_test: 90d63f6b99678e483a3669aaf2b51a1f
#Chocolatey API key - to push updated packages
api_key:
secure: aXQkG8BvsO7/zFDzAb7ADCdvottWbXf1sRoC34DUk9RIvzOiIdjprfw39CvNT4WK
#Chocolatey version we want to use when checking for updates (usually latest).
choco_version: '2.4.3'
choco_version_pr: '2.4.0' # Should be kept to the version available one year ago
nupkg_cache_path: C:\packages
#Gitlab informations
gitlab_user: tunisiano187 # GitLab username to use for the push
gitlab_api_key:
secure: o13URdKLLBlzgwn/CDQc8UMLnsiOEw/hIMmO3SdxvuM=
# GitLab API key associated with gitlab_user
gitlab_PushURL: https://gitlab.com/chocolatey-packages/automatic-updating.git # GitLab URL to push to. Must be HTTP or HTTPS. e.g. https://git.example.org/jekotia/au.git
gitlab_commit_strategy: atomictag
init:
- git config --global user.email "helpdesk.choc@gmail.com"
- git config --global user.name "tunisiano187"
- 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")) { $firstrun = "yes" }
if (!(Test-Path "$env:nupkg_cache_path")) { mkdir -Force "$env:nupkg_cache_path" }
$pkgs = New-Object 'System.Collections.Specialized.OrderedDictionary'
$pkgs.Add('chocolatey', $chocoVersion)
$pkgs.Add('chocolatey-core.extension', '1.4.0')
$pkgs.Add('7zip.install', '24.7.0')
$pkgs.Add('chocolatey-misc-helpers.extension', '0.0.4')
$pkgs.Add('wormies-au-helpers', '0.4.1')
$pkgs.Add('checksum', '0.3.1')
$pkgs.Add('keepass.install', '2.57.0')
$pkgs.Add('vt-cli', '1.0.0')
$pkgs.Add('autohotkey', '1.1.37.1')
$pkgs.Add('pngquant', '3.0.3')
$pkgs.Add('jpegoptim', '1.5.5.1')
$pkgs.GetEnumerator() | % {
if (!(Test-Path "${env:nupkg_cache_path}\$($_.Key).$($_.Value).nupkg")) { rm "${env:nupkg_cache_path}\$($_.Key).*.nupkg" ; iwr "https://chocolatey.org/api/v2/package/$($_.Key)/$($_.Value)" -OutFile "${env:nupkg_cache_path}\$($_.Key).$($_.Value).nupkg" }
if ($_.Key -eq 'chocolatey') { choco upgrade $_.Key --version $_.Value --source ${env:nupkg_cache_path} --allow-downgrade --pre }
else { choco install -y $_.Key --version $_.Value --source ${env:nupkg_cache_path} --ignore-dependencies }
}
choco upgrade -y chocolatey
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/chocolatey-community/chocolatey-au.git $Env:TEMP/au
Install-Module chocolatey-au
install-module Wormies-AU-Helpers -Force
Copy-Item setup/AU $Env:TEMP/au/AU -Recurse -Force
Copy-Item setup/build.ps1 -Destination $Env:TEMP/au/ -Force
#. "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version
import-module ".\scripts\au_extensions.psm1"
- 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'
Write-Host "Installing requisites"
setup/requisites.ps1
. ./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 '')) {
Start-Job -ScriptBlock { 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
# Only pack/push if update.ps1 actually bumped the nuspec version. Packages
# with an embedded installer (Install-ChocolateyPackage -File) only have the
# binary on disk after au_BeforeUpdate genuinely downloads it as part of a
# real update -- a bare git checkout never has it (it's never committed).
# Packing unconditionally after a no-op update.ps1 run (e.g. a commit that
# only touches the nuspec description or icon URL, no version change) would
# silently repackage that bare checkout and push a nupkg missing the
# installer. Confirmed live: this exact thing happened to `osfmount` after a
# icon-only commit -- AU logged "Updated: False, Pushed: False" and this loop
# packed and pushed anyway.
$versionBefore = if (Test-Path "$package.nuspec" -ea 0) { (Select-String -Path "$package.nuspec" -Pattern '<version>.*</version>' -ea 0).Line }
if (Test-Path update.ps1 -ea 0) { ./update.ps1 }
$versionAfter = if (Test-Path "$package.nuspec" -ea 0) { (Select-String -Path "$package.nuspec" -Pattern '<version>.*</version>' -ea 0).Line }
if ($versionBefore -ne $versionAfter) {
choco pack; Push-Package -All;
} else {
Write-Host "No version change for $package after update.ps1 -- skipping choco pack/push"
}
popd
}
return
}
}
# Anchored to the start of the line (ignoring leading whitespace) so this only matches real
# `git log --stat` diffstat lines (e.g. " automatic/freeplane/update.ps1 | 28 ++--"), not
# commit-message prose that happens to contain "automatic" as a substring (e.g. "...picks
# this up automatically."), which used to be split into bogus package name tokens.
$lastupdated=git log -1 --stat | Where-Object {$_ -match "^\s*automatic/"} | Where-Object {$_ -notmatch "'automatic"}
if($lastupdated.Count -ne 0 -and ($Env:APPVEYOR_SCHEDULED_BUILD -ne 'true')) {
$Env:au_Push = "false"
$packages = $lastupdated.split('/').split(' ')
Write-Host "PUSHING PACKAGES: $packages"
foreach ($line in $packages) {
$package = $line.split(' ')
if($package -ne 'automatic' -AND $package -notmatch '\+' -AND $package -notmatch '^\-' -AND $package -notmatch 'update\.ps1') {
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
# See the matching comment in the [PUSH ...] handler above: only pack/push if
# update.ps1 actually bumped the nuspec version, so a no-op run (e.g. a commit
# that only touches the nuspec description or icon URL) doesn't silently
# repackage a bare git checkout that's missing any embedded-installer binary
# (those only exist on disk after a genuine au_BeforeUpdate download).
$versionBefore = if (Test-Path "$package.nuspec" -ea 0) { (Select-String -Path "$package.nuspec" -Pattern '<version>.*</version>' -ea 0).Line }
if (Test-Path update.ps1 -ea 0) { ./update.ps1 }
$versionAfter = if (Test-Path "$package.nuspec" -ea 0) { (Select-String -Path "$package.nuspec" -Pattern '<version>.*</version>' -ea 0).Line }
if ($versionBefore -ne $versionAfter) {
choco pack; Push-Package -All;
} else {
Write-Host "No version change for $package after update.ps1 -- skipping choco pack/push"
}
popd
}
}
return
} else {
write-host "None Forced"
}
}
#git remote set-url origin https://$($env:gitlab_user):$($env:gitlab_api_key)@gitlab.com/chocolatey-packages/automatic-updating.git
git remote set-url origin https://$($env:github_api_key)@github.com/tunisiano187/Chocolatey-packages.git
git config --global user.email "helpdesk.choc@gmail.com"
git config --global user.name "tunisiano187"
git checkout master
cd scripts
Import-Module .\au_extensions.psm1
cd ..
$moduleWormiesPath = "$Env:ProgramFiles\WindowsPowerShell\Modules\Wormies-AU-Helpers\public\Update-Metadata.ps1"
$moduleWormiesPath = Resolve-Path $moduleWormiesPath
Copy-Item scripts/Update-Metadata.ps1 $moduleWormiesPath
Write-Host "Checking nuspec errors"
scripts/Find-NuspecError.ps1
git commit -am "Nuspec errors"
Write-Host "updating packageSourceUrl"
scripts/Update-PackageSourceUrl.ps1 -GithubRepository "tunisiano187/Chocolatey-packages" -UseStopwatch
git commit -am "PackageSourceUrl"
Write-Host "updating variables in ps1"
scripts/Update-Variables.ps1
git commit -am "ps1 vars"
Write-Host "updating IconUrl in nuspec"
scripts/Update-IconUrl.ps1 -Quiet -GithubRepository "tunisiano187/Chocolatey-packages" -UseStopwatch
git commit -am "Updating icons"
Write-Host "updating owners in nuspec"
import-module Wormies-AU-Helpers
$nuspec=Get-ChildItem ./*.nuspec -Recurse; foreach ($file in $nuspec) { Update-Metadata -key owners -value "tunisiano" -NuspecFile $file.FullName }
git commit -am "Updating owner"
Write-Host "Updating Packages.md"
scripts/ListPackages.ps1
git commit -am "List packages"
Write-host "Check broken package"
#tools/looknewer.ps1
git commit -am "Broken packages"
Write-host "Remove NoCheckChocoVersion"
scripts/Remove-Nocheck.ps1
git commit -am "Remove NoCheckChocoVersion"
git pull
git push
Write-Host "updating packages"
if ($firstrun -ne 'yes') { au/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 $_ }
Remove-Item -Path $env:TEMP -Recurse -Force -ErrorAction SilentlyContinue
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
notifications:
- provider: Email
to: $(mail_user)
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}}"
#- provider: Webhook
# url: https://webhooks.gitter.im/e/e7cfeb1b6fc707cee118
# on_build_success: true
# on_build_failure: true
# on_build_status_changed: true
cache:
- '%nupkg_cache_path% -> .appveyor.yml'