2 image: Visual Studio 2017
3 clone_folder: C:\ProxSpace\pm3
13 $env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)
15 if ($env:appveyor_repo_tag -match "true"){
16 $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
19 $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT_SHORT + "]"
22 Write-Host "repository: $env:appveyor_repo_name branch:$env:APPVEYOR_REPO_BRANCH release: $releasename" -ForegroundColor Yellow
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"
27 iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
30 Write-Host "Removing ProxSpace..." -NoNewLine
34 Remove-Item -Recurse -Force -Path c:\ProxSpace\*
36 Write-Host "[ OK ]" -ForegroundColor Green
39 Write-Host "Git clone ProxSpace..." -NoNewLine
41 git clone -q https://github.com/Gator96100/ProxSpace c:\ProxSpace
43 Write-Host "[ OK ]" -ForegroundColor Green
46 Write-Host "Removing pm3 dir..." -NoNewLine
48 Remove-Item -Recurse -Force -Path c:\ProxSpace\pm3\*
50 Write-Host "[ OK ]" -ForegroundColor Green
53 Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine
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
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
66 Write-Host "[ OK ]" -ForegroundColor Green
69 Write-Host "Fill msys\etc\fstab file..." -NoNewLine
71 New-Item c:\ProxSpace\msys\etc\fstab -type file -force -value "#Win32_Path Mount_Point`nc:\ProxSpace\devkitARM /devkitARM`nc:\ProxSpace\Qt\5.6 /qt `nc:\ProxSpace\pm3 /pm3`n"
73 Write-Host "[ OK ]" -ForegroundColor Green
76 function Exec-External {
78 [Parameter(Position=0,Mandatory=1)][scriptblock] $command
81 if ($LASTEXITCODE -ne 0) {
82 throw ("Command returned non-zero error-code ${LASTEXITCODE}: $command")
87 $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
92 bash -lc -i "pwd;make all"
97 if(!(Test-Path C:\ProxSpace\pm3\client\proxmark3.exe)){
99 throw "Main file proxmark3.exe not exists."
103 if(!(Test-Path C:\ProxSpace\pm3\armsrc\obj\fullimage.elf)){
105 throw "ARM file fullimage.elf not exists."
109 if(!(Test-Path C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z)){
111 throw "Files in hardnested\tables not exists."
118 Write-Host "Copy release files..." -NoNewLine -ForegroundColor Yellow
120 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release
122 Copy-Item C:\ProxSpace\pm3\client\*.exe C:\ProxSpace\Release
124 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\arm
126 Copy-Item C:\ProxSpace\pm3\armsrc\obj\*.elf C:\ProxSpace\Release\arm
128 Copy-Item C:\ProxSpace\pm3\bootrom\obj\*.elf C:\ProxSpace\Release\arm
130 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\scripts
132 Copy-Item C:\ProxSpace\pm3\client\scripts\*.lua C:\ProxSpace\Release\scripts
134 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\hardnested\tables
136 Copy-Item C:\ProxSpace\pm3\client\hardnested\*.bin C:\ProxSpace\Release\hardnested
138 Copy-Item C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z C:\ProxSpace\Release\hardnested\tables
140 Write-Host "[ OK ]" -ForegroundColor Green
147 if ($env:appveyor_repo_tag -match "true"){
149 $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
153 $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) + "]"
156 Write-Host "Archive and publish release files ($releasename)..." -NoNewLine -ForegroundColor Yellow
160 7z a release.zip C:\ProxSpace\Release
162 Push-AppveyorArtifact release.zip -DeploymentName "$releasename"
164 Write-Host "[ OK ]" -ForegroundColor Green
167 Write-Host "Builded..." -ForegroundColor Yellow
170 $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
175 $global:TestsPassed=$true
178 Function ExecTest($Name, $File, $Cmd) {
182 $Job = Start-Job -ScriptBlock {
184 $TestTime=[System.Environment]::TickCount
185 $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
186 Set-Location $using:PWD
188 $sb=[scriptblock]::Create("$using:Cmd")
190 Write-host "Test [$using:Name] job: $using:Cmd"
193 if ($Cond -eq $null){
195 If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){
196 if ($Cond -is "String" -and $Cond -like "*passed*"){
199 if ($Cond -is "String" -and $Cond -like "*true*"){
208 Write-host "Result[$using:Name]: $Cond" -ForegroundColor Green
209 Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
211 Write-host "Result[$using:Name]: $Cond" -ForegroundColor Red
212 Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" -ErrorMessage "command:$using:Cmd`nresult:$Cond"
220 # Wait 40 sec timeout for Job
221 if(Wait-Job $Job -Timeout 40){
222 $Results = $Job | Receive-Job
223 if($Results -like "true"){
227 Write-host "Test [$Name] timeout" -ForegroundColor Red
228 Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Failed -Duration 40000 -ErrorMessage "timeout"
230 Remove-Job -Force $Job
233 $global:TestsPassed=$false
238 Write-Host "Running tests..." -ForegroundColor Yellow
243 ExecTest "proxmark3 exists" "proxmark3.exe" {Test-Path C:\ProxSpace\Release\proxmark3.exe}
245 ExecTest "arm image exists" "\arm\fullimage1.elf" {Test-Path C:\ProxSpace\Release\arm\fullimage.elf}
247 ExecTest "bootrom exists" "bootrom.elf" {Test-Path C:\ProxSpace\Release\arm\bootrom.elf}
249 ExecTest "hardnested tables exists" "hardnested" {Test-Path C:\ProxSpace\Release\hardnested\tables\*.z}
251 ExecTest "release exists" "release.zip" {Test-Path C:\ProxSpace\release.zip}
254 #proxmark logic tests
256 ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;proxmark3 -h | grep -q Execute && echo Passed || echo Failed'}
258 ExecTest "proxmark help hardnested" "proxmark3 -h" {bash -lc 'cd ~/client;proxmark3 -h | grep -q hardnested && echo Passed || echo Failed'}
261 ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf' | grep -q at_enc && echo Passed || echo Failed"}
263 ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf hardnested t 1 000000000000' | grep -q 'found:' && echo Passed || echo Failed"}
266 if ($global:TestsPassed) {
267 Write-Host "Tests [ OK ]" -ForegroundColor Green
269 Write-Host "Tests [ ERROR ]" -ForegroundColor Red
273 - ps: Write-Host "Build success..." -ForegroundColor Green
275 - ps: Write-Host "Build error." -ForegroundColor Red
277 - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))