mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-10-11 20:29:49 -04:00
Fix Windows CI + format (#767)
* Attempt to fix Windows CI: - Ensure version 15 of LLVM is installed in Windows CI (due to` ffmpeg-sys-next`) - Use `GITHUB_TOKEN` in setup-system.ps1 to avoid rate-limiting by github api in Windows CI - Add `yaml` settings to `.editorconfig` - Create a symbolic link from `.prettierignore` to `.eslintignore` - Move `eslint` root to package root config - Enable `fileNesting` to reduce dotfile clutter in vscode - Pass `--strict` to apps/releases `lint` command to avoid making interactive queries and hanging `pnpm lint` - Format with `prettier` and `eslint` - Remove empty interface/hooks/useMediaQuery.ts * Replace unmaintained `actions-rs/toolchain` with `dtolnay/rust-toolchain` - Change setup-system.ps1 to avoid installing pnpm in CI - Change `pnpm/action-setup` to lock only o major versions of the action
This commit is contained in:
1 parent
3c440783b3
commit
c7d182e12b
16 files changed
+146
-76
No files matched your search
@@ -74,6 +74,30 @@ function Add-DirectoryToPath($directory) {
|
||||
Reset-Path
|
||||
}
|
||||
|
||||
function Invoke-RestMethodGithub {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Uri,
|
||||
[string]$Method = 'GET',
|
||||
[hashtable]$Headers = @{},
|
||||
[string]$UserAgent = 'PowerShell'
|
||||
)
|
||||
|
||||
if (![string]::IsNullOrEmpty($env:GITHUB_TOKEN)) {
|
||||
$headers.Add("Authorization", "Bearer $($env:GITHUB_TOKEN)")
|
||||
}
|
||||
|
||||
$params = @{
|
||||
Uri = $Uri
|
||||
Method = $Method
|
||||
Headers = $Headers
|
||||
UserAgent = $UserAgent
|
||||
}
|
||||
|
||||
Invoke-RestMethod @params
|
||||
}
|
||||
|
||||
# Reset PATH to ensure the script doesn't read any stale entries
|
||||
Reset-Path
|
||||
|
||||
@@ -151,7 +175,10 @@ https://learn.microsoft.com/windows/package-manager/winget/
|
||||
|
||||
Write-Host
|
||||
Write-Host 'Checking for pnpm...' -ForegroundColor Yellow
|
||||
if ((Get-Command pnpm -ea 0) -and (pnpm --version | Select-Object -First 1) -match "^$pnpm_major\." ) {
|
||||
if ($env:CI) {
|
||||
# The CI has pnpm installed already
|
||||
Write-Host 'Running with CI, skipping pnpm install.' -ForegroundColor Green
|
||||
}if ((Get-Command pnpm -ea 0) -and (pnpm --version | Select-Object -First 1) -match "^$pnpm_major\." ) {
|
||||
Write-Host "pnpm $pnpm_major is installed." -ForegroundColor Green
|
||||
} else {
|
||||
# Check for pnpm installed with standalone installer
|
||||
@@ -187,12 +214,8 @@ https://pnpm.io/uninstall
|
||||
Write-Host
|
||||
Write-Host 'Checking for LLVM...' -ForegroundColor Yellow
|
||||
if ($env:CI) {
|
||||
# The CI has LLVM installed already, so we instead just set the env variables.
|
||||
Write-Host 'Running with Ci, skipping LLVM install.' -ForegroundColor Green
|
||||
|
||||
# TODO: Check if CI LLVM version match our required major version
|
||||
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
|
||||
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
|
||||
# The CI has LLVM installed already
|
||||
Write-Host 'Running with CI, skipping LLVM install.' -ForegroundColor Green
|
||||
} elseif (
|
||||
(Get-Command clang -ea 0) -and (
|
||||
(clang --version | Select-String -Pattern 'version\s+(\d+)' | ForEach-Object { $_.Matches.Groups[1].Value }) -eq "$llvm_major"
|
||||
@@ -206,7 +229,7 @@ if ($env:CI) {
|
||||
$filenamePattern = '*-win64.exe'
|
||||
|
||||
Write-Host "Downloading LLVM $llvm_major installer..." -ForegroundColor Yellow
|
||||
$releases = Invoke-RestMethod -Uri $releasesUri
|
||||
$releases = Invoke-RestMethodGithub -Uri $releasesUri
|
||||
$downloadUri = $releases | ForEach-Object {
|
||||
if ($_.name -like $llvmVersion) {
|
||||
$_.assets | Where-Object { $_.name -like $filenamePattern } | Select-Object -ExpandProperty 'browser_download_url'
|
||||
@@ -249,7 +272,7 @@ if ($protocVersion) {
|
||||
$filenamePattern = '*-win64.zip'
|
||||
|
||||
Write-Host 'Downloading protobuf compiler...' -ForegroundColor Yellow
|
||||
$releases = Invoke-RestMethod -Uri $releasesUri
|
||||
$releases = Invoke-RestMethodGithub -Uri $releasesUri
|
||||
for ($i = 0; $i -lt $releases.Count; $i++) {
|
||||
$release = $releases[$i]
|
||||
foreach ($asset in $release.assets) {
|
||||
@@ -310,7 +333,7 @@ if (($null -ne $env:FFMPEG_DIR) -and (
|
||||
$filenamePattern = '*-full_build-shared.zip'
|
||||
|
||||
# Downloads a build of ffmpeg from GitHub compatible with the declared ffmpeg-sys-next version
|
||||
$releases = Invoke-RestMethod -Uri $releasesUri
|
||||
$releases = Invoke-RestMethodGithub -Uri $releasesUri
|
||||
$version = $ffmpegVersion
|
||||
while (-not ($filename -and $downloadUri) -and $version) {
|
||||
for ($i = 0; $i -lt $releases.Count; $i++) {
|
||||
|
||||
Reference in new issue
Block a user