2 image: Visual Studio 2019
3 clone_folder: C:\ProxSpace\pm3\proxmark
5 - C:\ps-cache -> appveyor.yml
7 proxspace_url: https://github.com/Gator96100/ProxSpace/archive/master.zip
8 proxspace_zip_file: \proxspace.zip
9 proxspace_zip_folder_name: ProxSpace-*
10 proxspace_path: C:\ProxSpace
11 proxspace_home_path: \ProxSpace\pm3
12 proxspace_cache_path: C:\ps-cache
13 wsl_git_path: C:\proxmark
14 APPVEYOR_SAVE_CACHE_ON_ERROR: true
24 $env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)
26 if ($env:appveyor_repo_tag -match "true"){
27 $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
30 $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT_SHORT + "]"
32 Write-Host "repository: $env:appveyor_repo_name branch:$env:APPVEYOR_REPO_BRANCH release: $releasename" -ForegroundColor Yellow
34 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"
36 # iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
40 Function GitClone($Text, $Folder) {
41 Write-Host "$Text" -NoNewLine
42 if(-not $env:appveyor_pull_request_number) {
43 git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $Folder
45 git checkout -qf $env:appveyor_repo_commit
47 git clone -q https://github.com/$env:appveyor_repo_name.git $Folder
49 git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge:
50 git checkout -qf FETCH_HEAD
52 Write-Host "[ OK ]" -ForegroundColor Green
55 $WSLjob = Start-Job -Name WSLInstall -ScriptBlock {
56 Function WSLExec($Text, $Cmd) {
59 Write-Host "$Text" -NoNewLine
60 Write-Host "[ OK ]" -ForegroundColor Green
63 $WSLInstallTime=[System.Environment]::TickCount
64 WSLExec "WSL update..." "sudo apt-get update 1>/dev/null"
65 WSLExec "WSL upgrade..." "sudo apt-get upgrade -y 1>/dev/null"
66 WSLExec "WSL cleanup..." "sudo apt-get auto-remove -y 1>/dev/null"
67 WSLExec "WSL install..." "sudo apt-get -y install --reinstall --no-install-recommends git ca-certificates build-essential pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev qtbase5-dev cmake libpython3-dev python3 python3-pip python3-dev libpython3-all-dev 1>/dev/null"
68 WSLExec "WSL QT fix..." "sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5"
69 WSLExec "WSL install python dependencies..." "sudo python3 -m pip install --upgrade pip 1>/dev/null"
70 WSLExec "WSL install pip..." "sudo python3 -m pip install setuptools 1>/dev/null"
71 WSLExec "WSL install pip continue..." "sudo python3 -m pip install ansicolors sslcrypto 1>/dev/null"
73 Add-AppveyorMessage -Message "WSL setup took $(([System.Environment]::TickCount-$WSLInstallTime) / 1000) sec" -Category Information
74 New-Item -ItemType "file" -Path "C:\WSL-Finished.txt" -Force | Out-Null
77 $env:PSInstallTime=[System.Environment]::TickCount
79 Write-Host "ProxSpace: Removing folder..." -NoNewLine
83 Remove-Item -Recurse -Force -Path $env:proxspace_path -ErrorAction SilentlyContinue
85 Write-Host "[ OK ]" -ForegroundColor Green
87 Write-Host "ProxSpace: downloading..." -NoNewLine
89 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
91 Invoke-WebRequest "$env:proxspace_url" -outfile "$env:proxspace_zip_file"
93 Write-Host "[ OK ]" -ForegroundColor Green
95 Write-Host "ProxSpace: extracting..." -NoNewLine
97 Expand-Archive -LiteralPath "$env:proxspace_zip_file" -DestinationPath "\"
99 Remove-Item "$env:proxspace_zip_file"
101 Write-Host "[ OK ]" -ForegroundColor Green
103 Write-Host "ProxSpace: renaming folder..." -NoNewLine
105 Get-ChildItem -Path "\$env:proxspace_zip_folder_name" | Rename-Item -NewName (Split-Path $env:proxspace_path -Leaf)
107 Write-Host "[ OK ]" -ForegroundColor Gree
109 $psversion = (Select-String -Pattern 'PSVERSION=' -SimpleMatch -Path "$env:proxspace_path\setup\09-proxspace_setup.post").Line.Split("""")[1]
111 Write-Host "ProxSpace version: $psversion" -ForegroundColor Yellow
113 GitClone "ProxSpace: Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." $env:appveyor_build_folder
115 GitClone "WSL: Cloning repository <$env:appveyor_repo_name> to $env:wsl_git_path ..." $env:wsl_git_path
121 Function ExecUpdate($Text, $firstStart) {
124 $PSjob = Start-Job -Name PSInstall -ScriptBlock {
125 cd $env:proxspace_path
126 ./runme64.bat -c "exit"
129 $StartTime=[System.Environment]::TickCount
132 if ($PSjob.State -eq 'Completed') {
133 Write-Host "$Text" -NoNewLine
134 Write-Host "[ OK ]" -ForegroundColor Green
138 if ($PSjob.State -eq 'Failed') {
139 Write-Host "$Text" -NoNewLine
140 Write-Host "[ Failed ]" -ForegroundColor Red
144 if ($firstStart -And (Test-Path "$env:proxspace_path\msys2\etc\pacman.conf.pacnew")) {
148 Write-Host "$Text" -NoNewLine
149 Write-Host "Exit by pacman.conf" -ForegroundColor Green
153 if ([System.Environment]::TickCount-$StartTime -gt 1000000) {
155 Write-Host "$Text" -NoNewLine
156 Write-host "Exit by timeout" -ForegroundColor Yellow
161 Receive-Job -Name WSLInstall -ErrorAction SilentlyContinue
163 #Receive-Job -Wait -Name PSInstall
166 Function GitClone($Text, $Folder) {
167 Write-Host "$Text" -NoNewLine
168 if(-not $env:appveyor_pull_request_number) {
169 git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $Folder
171 git checkout -qf $env:appveyor_repo_commit
173 git clone -q https://github.com/$env:appveyor_repo_name.git $Folder
175 git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge:
176 git checkout -qf FETCH_HEAD
178 Write-Host "[ OK ]" -ForegroundColor Green
181 Write-Host "ProxSpace: move cache..." -NoNewLine
183 New-Item -ItemType Directory -Force -Path "$env:proxspace_path\msys2\var\cache\" | Out-Null
185 Copy-Item -Path "$env:proxspace_cache_path\*" -Destination "$env:proxspace_path\msys2\var\cache\" -Force -Recurse -ErrorAction SilentlyContinue
187 Write-Host "[ OK ]" -ForegroundColor Gree
189 ExecUpdate "ProxSpace: initial msys2 startup..." $true
191 ExecUpdate "ProxSpace: installing required packages..." $false
193 Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$env:PSInstallTime) / 1000) sec" -Category Information
198 $pmfolder = Split-Path $env:appveyor_build_folder -Leaf
200 Function ExecMinGWCmd($Cmd) {
201 cd $env:proxspace_path
202 ./runme64.bat -c "cd $pmfolder && $Cmd"
205 Function ExecCheck($Name) {
206 $testspass = ($LASTEXITCODE -eq 0)
208 $global:TestsPassed=$testspass
211 Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
212 Write-Host "$Name [ OK ]" -ForegroundColor Green
214 Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)"
215 Write-Host "$Name [ ERROR ]" -ForegroundColor Red
220 $WSLjob = Start-Job -Name WSLCompile -ScriptBlock {
221 Function ExecWSLCmd($Cmd) {
226 Function ExecCheck($Name) {
227 $testspass = ($LASTEXITCODE -eq 0)
229 $global:TestsPassed=$testspass
232 Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
233 Write-Host "$Name [ OK ]" -ForegroundColor Green
235 Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)"
236 Write-Host "$Name [ ERROR ]" -ForegroundColor Red
241 #WSL: wait for installation to finish
242 if(!(Test-Path "C:\WSL-Finished.txt")){
243 Write-Host "Waiting for WSL installation to finish..." -NoNewLine
244 while(!(Test-Path "C:\WSL-Finished.txt")) {
247 Remove-Item -Force "C:\WSL-Finished.txt" -ErrorAction SilentlyContinue
248 Write-Host "$Name [ OK ]" -ForegroundColor Green
251 #Windows Subsystem for Linux (WSL)
252 Write-Host "---------- WSL make ----------" -ForegroundColor Yellow
253 $TestTime=[System.Environment]::TickCount
254 ExecWSLCmd "make clean;make V=1"
256 if(!(Test-Path "$env:wsl_git_path\client\proxmark3")){
257 throw "Main file proxmark3 not exists."
260 ExecWSLCmd "make check"
261 ExecCheck "WSL make Tests"
263 Write-Host "---------- WSL btaddon ----------" -ForegroundColor Yellow
264 $TestTime=[System.Environment]::TickCount
265 ExecWSLCmd "make clean;make V=1 PLATFORM_EXTRAS=BTADDON"
266 ExecWSLCmd "make check"
267 ExecCheck "WSL BTaddon Tests"
269 Write-Host "---------- WSL make clean ----------" -ForegroundColor Yellow
270 ExecWSLCmd 'make clean'
271 Write-Host "---------- WSL cmake ----------" -ForegroundColor Yellow
272 $TestTime=[System.Environment]::TickCount
273 ExecWSLCmd 'mkdir -p client/build; cd client/build; cmake ..; make VERBOSE=1;'
274 Write-Host "---------- WSL cmake tests ----------" -ForegroundColor Yellow
275 ExecWSLCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3 client'
276 ExecCheck "WSL cmake Tests"
281 Write-Host "ProxSpace: create new cache..." -NoNewLine
283 cd $env:proxspace_path
285 ./runme64.bat -c "yes | pacman -Sc > /dev/null 2>&1"
287 Remove-Item -Recurse -Force -Path "$env:proxspace_cache_path" -ErrorAction SilentlyContinue
289 Move-Item -Path "$env:proxspace_path\msys2\var\cache" -Destination "$env:proxspace_cache_path" -Force
291 Write-Host "[ OK ]" -ForegroundColor Gree
293 Write-Host "---------- PS make ----------" -ForegroundColor Yellow
295 $TestTime=[System.Environment]::TickCount
297 ExecMinGWCmd "make clean;make V=1"
299 if(!(Test-Path "$env:proxspace_home_path\$pmfolder\client\proxmark3.exe")){
301 throw "Main file proxmark3.exe not exists."
305 ExecMinGWCmd 'make check'
307 ExecCheck "PS make Tests"
309 Write-Host "---------- PS btaddon ----------" -ForegroundColor Yellow
311 $TestTime=[System.Environment]::TickCount
313 ExecMinGWCmd 'make clean;make V=1 PLATFORM_EXTRAS=BTADDON'
315 ExecMinGWCmd 'make check'
317 ExecCheck "PS BTaddon Tests"
319 Write-Host "---------- PS make clean ----------" -ForegroundColor Yellow
321 ExecMinGWCmd 'make clean'
323 Write-Host "---------- PS cmake ----------" -ForegroundColor Yellow
325 $TestTime=[System.Environment]::TickCount
327 ExecMinGWCmd 'mkdir -p client/build; cd client/build; cmake -G""MSYS Makefiles"" ..; make VERBOSE=1;'
329 Write-Host "---------- PS cmake tests ----------" -ForegroundColor Yellow
331 ExecMinGWCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3.exe client'
333 ExecCheck "PS cmake Tests"
335 Receive-Job -Wait -Name WSLInstall -ErrorAction SilentlyContinue
337 Receive-Job -Wait -Job $WSLjob
341 if ($global:TestsPassed) {
342 Write-Host "Tests [ OK ]" -ForegroundColor Green
344 Write-Host "Tests [ ERROR ]" -ForegroundColor Red
348 - ps: Write-Host "Build success..." -ForegroundColor Green
350 - ps: Write-Host "Build error." -ForegroundColor Red
352 - ps: # $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))