Fixed appveyor CI

This commit is contained in:
Gator96100 2020-09-09 04:07:04 +02:00
parent 9778b272a8
commit ecc3623cad

View file

@ -1,6 +1,13 @@
version: 3.0.1.{build} version: 3.0.1.{build}
image: Visual Studio 2019 image: Visual Studio 2019
clone_folder: C:\ProxSpace\pm3 clone_folder: C:\ProxSpace\pm3\proxmark
environment:
proxspace_url: https://github.com/Gator96100/ProxSpace/archive/master.zip
proxspace_zip_file: \proxspace.zip
proxspace_zip_folder_name: ProxSpace-*
proxspace_path: \ProxSpace
proxspace_home_path: \ProxSpace\pm3
init: init:
- ps: >- - ps: >-
$psversiontable $psversiontable
@ -25,41 +32,78 @@ init:
# iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) # iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
clone_script: clone_script:
- ps: >- - ps: >-
Function ExecUpdate($Text, $firstStart) {
Write-Host "$Text" -NoNewLine
Start-Process "cmd.exe" "/c ""cd /D $env:proxspace_path && call msys2\ps\setup.cmd && msys2\msys2_shell.cmd -mingw64 -defterm -no-start -c ""exit"""""
$StartTime=[System.Environment]::TickCount
Start-Sleep -s 10
while($true) {
$cmdprocess = Get-Process "cmd" -ErrorAction SilentlyContinue
if (!$cmdprocess -Or $cmdprocess.HasExited) {
Write-Host "[ OK ]" -ForegroundColor Green
break
}
if ($firstStart -And (Test-Path "$env:proxspace_path\msys2\etc\pacman.conf.pacnew")) {
Start-Sleep -s 5
$tmp = $cmdprocess.CloseMainWindow()
Start-Sleep -s 5
Stop-Process -Name "cmd" -Force -ErrorAction SilentlyContinue
Write-Host "Exit by pacman.conf" -ForegroundColor Green
break
}
if ([System.Environment]::TickCount-$StartTime -gt 1000000) {
Write-host "Exit by timeout" -ForegroundColor Yellow
break
}
Start-Sleep -s 1
}
}
Write-Host "Removing ProxSpace..." -NoNewLine Write-Host "Removing ProxSpace..." -NoNewLine
$CloneTime=[System.Environment]::TickCount $CloneTime=[System.Environment]::TickCount
cd \ cd \
Remove-Item -Recurse -Force -Path c:\ProxSpace\* Remove-Item -Recurse -Force -Path $env:proxspace_path
Write-Host "[ OK ]" -ForegroundColor Green Write-Host "[ OK ]" -ForegroundColor Green
Write-Host "Download ProxSpace..." -NoNewLine
Write-Host "Git clone ProxSpace..." -NoNewLine [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
git clone -q https://github.com/Gator96100/ProxSpace c:\ProxSpace Invoke-WebRequest "$env:proxspace_url" -outfile "$env:proxspace_zip_file"
Write-Host "[ OK ]" -ForegroundColor Green Write-Host "[ OK ]" -ForegroundColor Green
Write-Host "Extracting ProxSpace..." -NoNewLine
if(!(Test-Path -Path C:\ProxSpace\pm3)){ Expand-Archive -LiteralPath "$env:proxspace_zip_file" -DestinationPath "\"
New-Item -ItemType Directory -Force -Path C:\ProxSpace\pm3 Remove-Item "$env:proxspace_zip_file"
}
Write-Host "Removing pm3 dir..." -NoNewLine
Remove-Item -Recurse -Force -Path c:\ProxSpace\pm3\*
Write-Host "[ OK ]" -ForegroundColor Green Write-Host "[ OK ]" -ForegroundColor Green
Write-Host "Removing ps startup_check.sh ..." -NoNewLine Write-Host "Renaming ProxSpace folder..." -NoNewLine
Remove-Item -Recurse -Force -Path c:\ProxSpace\msys2\ps\startup_checks.sh Get-ChildItem -Path "\$env:proxspace_zip_folder_name" | Rename-Item -NewName (Split-Path $env:proxspace_path -Leaf)
Write-Host "[ OK ]" -ForegroundColor Green Write-Host "[ OK ]" -ForegroundColor Gree
ExecUpdate "Initial msys2 startup..." $true
ExecUpdate "Installing required packages..." $false
$psversion = (Select-String -Pattern 'PSVERSION=' -SimpleMatch -Path "$env:proxspace_path\msys2\ps\09-proxspace_setup.post").Line.Split("""")[1]
Write-Host "ProxSpace version: $psversion" -ForegroundColor Yellow
Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine
@ -76,110 +120,20 @@ clone_script:
Write-Host "[ OK ]" -ForegroundColor Green Write-Host "[ OK ]" -ForegroundColor Green
Write-Host "Fill msys2\etc\fstab file..." -NoNewLine
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"
Write-Host "[ OK ]" -ForegroundColor Green
Write-Host "Update msys2 packages..."
$env:Path = "C:\ProxSpace\msys2\usr\bin;C:\ProxSpace\msys2\mingw32\bin;C:\ProxSpace\gcc-arm-none-eabi\bin;$env:Path"
Function ExecUpdate($Name, $Cmd, $ErrorLine) {
Write-Host "Exec [$Name]... " -NoNewLine
#--- begin Job
$Job = Start-Job -Name "$Name" -ScriptBlock {
$env:Path = "C:\ProxSpace\msys\bin;$env:Path"
Set-Location $using:PWD
$sb=[scriptblock]::Create("$using:Cmd")
#execute scriptblock
$Cond=&$sb
return $Cond
}
#--- end Job
$JobTime=[System.Environment]::TickCount
while($true) {
Try {
$Res = Receive-Job -Job $Job -Keep 2>&1 6>&1
}
Catch {
$Res = ""
Write-host "error in Receive-Job"
}
if ($Res -is "String" -and $Res -like "*$ErrorLine*"){
Write-host "Exit by stop phrase" -ForegroundColor Green
break
}
if ($Res -is [Object]){
[bool]$needexit = $false
ForEach($line in $Res){
if ($line -like "*$ErrorLine*"){
Write-host "Exit by stop phrase [obj]" -ForegroundColor Green
$needexit = $true
break
}
}
if ($needexit) {
break
}
}
if(Wait-Job $Job -Timeout 5){
Write-host "Exit by end job" -ForegroundColor Green
break
}
if ([System.Environment]::TickCount-$JobTime -gt 1000000) {
Write-host "Exit by timeout" -ForegroundColor Yellow
break
}
}
Remove-Job -Force $Job
}
cd C:\ProxSpace\
C:\ProxSpace\msys2\ps\setup.cmd
ExecUpdate "update1" "C:\ProxSpace\msys2\msys2_shell.cmd -mingw32 -defterm -no-start /dev/null" "terminate?MSYS2"
ExecUpdate "update2" "C:\ProxSpace\msys2\msys2_shell.cmd -mingw32 -defterm -no-start /dev/null" "terminate?MSYS2"
Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$CloneTime) / 1000) sec" -Category Information Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$CloneTime) / 1000) sec" -Category Information
Write-Host "Update " -NoNewLine
Write-Host "[ OK ]" -ForegroundColor Green
install: install:
build_script: build_script:
- ps: >- - ps: >-
$env:Path="C:\ProxSpace\msys2\usr\bin;C:\ProxSpace\msys2\mingw32\bin;C:\ProxSpace\gcc-arm-none-eabi\bin;c:\Python38;c:\Python38\Scripts;$env:Path"
$env:MINGW_HOME="C:\ProxSpace\msys2\mingw32" $pmfolder = Split-Path $env:appveyor_build_folder -Leaf
$env:MSYS_HOME="C:\ProxSpace\msys2" Function ExecMinGWCmd($Cmd) {
cd $env:proxspace_path
msys2\msys2_shell.cmd -mingw64 -defterm -no-start -c "cd $pmfolder && $Cmd"
}
$env:MSYSTEM="MINGW32"
$env:MINGW_PREFIX="/mingw32"
$env:SHELL="/bin/bash"
$env:MSYSTEM_CHOST="i686-w64-mingw32"
cd C:\ProxSpace\pm3
Write-Host "---------- make ----------" -ForegroundColor Yellow Write-Host "---------- make ----------" -ForegroundColor Yellow
@ -187,20 +141,21 @@ build_script:
#make #make
bash -c -i 'echo $PATH;pwd;make clean;make V=1' cd $env:proxspace_path
msys2\ps\setup.cmd
ExecMinGWCmd "make clean;make V=1"
#some checks #some checks
if(!(Test-Path C:\ProxSpace\pm3\client\proxmark3.exe)){ if(!(Test-Path "$env:proxspace_home_path\$pmfolder\client\proxmark3.exe")){
throw "Main file proxmark3.exe not exists." throw "Main file proxmark3.exe not exists."
} }
cd c:\ProxSpace\pm3 ExecMinGWCmd 'make check'
bash -c -i 'make check'
$testspass = ($LASTEXITCODE -eq 0) $testspass = ($LASTEXITCODE -eq 0)
@ -219,11 +174,9 @@ build_script:
$TestTime=[System.Environment]::TickCount $TestTime=[System.Environment]::TickCount
bash -c -i 'pwd;make clean;make PLATFORM_EXTRAS=BTADDON' ExecMinGWCmd 'make clean;make V=1 PLATFORM_EXTRAS=BTADDON'
cd c:\ProxSpace\pm3 ExecMinGWCmd 'make check'
bash -c -i 'make check'
$testspass = ($LASTEXITCODE -eq 0) $testspass = ($LASTEXITCODE -eq 0)
@ -239,19 +192,17 @@ build_script:
Write-Host "---------- make clean ----------" -ForegroundColor Yellow Write-Host "---------- make clean ----------" -ForegroundColor Yellow
bash -c -i 'make clean' ExecMinGWCmd 'make clean'
Write-Host "---------- cmake ----------" -ForegroundColor Yellow Write-Host "---------- cmake ----------" -ForegroundColor Yellow
$TestTime=[System.Environment]::TickCount $TestTime=[System.Environment]::TickCount
cmd.exe /c 'C:\ProxSpace\msys2\msys2_shell.cmd -mingw32 -defterm -no-start -c "mkdir -p client/build; cd client/build; cmake -G""MSYS Makefiles"" ..; make VERBOSE=1;"' ExecMinGWCmd 'mkdir -p client/build; cd client/build; cmake -G""MSYS Makefiles"" ..; make VERBOSE=1;'
Write-Host "---------- cmake tests ----------" -ForegroundColor Yellow Write-Host "---------- cmake tests ----------" -ForegroundColor Yellow
cd c:\ProxSpace\pm3 ExecMinGWCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3.exe client'
bash -c -i './tools/pm3_tests.sh --clientbin client/build/proxmark3.exe client'
$testspass = ($LASTEXITCODE -eq 0) $testspass = ($LASTEXITCODE -eq 0)