mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2025-12-11 20:15:30 +01: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:
parent
2623843b43
commit
164fcc34d3
@ -66,3 +66,8 @@ indent_style = space
|
||||
[*.prisma]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
|
||||
# YAML
|
||||
# http://yaml.org/spec/1.2/2009-07-21/spec.html#id2576668
|
||||
[*.{yaml,yml}]
|
||||
indent_style = space
|
||||
|
||||
1
.eslintignore
Symbolic link
1
.eslintignore
Symbolic link
@ -0,0 +1 @@
|
||||
.prettierignore
|
||||
2
.github/actions/cache-rust-deps/action.yaml
vendored
2
.github/actions/cache-rust-deps/action.yaml
vendored
@ -4,7 +4,7 @@ inputs:
|
||||
save-cache:
|
||||
description: Whether to save the Rust cache
|
||||
required: false
|
||||
default: "false"
|
||||
default: 'false'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
|
||||
33
.github/actions/setup/action.yml
vendored
33
.github/actions/setup/action.yml
vendored
@ -1,23 +1,44 @@
|
||||
name: Setup
|
||||
description: Sets up runner, Rust and pnpm
|
||||
inputs:
|
||||
token:
|
||||
description: Github token
|
||||
required: false
|
||||
default: ''
|
||||
save-cache:
|
||||
description: Whether to save the Rust cache
|
||||
required: false
|
||||
default: "false"
|
||||
default: 'false'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Install Rust stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
- name: Install Rust
|
||||
id: toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
components: clippy, rustfmt
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2.2.2
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 7.x.x
|
||||
run_install: false
|
||||
|
||||
- name: Cache LLVM and Clang
|
||||
if: runner.os == 'Windows'
|
||||
id: cache-llvm
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: C:/Program Files/LLVM
|
||||
key: llvm-15
|
||||
|
||||
- name: Install LLVM and Clang
|
||||
if: runner.os == 'Windows'
|
||||
uses: KyleMayes/install-llvm-action@v1
|
||||
with:
|
||||
version: '15'
|
||||
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
|
||||
|
||||
- name: Cache Rust deps
|
||||
uses: ./.github/actions/cache-rust-deps
|
||||
@ -33,6 +54,8 @@ runs:
|
||||
shell: powershell
|
||||
if: runner.os == 'Windows'
|
||||
run: ./.github/scripts/setup-system.ps1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
|
||||
- name: Generate Prisma client
|
||||
uses: ./.github/actions/generate-prisma-client
|
||||
|
||||
43
.github/scripts/setup-system.ps1
vendored
43
.github/scripts/setup-system.ps1
vendored
@ -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++) {
|
||||
|
||||
4
.github/workflows/cache-factory.yaml
vendored
4
.github/workflows/cache-factory.yaml
vendored
@ -25,10 +25,10 @@ jobs:
|
||||
|
||||
- uses: ./.github/actions/setup
|
||||
with:
|
||||
save-cache: "true"
|
||||
save-cache: 'true'
|
||||
|
||||
- name: Compile (debug)
|
||||
run: cargo test --workspace --all-features --no-run
|
||||
|
||||
|
||||
- name: Compile (release)
|
||||
run: cargo test --workspace --all-features --no-run --release
|
||||
|
||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -102,6 +102,8 @@ jobs:
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Run Clippy
|
||||
uses: actions-rs/clippy-check@v1
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -24,6 +24,7 @@ packages/*/node_modules
|
||||
packages/*/data
|
||||
apps/*/data
|
||||
apps/*/stats.html
|
||||
apps/releases/.vscode
|
||||
docs/public/*.st
|
||||
docs/public/*.toml
|
||||
dev.db
|
||||
|
||||
16
.vscode/settings.json
vendored
16
.vscode/settings.json
vendored
@ -63,5 +63,19 @@
|
||||
"packages/ui"
|
||||
],
|
||||
"eslint.packageManager": "pnpm",
|
||||
"eslint.lintTask.enable": true
|
||||
"eslint.lintTask.enable": true,
|
||||
"explorer.fileNesting.enabled": true,
|
||||
"explorer.fileNesting.patterns": {
|
||||
"*.ts": "${capture}.js",
|
||||
"*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts",
|
||||
"*.jsx": "${capture}.js",
|
||||
"*.tsx": "${capture}.ts",
|
||||
".npmrc": ".nvmrc, .yarnrc.yml",
|
||||
".gitignore": ".eslintignore, .prettierignore",
|
||||
"README.md": "CONTRIBUTING.md, CODE_OF_CONDUCT.md",
|
||||
"Cargo.toml": "Cargo.lock",
|
||||
".eslintrc.js": ".eslintcache",
|
||||
"package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, pnpm-workspace.yaml, .pnp.cjs, .pnp.loader.mjs",
|
||||
"tsconfig.json": "tsconfig.*.json"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
experimental: {
|
||||
appDir: true,
|
||||
},
|
||||
}
|
||||
experimental: {
|
||||
appDir: true
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = nextConfig
|
||||
module.exports = nextConfig;
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
{
|
||||
"name": "releases",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "18.15.11",
|
||||
"@types/react": "18.0.35",
|
||||
"@types/react-dom": "18.0.11",
|
||||
"@vercel/edge-config": "^0.1.7",
|
||||
"eslint": "^8.38.0",
|
||||
"eslint-config-next": "13.3.0",
|
||||
"next": "13.3.0",
|
||||
"octokit": "^2.0.14",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"typescript": "5.0.4"
|
||||
}
|
||||
"name": "releases",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint --strict"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "18.15.11",
|
||||
"@types/react": "18.0.35",
|
||||
"@types/react-dom": "18.0.11",
|
||||
"@vercel/edge-config": "^0.1.7",
|
||||
"eslint": "^8.38.0",
|
||||
"eslint-config-next": "13.3.0",
|
||||
"next": "13.3.0",
|
||||
"octokit": "^2.0.14",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"typescript": "5.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"~/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"~/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@ -6,14 +6,14 @@ import { dismissibleNoticeStore } from '~/hooks/useDismissibleNoticeStore';
|
||||
import { ExplorerLayoutMode, useExplorerStore } from '~/hooks/useExplorerStore';
|
||||
|
||||
const MediaViewIcon = () => (
|
||||
<div className="relative mr-10 ml-3 h-14 w-14 flex-shrink-0">
|
||||
<div className="relative mr-10 ml-3 h-14 w-14 shrink-0">
|
||||
<img src={Image} className="absolute left-6 -top-1 h-14 w-14 rotate-6 overflow-hidden" />
|
||||
<img src={Video} className="absolute top-2 z-10 h-14 w-14 -rotate-6 overflow-hidden" />
|
||||
</div>
|
||||
);
|
||||
|
||||
const CollectionIcon = () => (
|
||||
<div className="mr-4 ml-3 h-14 w-14 flex-shrink-0">
|
||||
<div className="mr-4 ml-3 h-14 w-14 shrink-0">
|
||||
<img src={Collection} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -52,5 +52,7 @@
|
||||
"yarn": "pnpm",
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"eslintConfig": {}
|
||||
"eslintConfig": {
|
||||
"root": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
const path = require('node:path');
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user