2017-10-21 02:13:49 +08:00
version : 3.0 .1 .{build}
2020-06-16 20:43:24 +08:00
image : Visual Studio 2019
2020-09-09 10:07:04 +08:00
clone_folder : C:\ProxSpace\pm3\proxmark
2020-10-05 03:15:35 +08:00
cache :
2020-10-06 06:13:09 +08:00
- C:\ps-cache -> appveyor.yml
2020-09-09 10:07:04 +08:00
environment :
proxspace_url : https://github.com/Gator96100/ProxSpace/archive/master.zip
proxspace_zip_file : \proxspace.zip
proxspace_zip_folder_name : ProxSpace-*
2020-10-05 07:35:10 +08:00
proxspace_path : C:\ProxSpace
2020-09-09 10:07:04 +08:00
proxspace_home_path : \ProxSpace\pm3
2020-10-06 01:35:50 +08:00
proxspace_cache_path : C:\ps-cache
2020-09-19 01:13:13 +08:00
wsl_git_path : C:\proxmark
2020-10-05 05:41:04 +08:00
APPVEYOR_SAVE_CACHE_ON_ERROR : true
2020-09-09 10:07:04 +08:00
2017-05-01 15:16:22 +08:00
init :
2017-10-26 19:01:55 +08:00
- ps : >-
$psversiontable
#Get-ChildItem Env:
$releasename=""
$env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)
if ($env:appveyor_repo_tag -match "true"){
$releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
}
$releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT_SHORT + "]"
Write-Host "repository: $env:appveyor_repo_name branch:$env:APPVEYOR_REPO_BRANCH release: $releasename" -ForegroundColor Yellow
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"
2020-03-12 18:42:50 +08:00
# iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
2017-10-21 02:13:49 +08:00
clone_script :
2020-10-05 11:10:25 +08:00
- ps : >-
Function GitClone($Text, $Folder) {
Write-Host "$Text" -NoNewLine
if(-not $env:appveyor_pull_request_number) {
git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $Folder
cd $Folder
git checkout -qf $env:appveyor_repo_commit
} else {
git clone -q https://github.com/$env:appveyor_repo_name.git $Folder
cd $Folder
git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge :
git checkout -qf FETCH_HEAD
}
Write-Host "[ OK ]" -ForegroundColor Green
}
2020-10-06 04:06:03 +08:00
$WSLjob = Start-Job -Name WSLInstall -ScriptBlock {
2020-10-05 11:10:25 +08:00
Function WSLExec($Text, $Cmd) {
Write-Host "$Text"
wsl -- bash -c $Cmd
Write-Host "$Text" -NoNewLine
Write-Host "[ OK ]" -ForegroundColor Green
}
$WSLInstallTime=[System.Environment]::TickCount
WSLExec "WSL update..." "sudo apt-get update 1>/dev/null"
WSLExec "WSL upgrade..." "sudo apt-get upgrade -y 1>/dev/null"
WSLExec "WSL cleanup..." "sudo apt-get auto-remove -y 1>/dev/null"
2021-02-25 07:42:56 +08:00
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"
2020-10-05 11:10:25 +08:00
WSLExec "WSL QT fix..." "sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5"
2021-02-25 05:11:35 +08:00
WSLExec "WSL install python dependencies..." "sudo python3 -m pip install --upgrade pip 1>/dev/null"
WSLExec "WSL install pip..." "sudo python3 -m pip install setuptools 1>/dev/null"
WSLExec "WSL install pip continue..." "sudo python3 -m pip install ansicolors sslcrypto 1>/dev/null"
2021-02-25 04:14:30 +08:00
2020-10-05 11:10:25 +08:00
Add-AppveyorMessage -Message "WSL setup took $(([System.Environment]::TickCount-$WSLInstallTime) / 1000) sec" -Category Information
2020-10-06 07:07:39 +08:00
New-Item -ItemType "file" -Path "C:\WSL-Finished.txt" -Force | Out-Null
2020-10-05 11:10:25 +08:00
}
2020-10-05 11:30:21 +08:00
$env:PSInstallTime=[System.Environment]::TickCount
2020-10-05 11:10:25 +08:00
Write-Host "ProxSpace: Removing folder..." -NoNewLine
2020-10-05 11:14:34 +08:00
cd \
2020-10-05 11:10:25 +08:00
Remove-Item -Recurse -Force -Path $env:proxspace_path -ErrorAction SilentlyContinue
Write-Host "[ OK ]" -ForegroundColor Green
Write-Host "ProxSpace: downloading..." -NoNewLine
[ Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest "$env:proxspace_url" -outfile "$env:proxspace_zip_file"
Write-Host "[ OK ]" -ForegroundColor Green
Write-Host "ProxSpace: extracting..." -NoNewLine
Expand-Archive -LiteralPath "$env:proxspace_zip_file" -DestinationPath "\"
Remove-Item "$env:proxspace_zip_file"
Write-Host "[ OK ]" -ForegroundColor Green
Write-Host "ProxSpace: renaming folder..." -NoNewLine
Get-ChildItem -Path "\$env:proxspace_zip_folder_name" | Rename-Item -NewName (Split-Path $env:proxspace_path -Leaf)
Write-Host "[ OK ]" -ForegroundColor Gree
2021-04-09 22:59:11 +08:00
$psversion = (Select-String -Pattern 'PSVERSION=' -SimpleMatch -Path "$env:proxspace_path\setup\09-proxspace_setup.post").Line.Split("""")[1]
2020-10-05 11:10:25 +08:00
Write-Host "ProxSpace version: $psversion" -ForegroundColor Yellow
GitClone "ProxSpace: Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." $env:appveyor_build_folder
GitClone "WSL: Cloning repository <$env:appveyor_repo_name> to $env:wsl_git_path ..." $env:wsl_git_path
install :
2017-10-21 02:13:49 +08:00
- ps : >-
2020-09-09 10:07:04 +08:00
Function ExecUpdate($Text, $firstStart) {
2020-09-18 23:14:59 +08:00
Write-Host "$Text"
2020-10-05 05:17:44 +08:00
$PSjob = Start-Job -Name PSInstall -ScriptBlock {
cd $env:proxspace_path
./runme64.bat -c "exit"
}
2020-09-09 10:07:04 +08:00
$StartTime=[System.Environment]::TickCount
Start-Sleep -s 10
2020-10-05 05:17:44 +08:00
while($true) {
if ($PSjob.State -eq 'Completed') {
2020-09-18 23:14:59 +08:00
Write-Host "$Text" -NoNewLine
2020-09-09 10:07:04 +08:00
Write-Host "[ OK ]" -ForegroundColor Green
break
}
2020-10-05 05:17:44 +08:00
if ($PSjob.State -eq 'Failed') {
Write-Host "$Text" -NoNewLine
Write-Host "[ Failed ]" -ForegroundColor Red
break
}
2020-09-09 10:07:04 +08:00
if ($firstStart -And (Test-Path "$env:proxspace_path\msys2\etc\pacman.conf.pacnew")) {
Start-Sleep -s 5
2020-10-05 05:17:44 +08:00
Stop-Job -Job $PSjob
2020-09-09 10:07:04 +08:00
Start-Sleep -s 5
2020-09-18 23:14:59 +08:00
Write-Host "$Text" -NoNewLine
2020-09-09 10:07:04 +08:00
Write-Host "Exit by pacman.conf" -ForegroundColor Green
break
}
if ([System.Environment]::TickCount-$StartTime -gt 1000000) {
2020-10-05 05:17:44 +08:00
Stop-Job -Job $PSjob
2020-09-18 23:14:59 +08:00
Write-Host "$Text" -NoNewLine
2020-09-09 10:07:04 +08:00
Write-host "Exit by timeout" -ForegroundColor Yellow
break
}
2020-09-18 22:37:56 +08:00
Start-Sleep -s 5
2020-10-06 04:06:03 +08:00
Receive-Job -Name WSLInstall -ErrorAction SilentlyContinue
2020-09-09 10:07:04 +08:00
}
2020-10-05 20:27:50 +08:00
#Receive-Job -Wait -Name PSInstall
2020-10-05 04:51:01 +08:00
}
2020-09-19 00:00:16 +08:00
Function GitClone($Text, $Folder) {
Write-Host "$Text" -NoNewLine
if(-not $env:appveyor_pull_request_number) {
git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $Folder
cd $Folder
git checkout -qf $env:appveyor_repo_commit
} else {
git clone -q https://github.com/$env:appveyor_repo_name.git $Folder
cd $Folder
git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge :
git checkout -qf FETCH_HEAD
}
Write-Host "[ OK ]" -ForegroundColor Green
}
2020-10-05 03:15:35 +08:00
Write-Host "ProxSpace: move cache..." -NoNewLine
2020-10-06 00:03:42 +08:00
New-Item -ItemType Directory -Force -Path "$env:proxspace_path\msys2\var\cache\" | Out-Null
2020-10-05 23:54:39 +08:00
Copy-Item -Path "$env:proxspace_cache_path\*" -Destination "$env:proxspace_path\msys2\var\cache\" -Force -Recurse -ErrorAction SilentlyContinue
2020-10-05 07:35:10 +08:00
2020-09-09 10:07:04 +08:00
Write-Host "[ OK ]" -ForegroundColor Gree
2017-10-21 02:13:49 +08:00
2020-10-05 05:17:44 +08:00
ExecUpdate "ProxSpace: initial msys2 startup..." $true
2020-09-09 10:07:04 +08:00
2020-10-05 11:10:25 +08:00
ExecUpdate "ProxSpace: installing required packages..." $false
2020-09-09 10:07:04 +08:00
2020-10-05 11:30:21 +08:00
Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$env:PSInstallTime) / 1000) sec" -Category Information
2020-09-09 10:07:04 +08:00
2017-04-29 19:25:27 +08:00
build_script :
2017-10-26 19:01:55 +08:00
- ps : >-
2018-10-26 19:59:07 +08:00
2020-09-09 10:07:04 +08:00
$pmfolder = Split-Path $env:appveyor_build_folder -Leaf
Function ExecMinGWCmd($Cmd) {
cd $env:proxspace_path
2020-09-18 05:27:20 +08:00
./runme64.bat -c "cd $pmfolder && $Cmd"
2020-09-09 10:07:04 +08:00
}
2020-09-18 05:27:20 +08:00
Function ExecCheck($Name) {
$testspass = ($LASTEXITCODE -eq 0)
2020-09-09 10:07:04 +08:00
2020-09-18 05:27:20 +08:00
$global:TestsPassed=$testspass
if ($testspass) {
Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
Write-Host "$Name [ OK ]" -ForegroundColor Green
} else {
Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)"
Write-Host "$Name [ ERROR ]" -ForegroundColor Red
throw "Tests error."
}
}
2020-09-19 00:00:16 +08:00
$WSLjob = Start-Job -Name WSLCompile -ScriptBlock {
Function ExecWSLCmd($Cmd) {
2020-10-06 00:30:09 +08:00
cd $env:wsl_git_path
2020-09-19 00:00:16 +08:00
wsl -- bash -c $Cmd
}
Function ExecCheck($Name) {
$testspass = ($LASTEXITCODE -eq 0)
$global:TestsPassed=$testspass
if ($testspass) {
Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
Write-Host "$Name [ OK ]" -ForegroundColor Green
} else {
Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)"
Write-Host "$Name [ ERROR ]" -ForegroundColor Red
throw "Tests error."
}
}
2020-10-05 03:15:35 +08:00
#WSL: wait for installation to finish
2020-10-06 06:13:09 +08:00
if(!(Test-Path "C:\WSL-Finished.txt")){
2020-10-06 06:00:38 +08:00
Write-Host "Waiting for WSL installation to finish..." -NoNewLine
2020-10-06 06:13:09 +08:00
while(!(Test-Path "C:\WSL-Finished.txt")) {
2020-10-06 06:00:38 +08:00
Start-Sleep -s 5
}
2020-10-06 06:13:09 +08:00
Remove-Item -Force "C:\WSL-Finished.txt" -ErrorAction SilentlyContinue
Write-Host "$Name [ OK ]" -ForegroundColor Green
2020-10-06 06:00:38 +08:00
}
2020-09-19 00:00:16 +08:00
#Windows Subsystem for Linux (WSL)
Write-Host "---------- WSL make ----------" -ForegroundColor Yellow
$TestTime=[System.Environment]::TickCount
ExecWSLCmd "make clean;make V=1"
#some checks
2020-09-19 01:13:13 +08:00
if(!(Test-Path "$env:wsl_git_path\client\proxmark3")){
2020-09-19 00:00:16 +08:00
throw "Main file proxmark3 not exists."
}
ExecWSLCmd "make check"
ExecCheck "WSL make Tests"
Start-Sleep -s 2
Write-Host "---------- WSL btaddon ----------" -ForegroundColor Yellow
$TestTime=[System.Environment]::TickCount
ExecWSLCmd "make clean;make V=1 PLATFORM_EXTRAS=BTADDON"
ExecWSLCmd "make check"
ExecCheck "WSL BTaddon Tests"
Start-Sleep -s 2
Write-Host "---------- WSL make clean ----------" -ForegroundColor Yellow
ExecWSLCmd 'make clean'
Write-Host "---------- WSL cmake ----------" -ForegroundColor Yellow
$TestTime=[System.Environment]::TickCount
2020-09-19 00:24:19 +08:00
ExecWSLCmd 'mkdir -p client/build; cd client/build; cmake ..; make VERBOSE=1;'
2020-09-19 00:00:16 +08:00
Write-Host "---------- WSL cmake tests ----------" -ForegroundColor Yellow
ExecWSLCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3 client'
ExecCheck "WSL cmake Tests"
2020-10-06 06:00:38 +08:00
}
2020-09-19 00:00:16 +08:00
2020-09-18 05:27:20 +08:00
#ProxSpace
2020-09-09 10:07:04 +08:00
2020-10-05 19:44:26 +08:00
Write-Host "ProxSpace: create new cache..." -NoNewLine
cd $env:proxspace_path
2020-10-05 21:40:17 +08:00
./runme64.bat -c "yes | pacman -Sc > /dev/null 2>&1"
2021-02-25 05:53:38 +08:00
2020-10-05 21:40:17 +08:00
Remove-Item -Recurse -Force -Path "$env:proxspace_cache_path" -ErrorAction SilentlyContinue
2020-10-05 19:44:26 +08:00
2020-10-05 21:40:17 +08:00
Move-Item -Path "$env:proxspace_path\msys2\var\cache" -Destination "$env:proxspace_cache_path" -Force
2020-10-05 19:44:26 +08:00
Write-Host "[ OK ]" -ForegroundColor Gree
2020-09-18 05:27:20 +08:00
Write-Host "---------- PS make ----------" -ForegroundColor Yellow
2020-09-09 10:07:04 +08:00
2020-09-18 05:27:20 +08:00
$TestTime=[System.Environment]::TickCount
2020-09-09 10:07:04 +08:00
ExecMinGWCmd "make clean;make V=1"
2017-10-26 19:01:55 +08:00
2020-09-09 10:07:04 +08:00
if(!(Test-Path "$env:proxspace_home_path\$pmfolder\client\proxmark3.exe")){
2017-10-26 19:01:55 +08:00
2020-09-18 05:27:20 +08:00
throw "Main file proxmark3.exe not exists."
2017-10-26 19:01:55 +08:00
}
2020-09-09 10:07:04 +08:00
ExecMinGWCmd 'make check'
2020-06-16 20:43:24 +08:00
2020-09-18 05:27:20 +08:00
ExecCheck "PS make Tests"
2020-06-16 20:43:24 +08:00
2020-09-18 05:27:20 +08:00
Write-Host "---------- PS btaddon ----------" -ForegroundColor Yellow
2020-06-16 20:43:24 +08:00
$TestTime=[System.Environment]::TickCount
2020-09-09 10:07:04 +08:00
ExecMinGWCmd 'make clean;make V=1 PLATFORM_EXTRAS=BTADDON'
2017-10-21 02:13:49 +08:00
2020-09-09 10:07:04 +08:00
ExecMinGWCmd 'make check'
2020-06-16 20:43:24 +08:00
2020-09-18 05:27:20 +08:00
ExecCheck "PS BTaddon Tests"
2020-06-16 20:43:24 +08:00
2020-09-18 05:27:20 +08:00
Write-Host "---------- PS make clean ----------" -ForegroundColor Yellow
2020-06-16 20:43:24 +08:00
2020-09-09 10:07:04 +08:00
ExecMinGWCmd 'make clean'
2020-06-16 20:43:24 +08:00
2020-09-18 05:27:20 +08:00
Write-Host "---------- PS cmake ----------" -ForegroundColor Yellow
2020-06-16 20:43:24 +08:00
2020-06-19 21:56:48 +08:00
$TestTime=[System.Environment]::TickCount
2020-09-09 10:07:04 +08:00
ExecMinGWCmd 'mkdir -p client/build; cd client/build; cmake -G""MSYS Makefiles"" ..; make VERBOSE=1;'
2020-06-16 20:43:24 +08:00
2020-09-18 05:27:20 +08:00
Write-Host "---------- PS cmake tests ----------" -ForegroundColor Yellow
2020-06-16 20:43:24 +08:00
2020-09-09 10:07:04 +08:00
ExecMinGWCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3.exe client'
2020-06-16 20:43:24 +08:00
2020-09-18 05:27:20 +08:00
ExecCheck "PS cmake Tests"
2020-06-16 20:43:24 +08:00
2020-10-06 06:00:38 +08:00
Receive-Job -Wait -Name WSLInstall -ErrorAction SilentlyContinue
2020-09-22 08:40:37 +08:00
Receive-Job -Wait -Job $WSLjob
2020-09-18 05:27:20 +08:00
2020-06-16 20:43:24 +08:00
test_script :
- ps : >-
2017-10-21 02:13:49 +08:00
if ($global:TestsPassed) {
Write-Host "Tests [ OK ]" -ForegroundColor Green
} else {
Write-Host "Tests [ ERROR ]" -ForegroundColor Red
throw "Tests error."
}
on_success :
- ps : Write-Host "Build success..." -ForegroundColor Green
on_failure :
- ps : Write-Host "Build error." -ForegroundColor Red
on_finish :
2020-10-05 19:44:26 +08:00
- ps : # $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))