forked from dokan-dev/dokany
-
Notifications
You must be signed in to change notification settings - Fork 2
/
appveyor.yml
307 lines (265 loc) · 13.4 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
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
-
environment:
CoverityProjectToken:
secure: 1mtSEr5uFQI5rdwItPXrR1y4fV+SUWt55lUSQB5o3x8=
CoverityNotificationEmail:
secure: 0SPcT7MZEWl9NsqpKSOoLBCfqx/KVDAte5+xvbRremg=
AccessTokenDokanDoc:
secure: 1JpCwgUIFUddCeF/nvSRQxb309YpVnHvN/Sd5DLRQCQPTSv/YZVv7CspelmBGSua
global:
DOKAN_CI_CACHE: C:\dokan_ci_cache
CYG_CACHE: '%DOKAN_CI_CACHE%\cygwin'
MSYS2_CACHE: '%DOKAN_CI_CACHE%\msys2'
CHOCO_CACHE: '%DOKAN_CI_CACHE%\choco'
os: Visual Studio 2015
version: 1.0.1-{build}
configuration:
- All
- Coverity
- FsTest
platform:
- x64
cache:
- '%DOKAN_CI_CACHE% -> appveyor.yml'
# To debug build issues, add your own fork to AppVeyor and uncomment below.
# Connection details will be printed to the console output.
# $blockRdp makes the build block until a file is deleted from the desktop.
# init:
# - ps: Invoke-Expression (Invoke-WebRequest 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')
# on_finish:
# - ps: $blockRdp = $true; Invoke-Expression (Invoke-WebRequest 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')
install:
- ps: |
if ($env:CONFIGURATION -eq "FsTest") {
& Bcdedit.exe -set TESTSIGNING ON
& verifier /standard /driver dokan1.sys
Write-Host "Before reboot"
Start-Sleep -s 2
Restart-Computer
Start-Sleep -s 3600 # will reboot before this is finished and proceed with next build step
}
- ps: |
function Exec-External {
param(
[Parameter(Position=0,Mandatory=1)][scriptblock] $command
)
& $command
if ($LASTEXITCODE -ne 0) {
throw ("Command returned non-zero error-code ${LASTEXITCODE}: $command")
}
}
- ps: |
if ($env:CONFIGURATION -eq "All") {
Exec-External {& choco install "--cache-location=${env:CHOCO_CACHE}" doxygen.portable}
}
- ps: |
if ($env:CONFIGURATION -eq "All") {
function downloadIfOlderThanDays($url, $path, $days) {
if ( !(Test-Path $path -NewerThan (Get-Date).AddDays(-$days)) ) {
Write-Host "$path does not exist or is older than $days days, downloading from $url"
Invoke-WebRequest $url -OutFile $path
}
}
downloadIfOlderThanDays "https://cygwin.com/setup-x86.exe" "${env:DOKAN_CI_CACHE}\setup-x86.exe" 7
downloadIfOlderThanDays "https://cygwin.com/setup-x86_64.exe" "${env:DOKAN_CI_CACHE}\setup-x86_64.exe" 7
function updateCygwin($cygwinexe, $installFolder, $cacheFolder) {
Write-Host "Update Cygwin: $cygwinexe"
Exec-External {& cmd /c $cygwinexe -gqnNdO -R $installFolder -s http://mirrors.kernel.org/sourceware/cygwin/ -l $cacheFolder -P cmake -P make -P gcc-core -P gcc-g++}
Write-Host "Update Cygwin: $cygwinexe " -NoNewLine
Write-Host "[ OK ]" -ForegroundColor Green
}
updateCygwin "${env:DOKAN_CI_CACHE}\setup-x86.exe" C:/cygwin $env:CYG_CACHE
updateCygwin "${env:DOKAN_CI_CACHE}\setup-x86_64.exe" C:/cygwin64 $env:CYG_CACHE
}
- ps: |
if ($env:CONFIGURATION -eq "All") {
function bash($bash_command) {
Write-Host "MSYS2-Bash: $bash_command"
Exec-External {& C:\msys64\usr\bin\bash.exe --login -c $bash_command }
Write-Host "MSYS2-Bash $bash_command " -NoNewLine
Write-Host "[ OK ]" -ForegroundColor Green
}
New-Item -Force -Type Directory $env:MSYS2_CACHE
$unix_msys2_cache = (Exec-External {& C:\msys64\usr\bin\bash.exe --login -c "cygpath '${env:MSYS2_CACHE}'"})
# install latest pacman
bash "pacman -Sy --noconfirm --cache `"$unix_msys2_cache`" pacman pacman-mirrors"
# update core packages
bash "pacman -Syu --noconfirm --cache `"$unix_msys2_cache`""
# install MinGW toolchain
bash "pacman --sync --noconfirm --cache `"$unix_msys2_cache`" mingw-w64-{x86_64,i686}-toolchain mingw-w64-{x86_64,i686}-cmake"
}
before_build:
- ps: |
# checking for BSOD
$bugchecks = (Get-EventLog -LogName system | Where-Object {$_.eventID -eq '1001' -and $_.Source -eq 'BugCheck'} | Select-Object -Property *)
if ($bugchecks) {
Write-Host "It seems like we rebooted due to a bugcheck (BSOD)."
Format-List -InputObject $bugchecks | Out-String | Out-Host
$memdumpArchive = "memory_dmp_$(& git rev-parse --short HEAD)_${env:APPVEYOR_BUILD_VERSION}.7z"
Write-Host "Compressing MEMORY.DMP"
Exec-External { &7z a -t7z $memdumpArchive "$env:WINDIR\MEMORY.DMP" }
Push-AppveyorArtifact $memdumpArchive
Write-Host "MEMORY.DMP uploaded as build artifact $memdumpArchive"
Add-AppveyorMessage `
-Category Error `
-Message "BSOD encountered during $env:CONFIGURATION. Link to MEMORY.DMP in the description " `
-Details ("MEMORY.DMP is available here: " + `
"https://ci.appveyor.com/api/buildjobs/$([System.Web.HttpUtility]::UrlEncode($env:APPVEYOR_JOB_ID))/artifacts/$([System.Web.HttpUtility]::UrlEncode($memdumpArchive))")
throw "Build failed due to BSOD during $env:CONFIGURATION"
}
# Remove VS build warning http://help.appveyor.com/discussions/problems/4569-the-target-_convertpdbfiles-listed-in-a-beforetargets-attribute-at-c-does-not-exist-in-the-project-and-will-be-ignored
- del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
build_script:
- ps: |
Write-Host Start building...
$buildCmd = "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
function installDokanCert() {
Write-Host Install cert and sign...
.\cert\dokan-import.ps1
$env:CERTISSUER="DokanCA"
$env:ADDITIONALCERT="$pwd\cert\DokanCA.cer"
$env:SIGNTOOL="C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe"
Write-Host Dokan cert installed !
}
if ($env:CONFIGURATION -eq "Coverity") {
if (!"$env:CoverityProjectToken") {
Add-AppveyorMessage -Message "Not running Coverity due to missing credential. Is this a fork or a pull request?" -Category Information
return;
}
$buildArgs = @(
"/m",
"/l:C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll",
"/p:Configuration=Win10 Debug",
"/p:Platform=$env:PLATFORM")
Exec-External {& "cov-build.exe" `
--dir cov-int `
--encoding=UTF-8 `
$buildCmd $buildArgs}
Exec-External {nuget install -ExcludeVersion PublishCoverity}
Write-Host "Compressing Coverity results..."
Exec-External {& PublishCoverity\tools\PublishCoverity.exe compress `
--nologo `
-i "$env:APPVEYOR_BUILD_FOLDER\cov-int" `
-o "$env:APPVEYOR_BUILD_FOLDER\coverity.zip" `
--overwrite}
Write-Host "Uploading Coverity results..."
Exec-External {& PublishCoverity\tools\PublishCoverity.exe publish `
--nologo `
-t "$env:CoverityProjectToken" `
-e "$env:CoverityNotificationEmail" `
-r "dokan-dev/dokany" `
-z "coverity.zip" `
-d "Appveyor build." `
--codeVersion "$env:APPVEYOR_BUILD_VERSION"}
} elseif ($env:CONFIGURATION -eq "All") {
$env:Path = $env:Path + ";C:\Program Files (x86)\WiX Toolset v3.10;C:\Program Files (x86)\Windows Kits\8.1\bin\x64\"
installDokanCert
cd dokan_wix
$xmlversion = [xml](Get-Content ".\version.xml")
$current_build_version = $xmlversion.Include.define | Where { $_.StartsWith("BuildVersion=") }
$mm_version = $current_build_version.Split("=")[1] -replace '"','';
$mm_version = $mm_version.Substring(0, $mm_version.Length - $env:APPVEYOR_BUILD_NUMBER.Length - 1);
$mm_version += $env:APPVEYOR_BUILD_NUMBER;
(Get-Content ..\CHANGELOG.md) -replace '[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,4}', ($env:APPVEYOR_BUILD_VERSION.Split("-")[0] + '.' + $mm_version) | out-file "..\CHANGELOG.md"
$installer_version = $env:APPVEYOR_BUILD_VERSION.Split("-")[0] + '.' + $mm_version;
$Platform = "Any CPU"
$buildArgs = @(
"SetAssemblyVersion.sln",
"/m",
"/l:C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll",
"/p:Configuration=Release",
"/p:Platform=${Platform}")
& $buildCmd $buildArgs
& .\SetAssemblyVersion\bin\Release\SetAssemblyVersion ..\CHANGELOG.md version.xml ..\
cd ..
Exec-External {& .\build.bat}
.\cert\dokan-sign.ps1
cd dokan_wix
(gc version.xml) -replace 'BuildCygwin="false"', 'BuildCygwin="true"' | sc version.xml
(gc version.xml) -replace 'Compressed="no"', 'Compressed="yes"' | sc version.xml
$Platform = "Mixed Platforms"
$buildArgs = @(
"Dokan_WiX.sln",
"/m",
"/l:C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll",
"/p:Configuration=Release",
"/p:Platform=${Platform}")
Exec-External {& $buildCmd $buildArgs}
Write-Host Upload Artifact...
Push-AppveyorArtifact "${env:APPVEYOR_BUILD_FOLDER}\dokan_wix\Bootstrapper\bin\Release\DokanSetup.exe" -FileName ("DokanSetup-" + $installer_version + ".exe")
Write-Host Artifact uploaded!
} elseif ($env:CONFIGURATION -eq "FsTest") {
$env:Path = $env:Path + ";C:\Program Files (x86)\Windows Kits\8.1\bin\x64\"
$buildArgs = @(
"/m",
"/l:C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll",
"/p:Configuration=Win8.1 Release",
"/p:Platform=$env:PLATFORM")
& $buildCmd $buildArgs
$buildArgs = @(
"/m",
"/l:C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll",
"/p:Configuration=Release",
"/p:Platform=$env:PLATFORM")
& $buildCmd $buildArgs
installDokanCert
.\cert\dokan-sign.ps1
cp .\x64\Win8.1Release\dokan1.sys C:\Windows\System32\drivers\
Exec-External {& .\x64\Release\dokanctl.exe /i d}
Exec-External {& .\x64\Release\dokanctl.exe /i n}
cd .\samples
.\mirror_test.ps1
Exec-External {& verifier /query}
}
Write-Host Build Finished !
test: off
on_success:
- ps: |
# AppVeyor does not provide us with the SHA1 before the push
# Thus we have no baseline for pushes and can only run this for PRs
if ($env:CONFIGURATION -eq "All" -and $env:APPVEYOR_PULL_REQUEST_NUMBER) {
$parents = (Exec-External {& git rev-list --parents -n1 HEAD}).Split()
$head = $parents[0]
$mergeBranchHead = $parents[1]
$prBranchHead = $parents[2]
$diffFile = "clang_format_$(& git rev-parse --short $prBranchHead)_into_$(& git rev-parse --short $mergeBranchHead).diff"
Exec-External {& git clang-format --style=file --diff $mergeBranchHead} |
Select-String -NotMatch "^clang-format did not modify any files$" > $diffFile
if ((Get-Item $diffFile).length -gt 0) {
Write-Host "Ran git clang-format on PR, found changes, uploading as artifact"
Add-AppveyorMessage `
-Category Warning `
-Message "Please check your indentation." `
-Details ("You may want to run ``git clang-format --style file`` on each of your commits.`n" + `
"A diff of the suggested changes is available here:`n" + `
"https://ci.appveyor.com/api/buildjobs/$([System.Web.HttpUtility]::UrlEncode($env:APPVEYOR_JOB_ID))/artifacts/$([System.Web.HttpUtility]::UrlEncode($diffFile))")
Push-AppveyorArtifact $diffFile
}
else {
Write-Host "Ran git clang-format on PR, no changes necessary"
Add-AppveyorMessage `
-Category Information `
-Message "Your indentation is fine. clang-format did not suggest any changes."
}
}
- ps: |
if ($env:CONFIGURATION -eq "All") {
if (!$env:AccessTokenDokanDoc -or "$env:APPVEYOR_PULL_REQUEST_TITLE" -or "$env:APPVEYOR_REPO_BRANCH" -ne "master") {
return;
}
cd $env:APPVEYOR_BUILD_FOLDER\documentations
Exec-External {& git config --global user.email "appveyor@appveyor.org"}
Exec-External {& git config --global user.name "appveyor"}
Exec-External {& git clone -b gh-pages --single-branch https://$($env:AccessTokenDokanDoc)@github.com/dokan-dev/dokany-doc.git doc}
Exec-External {& doxygen Doxyfile}
cd doc
if ($(git status --porcelain)) {
Write-Host "Update documentation..." -ForegroundColor Green
Exec-External {& git add -A}
Exec-External {& git commit -m "Latest documentation on successful appveyor build $env:APPVEYOR_BUILD_VERSION auto-pushed to gh-pages"}
Exec-External {& git push -fq origin gh-pages}
Write-Host "Documentation updated!" -ForegroundColor Green
} else {
Write-Host "No documentation changes detected." -ForegroundColor Green
}
}