From 3b8c54ad5227ff0dd8c8b4e4122b5711f59c0348 Mon Sep 17 00:00:00 2001 From: Gator96100 Date: Mon, 5 Oct 2020 05:10:25 +0200 Subject: [PATCH] Appveyor cache fixes --- appveyor.yml | 141 +++++++++++++++++++++++++++------------------------ 1 file changed, 74 insertions(+), 67 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8a89d1c14..71b2e709b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,6 +35,78 @@ init: # iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) clone_script: +- 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 + } + + $WSLjob = Start-Job -Name WSLInstall -ScriptBlock { + 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" + 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 1>/dev/null" + WSLExec "WSL QT fix..." "sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5" + Add-AppveyorMessage -Message "WSL setup took $(([System.Environment]::TickCount-$WSLInstallTime) / 1000) sec" -Category Information + } + + Write-Host "ProxSpace: Removing folder..." -NoNewLine + + 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 + + $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 + + 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: - ps: >- Function ExecUpdate($Text, $firstStart) { @@ -77,27 +149,10 @@ clone_script: } Start-Sleep -s 5 - Receive-Job -Job $WSLjob + Receive-Job -Name WSLInstall } } - $WSLjob = Start-Job -Name WSLInstall -ScriptBlock { - 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" - 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 1>/dev/null" - WSLExec "WSL QT fix..." "sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5" - Add-AppveyorMessage -Message "WSL setup took $(([System.Environment]::TickCount-$WSLInstallTime) / 1000) sec" -Category Information - } - Function GitClone($Text, $Folder) { Write-Host "$Text" -NoNewLine if(-not $env:appveyor_pull_request_number) { @@ -113,46 +168,12 @@ clone_script: Write-Host "[ OK ]" -ForegroundColor Green } - Write-Host "ProxSpace: Removing folder..." -NoNewLine - $PSInstallTime=[System.Environment]::TickCount - cd \ - - 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 - - Receive-Job -Job $WSLjob - - Write-Host "ProxSpace: extracting..." -NoNewLine - - Expand-Archive -LiteralPath "$env:proxspace_zip_file" -DestinationPath "\" - - Remove-Item "$env:proxspace_zip_file" - - Write-Host "[ OK ]" -ForegroundColor Green - - Receive-Job -Job $WSLjob - - 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 Write-Host "ProxSpace: move cache..." -NoNewLine - "dummy" > C\cache\update_cache.txt - Move-Item -Path "C:\cache" -Destination "$env:proxspace_path\msys2\var\cache" -Force Get-ChildItem "C:\" @@ -163,24 +184,10 @@ clone_script: ExecUpdate "ProxSpace: initial msys2 startup..." $true - ExecUpdate "ProxSpace: 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 + ExecUpdate "ProxSpace: installing required packages..." $false Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$PSInstallTime) / 1000) sec" -Category Information - - 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 - - Get-ChildItem "C:\cache\" - - Get-ChildItem "$env:proxspace_path\msys2\var\cache\pacman\pkg\" - -install: build_script: - ps: >-