]>
Commit | Line | Data |
---|---|---|
ef9746cb OM |
1 | version: 3.0.1.{build} |
2 | image: Visual Studio 2017 | |
3 | clone_folder: C:\ProxSpace\pm3 | |
4 | init: | |
5 | - ps: "$psversiontable\n#Get-ChildItem Env:\n\n$releasename=\"\"\n$env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)\nif ($env:appveyor_repo_tag -match \"true\"){\n $releasename=$env:APPVEYOR_REPO_TAG_NAME + \"/\"\n}\n$releasename+=$env:APPVEYOR_BUILD_VERSION + \" [\" + $env:APPVEYOR_REPO_COMMIT_SHORT + \"]\" \n\nWrite-Host \"repository: $env:appveyor_repo_name branch:$env:APPVEYOR_REPO_BRANCH release: $releasename\" -ForegroundColor Yellow\nAdd-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\"\n\niex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))" | |
6 | clone_script: | |
7 | - ps: >- | |
8 | Write-Host "Removing ProxSpace..." -NoNewLine | |
9 | ||
10 | cd \ | |
11 | ||
12 | Remove-Item -Recurse -Force -Path c:\ProxSpace\* | |
13 | ||
14 | Write-Host "[ OK ]" -ForegroundColor Green | |
15 | ||
16 | ||
17 | Write-Host "Git clone ProxSpace..." -NoNewLine | |
18 | ||
19 | git clone -q https://github.com/Gator96100/ProxSpace c:\ProxSpace | |
20 | ||
21 | Write-Host "[ OK ]" -ForegroundColor Green | |
22 | ||
23 | ||
24 | Write-Host "Removing pm3 dir..." -NoNewLine | |
25 | ||
26 | Remove-Item -Recurse -Force -Path c:\ProxSpace\pm3\* | |
27 | ||
28 | Write-Host "[ OK ]" -ForegroundColor Green | |
29 | ||
30 | ||
31 | Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine | |
32 | ||
33 | if(-not $env:appveyor_pull_request_number) { | |
34 | git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder | |
35 | cd $env:appveyor_build_folder | |
36 | git checkout -qf $env:appveyor_repo_commit | |
37 | } else { | |
38 | git clone -q https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder | |
39 | cd $env:appveyor_build_folder | |
40 | git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge: | |
41 | git checkout -qf FETCH_HEAD | |
42 | } | |
43 | ||
44 | Write-Host "[ OK ]" -ForegroundColor Green | |
45 | ||
46 | ||
47 | Write-Host "Fill msys\etc\fstab file..." -NoNewLine | |
48 | ||
49 | 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" | |
50 | ||
51 | Write-Host "[ OK ]" -ForegroundColor Green | |
52 | install: | |
53 | - ps: >- | |
54 | function Exec-External { | |
55 | param( | |
56 | [Parameter(Position=0,Mandatory=1)][scriptblock] $command | |
57 | ) | |
58 | & $command | |
59 | if ($LASTEXITCODE -ne 0) { | |
60 | throw ("Command returned non-zero error-code ${LASTEXITCODE}: $command") | |
61 | } | |
62 | } | |
63 | build_script: | |
64 | - ps: "$env:Path = \"C:\\ProxSpace\\msys\\bin;$env:Path\"\n\n#make\nbash -lc -i \"pwd;make all\"\n\n#some checks\nif(!(Test-Path C:\\ProxSpace\\pm3\\client\\proxmark3.exe)){\nthrow \"Main file proxmark3.exe not exists.\"\n}\nif(!(Test-Path C:\\ProxSpace\\pm3\\armsrc\\obj\\fullimage.elf)){\nthrow \"ARM file fullimage.elf not exists.\"\n}\nif(!(Test-Path C:\\ProxSpace\\pm3\\client\\hardnested\\tables\\*.bin.z)){\nthrow \"Files in hardnested\\tables not exists.\"\n}\n\n#copy\nWrite-Host \"Copy release files...\" -NoNewLine -ForegroundColor Yellow\nNew-Item -ItemType Directory -Force -Path C:\\ProxSpace\\Release\nCopy-Item C:\\ProxSpace\\pm3\\client\\*.exe C:\\ProxSpace\\Release\nNew-Item -ItemType Directory -Force -Path C:\\ProxSpace\\Release\\arm\nCopy-Item C:\\ProxSpace\\pm3\\armsrc\\obj\\*.elf C:\\ProxSpace\\Release\\arm\nCopy-Item C:\\ProxSpace\\pm3\\bootrom\\obj\\*.elf C:\\ProxSpace\\Release\\arm\nNew-Item -ItemType Directory -Force -Path C:\\ProxSpace\\Release\\scripts\nCopy-Item C:\\ProxSpace\\pm3\\client\\scripts\\*.lua C:\\ProxSpace\\Release\\scripts\nNew-Item -ItemType Directory -Force -Path C:\\ProxSpace\\Release\\hardnested\\tables\nCopy-Item C:\\ProxSpace\\pm3\\client\\hardnested\\*.bin C:\\ProxSpace\\Release\\hardnested\nCopy-Item C:\\ProxSpace\\pm3\\client\\hardnested\\tables\\*.bin.z C:\\ProxSpace\\Release\\hardnested\\tables\nWrite-Host \"[ OK ]\" -ForegroundColor Green\n\n#archive and push\n$releasename=\"\"\nif ($env:appveyor_repo_tag -match \"true\"){\n$releasename=$env:APPVEYOR_REPO_TAG_NAME + \"/\"\n}\n$releasename+=$env:APPVEYOR_BUILD_VERSION + \" [\" + $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) + \"]\" \n\nWrite-Host \"Archive and publish release files ($releasename)...\" -NoNewLine -ForegroundColor Yellow\ncd C:\\ProxSpace\n7z a release.zip C:\\ProxSpace\\Release\nPush-AppveyorArtifact release.zip -DeploymentName \"$releasename\"\nWrite-Host \"[ OK ]\" -ForegroundColor Green\n\nWrite-Host \"Builded...\" -ForegroundColor Yellow" | |
65 | test_script: | |
66 | - ps: >- | |
67 | $env:Path = "C:\ProxSpace\msys\bin;$env:Path" | |
68 | ||
69 | cd c:\ProxSpace\pm3 | |
70 | ||
71 | ||
72 | $global:TestsPassed=$true | |
73 | ||
74 | $global:TestTime=[System.Environment]::TickCount | |
75 | ||
76 | ||
77 | Function ExecTest($Name, $File, $Cond) { | |
78 | [bool]$res=$false; | |
79 | if ($Cond -eq $null){ | |
80 | } Else { | |
81 | If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){ | |
82 | if ($Cond -is "String" -and $Cond -like "*passed*"){ | |
83 | $res= $true | |
84 | } | |
85 | if ($Cond -is "String" -and $Cond -like "*true*"){ | |
86 | $res= $true | |
87 | } | |
88 | } Else { | |
89 | $res=$Cond; | |
90 | } | |
91 | } | |
92 | ||
93 | If ($res) { | |
94 | Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Passed -Duration "$([System.Environment]::TickCount-$global:TestTime)" | |
95 | }Else { | |
96 | Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Failed -Duration "$([System.Environment]::TickCount-$global:TestTime)" | |
97 | $global:TestsPassed=$false | |
98 | } | |
99 | $global:TestTime=[System.Environment]::TickCount | |
100 | } | |
101 | ||
102 | ||
103 | Write-Host "Running tests..." -ForegroundColor Yellow | |
104 | ||
105 | ||
106 | #file test | |
107 | ||
108 | ExecTest "proxmark3 exists" "proxmark3.exe" $(Test-Path C:\ProxSpace\Release\proxmark3.exe) | |
109 | ||
110 | ExecTest "arm image exists" "\arm\fullimage1.elf" $(Test-Path C:\ProxSpace\Release\arm\fullimage.elf) | |
111 | ||
112 | ExecTest "bootrom exists" "bootrom.elf" $(Test-Path C:\ProxSpace\Release\arm\bootrom.elf) | |
113 | ||
114 | ExecTest "hardnested tables exists" "hardnested" $(Test-Path C:\ProxSpace\Release\hardnested\tables\*.z) | |
115 | ||
116 | ExecTest "release exists" "release.zip" $(Test-Path C:\ProxSpace\release.zip) | |
117 | ||
118 | ||
119 | #proxmark logic tests | |
120 | ||
121 | ExecTest "proxmark help" "proxmark3 -h" $(bash -lc 'cd ~/client;proxmark3 -h | grep -q Execute && echo Passed || echo Failed') | |
122 | ||
123 | ExecTest "proxmark help hardnested" "proxmark3 -h" $(bash -lc 'cd ~/client;proxmark3 -h | grep -q hardnested && echo Passed || echo Failed') | |
124 | ||
125 | ||
126 | ExecTest "hf mf offline text" "hf mf" $(bash -lc "cd ~/client;proxmark3 comx -c 'hf mf' | grep -q at_enc && echo Passed || echo Failed") | |
127 | ||
128 | 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") | |
129 | ||
130 | ||
131 | if ($global:TestsPassed) { | |
132 | Write-Host "Tests [ OK ]" -ForegroundColor Green | |
133 | } else { | |
134 | Write-Host "Tests [ ERROR ]" -ForegroundColor Red | |
135 | throw "Tests error." | |
136 | } | |
137 | on_success: | |
138 | - ps: Write-Host "Build success..." -ForegroundColor Green | |
139 | on_failure: | |
140 | - ps: Write-Host "Build error." -ForegroundColor Red | |
141 | on_finish: | |
142 | - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) |