Added headless mode, added LLVM installer to ci.

This commit is contained in:
voletro
2022-07-05 11:21:42 +10:00
parent 65ad2bab7e
commit b783c32a04
2 changed files with 56 additions and 31 deletions

View File

@@ -1,12 +1,15 @@
# Get ci parameter to check if running with ci
param(
[Parameter()]
[Switch]$ci
)
# Get temp folder
$temp = [System.IO.Path]::GetTempPath()
# Get current running dir
$currentLocation = $((Get-Location).path)
$Host.UI.RawUI.WindowTitle = "Spacedrive DE Setup (Administrator)"
$Host.UI.RawUI.BackgroundColor = "Black"
# Check to see if a command exists (eg if an app is installed)
Function CheckCommand {
@@ -24,8 +27,6 @@ Function CheckCommand {
}
Clear-Host
Write-Host "Spacedrive Development Environment Setup" -ForegroundColor Magenta
Write-Host @"
@@ -80,7 +81,7 @@ if ($pnpmCheck -eq $false) {
#pnpm installer taken from https://pnpm.io
Invoke-WebRequest https://get.pnpm.io/install.ps1 -useb | Invoke-Expression
# Reset the PATH env variables to make sure pnpm is accessible
# Reset the PATH env variables to make sure pnpm is accessible
$env:PNPM_HOME = [System.Environment]::GetEnvironmentVariable("PNPM_HOME", "User")
$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable("Path", "User"))
@@ -89,29 +90,47 @@ else {
Write-Host "pnpm is installed."
}
Write-Host
Write-Host "Using pnpm to install the latest version of Node..." -ForegroundColor Yellow
Write-Host "This will set your global Node version to the latest!"
Start-Sleep -Milliseconds 150
# A GitHub Action takes care of installing node, so this isn't necessary if running in the ci.
if ($ci -eq $True) {
Write-Host
Write-Host "Running with Ci, skipping Node install." -ForegroundColor Yellow
}
else {
Write-Host
Write-Host "Using pnpm to install the latest version of Node..." -ForegroundColor Yellow
Write-Host "This will set your global Node version to the latest!"
Start-Sleep -Milliseconds 150
# Runs the pnpm command to use the latest version of node, which also installs it
Start-Process -Wait -FilePath "pnpm" -ArgumentList "env use --global latest" -PassThru -Verb runAs
# Runs the pnpm command to use the latest version of node, which also installs it
Start-Process -Wait -FilePath "pnpm" -ArgumentList "env use --global latest" -PassThru -Verb runAs
}
Write-Host
Write-Host "Downloading the LLVM installer..." -ForegroundColor Yellow
# Downloads latest installer for LLVM
$filenamePattern = "*-win64.exe"
$releasesUri = "https://api.github.com/repos/llvm/llvm-project/releases/latest"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like $filenamePattern ).browser_download_url
Start-BitsTransfer -Source $downloadUri -Destination "$temp\llvm.exe"
Write-Host
Write-Host "Running the LLVM installer..." -ForegroundColor Yellow
Write-Host "Please follow the instructions to install LLVM."
Write-Host "Ensure you add LLVM to your PATH."
# We can't run the installer if running in ci, so we install LLVM through a GitHub Action instead.
if ($ci -eq $True) {
Write-Host
Write-Host "Running with Ci, skipping LLVM install." -ForegroundColor Yellow
}
else {
Write-Host
Write-Host "Downloading the LLVM installer..." -ForegroundColor Yellow
# Downloads latest installer for LLVM
$filenamePattern = "*-win64.exe"
$releasesUri = "https://api.github.com/repos/llvm/llvm-project/releases/latest"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like $filenamePattern ).browser_download_url
Start-BitsTransfer -Source $downloadUri -Destination "$temp\llvm.exe"
Write-Host
Write-Host "Running the LLVM installer..." -ForegroundColor Yellow
Write-Host "Please follow the instructions to install LLVM."
Write-Host "Ensure you add LLVM to your PATH."
Start-Process "$temp\llvm.exe" -Wait
}
Start-Process "$temp\llvm.exe" -Wait
Write-Host
Write-Host "Downloading the latest ffmpeg build..." -ForegroundColor Yellow