]> git.zerfleddert.de Git - proxmark3-svn/blame - CI/appveyor.yml
Update CHANGELOG.md
[proxmark3-svn] / CI / appveyor.yml
CommitLineData
ef9746cb
OM
1version: 3.0.1.{build}
2image: Visual Studio 2017
3clone_folder: C:\ProxSpace\pm3
4init:
9764d3ea 5- ps: >-
6 $psversiontable
7
8 #Get-ChildItem Env:
9
10
11 $releasename=""
12
13 $env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)
14
15 if ($env:appveyor_repo_tag -match "true"){
16 $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
17 }
18
19 $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT_SHORT + "]"
20
21
22 Write-Host "repository: $env:appveyor_repo_name branch:$env:APPVEYOR_REPO_BRANCH release: $releasename" -ForegroundColor Yellow
23
24 Add-AppveyorMessage -Message "[$env:APPVEYOR_REPO_COMMIT_SHORT]$env:appveyor_repo_name($env:APPVEYOR_REPO_BRANCH)" -Category Information -Details "repository: $env:appveyor_repo_name branch: $env:APPVEYOR_REPO_BRANCH release: $releasename"
25
26
27 iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
ef9746cb
OM
28clone_script:
29- ps: >-
30 Write-Host "Removing ProxSpace..." -NoNewLine
31
32 cd \
33
34 Remove-Item -Recurse -Force -Path c:\ProxSpace\*
35
36 Write-Host "[ OK ]" -ForegroundColor Green
37
38
39 Write-Host "Git clone ProxSpace..." -NoNewLine
40
41 git clone -q https://github.com/Gator96100/ProxSpace c:\ProxSpace
42
43 Write-Host "[ OK ]" -ForegroundColor Green
44
45
46 Write-Host "Removing pm3 dir..." -NoNewLine
47
48 Remove-Item -Recurse -Force -Path c:\ProxSpace\pm3\*
49
50 Write-Host "[ OK ]" -ForegroundColor Green
51
52
53 Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine
54
55 if(-not $env:appveyor_pull_request_number) {
56 git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder
57 cd $env:appveyor_build_folder
58 git checkout -qf $env:appveyor_repo_commit
59 } else {
60 git clone -q https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder
61 cd $env:appveyor_build_folder
62 git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge:
63 git checkout -qf FETCH_HEAD
64 }
65
66 Write-Host "[ OK ]" -ForegroundColor Green
67
68
666fa6e1 69 Write-Host "Fill msys2\etc\fstab file..." -NoNewLine
ef9746cb 70
666fa6e1
OM
71 New-Item c:\ProxSpace\msys2\etc\fstab -type file -force -value "# For a description of the file format, see the Users Guide`n# http://cygwin.com/cygwin-ug-net/using.html#mount-table`nnone / cygdrive binary,posix=0,noacl,user 0 0 `nC:\ProxSpace\pm3 /pm3 ntfs noacl 0 0 `nC:\ProxSpace\gcc-arm-none-eabi /gcc-arm-none-eabi ntfs noacl 0 0 `n"
72
73 Write-Host "[ OK ]" -ForegroundColor Green
74
75
76 Write-Host "Update msys2 packages..." -NoNewLine
77
78 $env:Path = "C:\ProxSpace\msys2\usr\bin;C:\ProxSpace\msys2\mingw32\bin;C:\ProxSpace\gcc-arm-none-eabi\bin;$env:Path"
79
80 C:\ProxSpace\msys2\msys2_shell.cmd -mingw32 -defterm -no-start /dev/null 1> msys1.txt 2>&1
81
82 C:\ProxSpace\msys2\msys2_shell.cmd -mingw32 -defterm -no-start /dev/null 1> msys1.txt 2>&1
ef9746cb
OM
83
84 Write-Host "[ OK ]" -ForegroundColor Green
85install:
86- ps: >-
87 function Exec-External {
88 param(
89 [Parameter(Position=0,Mandatory=1)][scriptblock] $command
90 )
91 & $command
92 if ($LASTEXITCODE -ne 0) {
93 throw ("Command returned non-zero error-code ${LASTEXITCODE}: $command")
94 }
95 }
96build_script:
9764d3ea 97- ps: >-
666fa6e1
OM
98 "C:\ProxSpace\msys2\usr\bin;C:\ProxSpace\msys2\mingw32\bin;C:\ProxSpace\gcc-arm-none-eabi\bin;$env:Path"
99
100
101 $env:MINGW_HOME="C:\ProxSpace\msys2\mingw32"
102
103 $env:MSYS_HOME="C:\ProxSpace\msys2"
104
105 $env:MSYSTEM="MINGW32"
106
107 $env:MINGW_PREFIX="/mingw32"
108
109 $env:SHELL="/bin/bash"
110
111 $env:MSYSTEM_CHOST="i686-w64-mingw32"
9764d3ea 112
113
114 #make
115
666fa6e1 116 bash -c -i 'pwd;make clean;make all'
9764d3ea 117
118
119 #some checks
120
121 if(!(Test-Path C:\ProxSpace\pm3\client\proxmark3.exe)){
122
123 throw "Main file proxmark3.exe not exists."
124
125 }
126
127 if(!(Test-Path C:\ProxSpace\pm3\armsrc\obj\fullimage.elf)){
128
129 throw "ARM file fullimage.elf not exists."
130
131 }
132
133 if(!(Test-Path C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z)){
134
135 throw "Files in hardnested\tables not exists."
136
137 }
138
139
140 #copy
141
142 Write-Host "Copy release files..." -NoNewLine -ForegroundColor Yellow
143
144 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release
145
146 Copy-Item C:\ProxSpace\pm3\client\*.exe C:\ProxSpace\Release
147
148 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\arm
149
150 Copy-Item C:\ProxSpace\pm3\armsrc\obj\*.elf C:\ProxSpace\Release\arm
151
152 Copy-Item C:\ProxSpace\pm3\bootrom\obj\*.elf C:\ProxSpace\Release\arm
153
154 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\scripts
155
156 Copy-Item C:\ProxSpace\pm3\client\scripts\*.lua C:\ProxSpace\Release\scripts
157
158 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\hardnested\tables
159
160 Copy-Item C:\ProxSpace\pm3\client\hardnested\*.bin C:\ProxSpace\Release\hardnested
161
162 Copy-Item C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z C:\ProxSpace\Release\hardnested\tables
163
164 Write-Host "[ OK ]" -ForegroundColor Green
165
166
167 #archive and push
168
169 $releasename=""
170
171 if ($env:appveyor_repo_tag -match "true"){
172
173 $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
174
175 }
176
177 $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) + "]"
178
179
180 Write-Host "Archive and publish release files ($releasename)..." -NoNewLine -ForegroundColor Yellow
181
182 cd C:\ProxSpace
183
184 7z a release.zip C:\ProxSpace\Release
185
186 Push-AppveyorArtifact release.zip -DeploymentName "$releasename"
187
188 Write-Host "[ OK ]" -ForegroundColor Green
189
190
191 Write-Host "Builded..." -ForegroundColor Yellow
ef9746cb 192test_script:
9764d3ea 193- ps: >-
194 $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
195
196 cd c:\ProxSpace\pm3
197
198
199 $global:TestsPassed=$true
200
201
fefb7f53 202 Function ExecTest($Name, $File, $Cmd, $CheckResult) {
9764d3ea 203
204 #--- begin Job
205
206 $Job = Start-Job -ScriptBlock {
207 [bool]$res=$false
208 $TestTime=[System.Environment]::TickCount
209 $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
210 Set-Location $using:PWD
211
212 $sb=[scriptblock]::Create("$using:Cmd")
213 #execute scriptblock
b5381d70 214 Write-host "Test [$using:Name] job: $using:Cmd"
9764d3ea 215 $Cond=&$sb
216
217 if ($Cond -eq $null){
fefb7f53
OM
218 } ElseIf($using:CheckResult -ne $null) {
219 [String]$searchstr=""
220 if ($Cond -is [Object]){
221 ForEach($line in $Cond){
222 Write-host $line -ForegroundColor Gray
223 $searchstr += $line
224 }
225 }else{
226 Write-host "$Cond" -ForegroundColor Gray
227 $searchstr = $Cond
228 }
229 If($searchstr -like "*$using:CheckResult*") {
230 $res=$true
231 }
232 $Cond="*$using:CheckResult*"
9764d3ea 233 } Else {
234 If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){
235 if ($Cond -is "String" -and $Cond -like "*passed*"){
236 $res= $true
237 }
238 if ($Cond -is "String" -and $Cond -like "*true*"){
239 $res= $true
240 }
241 } Else {
242 $res=$Cond
243 }
244 }
245
246 If ($res) {
5d7d0c3a 247 Write-host "Result[$using:Name]: $Cond" -ForegroundColor Green
9764d3ea 248 Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
249 }Else {
5d7d0c3a 250 Write-host "Result[$using:Name]: $Cond" -ForegroundColor Red
9764d3ea 251 Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" -ErrorMessage "command:$using:Cmd`nresult:$Cond"
252 }
253 return $res
254 }
255
256 #--- end Job
257
258 [bool]$res=$false
82827950 259 # Wait 120 sec timeout for Job
cdc9a756 260 if(Wait-Job $Job -Timeout 150){
9764d3ea 261 $Results = $Job | Receive-Job
262 if($Results -like "true"){
263 $res=$true
264 }
265 } else {
b5381d70 266 Write-host "Test [$Name] timeout" -ForegroundColor Red
cdc9a756 267 Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Failed -Duration 60000 -ErrorMessage "timeout"
9764d3ea 268 }
269 Remove-Job -Force $Job
270
271 if(!$res){
272 $global:TestsPassed=$false
273 }
274 }
275
276
277 Write-Host "Running tests..." -ForegroundColor Yellow
278
279
280 #file test
281
282 ExecTest "proxmark3 exists" "proxmark3.exe" {Test-Path C:\ProxSpace\Release\proxmark3.exe}
283
284 ExecTest "arm image exists" "\arm\fullimage1.elf" {Test-Path C:\ProxSpace\Release\arm\fullimage.elf}
285
286 ExecTest "bootrom exists" "bootrom.elf" {Test-Path C:\ProxSpace\Release\arm\bootrom.elf}
287
288 ExecTest "hardnested tables exists" "hardnested" {Test-Path C:\ProxSpace\Release\hardnested\tables\*.z}
289
290 ExecTest "release exists" "release.zip" {Test-Path C:\ProxSpace\release.zip}
291
292
293 #proxmark logic tests
294
666fa6e1 295 ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q Execute && echo Passed || echo Failed'}
9764d3ea 296
666fa6e1 297 ExecTest "proxmark help hardnested" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q hardnested && echo Passed || echo Failed'}
9764d3ea 298
299
666fa6e1 300 ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;./proxmark3 comx -c 'hf mf'"} "at_enc"
9764d3ea 301
666fa6e1 302 ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;./proxmark3 comx -c 'hf mf hardnested t 1 000000000000'"} "found:"
9764d3ea 303
e79209e1 304
82827950 305 #proxmark crypto tests
306
666fa6e1 307 ExecTest "hf emv test" "hf emv test" {bash -lc "cd ~/client;./proxmark3 comx -c 'hf emv test'"} "Tests ?OK"
e79209e1 308
9764d3ea 309
310 if ($global:TestsPassed) {
311 Write-Host "Tests [ OK ]" -ForegroundColor Green
312 } else {
313 Write-Host "Tests [ ERROR ]" -ForegroundColor Red
314 throw "Tests error."
315 }
ef9746cb
OM
316on_success:
317- ps: Write-Host "Build success..." -ForegroundColor Green
318on_failure:
319- ps: Write-Host "Build error." -ForegroundColor Red
320on_finish:
da36bed9 321- ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
Impressum, Datenschutz