YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(ci): isolate and accelerate Windows release caches
Ezra Ellette0a017c0390a3
diff --git a/.github/actions/setup-persistent-windows-cache/action.yml b/.github/actions/setup-persistent-windows-cache/action.ymlindex 2ae847e13..93308acc3 100644--- a/.github/actions/setup-persistent-windows-cache/action.yml+++ b/.github/actions/setup-persistent-windows-cache/action.yml@@ -9,6 +9,9 @@ inputs:target:description: Rust compilation target for this job.required: true+ flavor:+ description: Release flavor whose feature-specific compiler state must stay isolated.+ required: trueruns:using: composite@@ -17,11 +20,16 @@ runs:shell: pwshenv:SCREENPIPE_RELEASE_TARGET: ${{ inputs.target }}+ SCREENPIPE_RELEASE_FLAVOR: ${{ inputs.flavor }}run: |$ErrorActionPreference = 'Stop'+ if ($env:SCREENPIPE_RELEASE_FLAVOR -notin @('consumer', 'enterprise')) {+ throw "Unsupported release flavor: $env:SCREENPIPE_RELEASE_FLAVOR"+ }+$cacheRoot = 'S:\screenpipe-cache'- $persistentTarget = "$cacheRoot\targets-v2\$env:SCREENPIPE_RELEASE_TARGET"+ $persistentTarget = "$cacheRoot\targets-v3\$env:SCREENPIPE_RELEASE_FLAVOR\$env:SCREENPIPE_RELEASE_TARGET"$workspaceTarget = "$env:GITHUB_WORKSPACE\apps\screenpipe-app-tauri\src-tauri\target"$workspaceNodeModules = "$env:GITHUB_WORKSPACE\apps\screenpipe-app-tauri\node_modules"$workspaceTauri = "$env:GITHUB_WORKSPACE\apps\screenpipe-app-tauri\.tauri"@@ -34,7 +42,8 @@ runs:"$cacheRoot\bun","$cacheRoot\native-deps",$persistentTarget,- "$cacheRoot\tauri\$env:SCREENPIPE_RELEASE_TARGET"+ "$cacheRoot\tauri-v2\$env:SCREENPIPE_RELEASE_FLAVOR\$env:SCREENPIPE_RELEASE_TARGET",+ "$cacheRoot\signed-binaries-v1") | ForEach-Object { New-Item -ItemType Directory -Force -Path $_ | Out-Null }# Bundle output is release-specific. Compiler outputs and downloads stay warm.@@ -56,7 +65,7 @@ runs:if ($LASTEXITCODE -ne 0) { throw 'failed to create persistent short target junction' }cmd /c mklink /J $workspaceTarget $shortTargetif ($LASTEXITCODE -ne 0) { throw 'failed to attach workspace target junction' }- cmd /c mklink /J $workspaceTauri "$cacheRoot\tauri\$env:SCREENPIPE_RELEASE_TARGET"+ cmd /c mklink /J $workspaceTauri "$cacheRoot\tauri-v2\$env:SCREENPIPE_RELEASE_FLAVOR\$env:SCREENPIPE_RELEASE_TARGET"if ($LASTEXITCODE -ne 0) { throw 'failed to attach persistent Tauri cache' }@(@@ -66,7 +75,8 @@ runs:"SCCACHE_DIR=$cacheRoot\sccache",'RUSTC_WRAPPER=sccache',"BUN_INSTALL_CACHE_DIR=$cacheRoot\bun",- "SCREENPIPE_NATIVE_CACHE_DIR=$cacheRoot\native-deps"+ "SCREENPIPE_NATIVE_CACHE_DIR=$cacheRoot\native-deps",+ "SCREENPIPE_SIGNED_BINARY_CACHE_DIR=$cacheRoot\signed-binaries-v1") | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append"$cacheRoot\cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Appenddiff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.ymlindex 64cbcb1e6..d2ff6b0fe 100644--- a/.github/workflows/release-app.yml+++ b/.github/workflows/release-app.yml@@ -239,6 +239,7 @@ jobs:uses: ./.release-workflow/.github/actions/setup-persistent-windows-cachewith:target: ${{ matrix.target }}+ flavor: consumer- name: Shorten target dir to avoid MAX_PATH (Windows)if: runner.environment == 'github-hosted' && matrix.os_type == 'windows'diff --git a/.github/workflows/release-enterprise.yml b/.github/workflows/release-enterprise.ymlindex 5c61af94e..5acd42333 100644--- a/.github/workflows/release-enterprise.yml+++ b/.github/workflows/release-enterprise.yml@@ -110,6 +110,7 @@ jobs:uses: ./.release-workflow/.github/actions/setup-persistent-windows-cachewith:target: x86_64-pc-windows-msvc+ flavor: enterprise- name: Enable Git long paths on Windowsshell: pwshdiff --git a/apps/screenpipe-app-tauri/src-tauri/sign-ssl.ps1 b/apps/screenpipe-app-tauri/src-tauri/sign-ssl.ps1index d8a6a993f..b74896ae8 100644--- a/apps/screenpipe-app-tauri/src-tauri/sign-ssl.ps1+++ b/apps/screenpipe-app-tauri/src-tauri/sign-ssl.ps1@@ -68,6 +68,71 @@ if (-not ($signableExts -contains $ext)) {$requiresExeAlias = $true}+function Test-ScreenpipeAuthenticodeSignature {+ param(+ [Parameter(Mandatory=$true)]+ [string]$Path+ )++ try {+ $signature = Get-AuthenticodeSignature $Path -ErrorAction Stop+ if ($signature.Status -eq 'Valid') {+ return $true+ }+ Write-Host "WARN: Authenticode status is $($signature.Status): $Path"+ } catch {+ # Windows ARM64 hosted runners can find Get-AuthenticodeSignature while+ # failing to autoload Microsoft.PowerShell.Security. The workflow already+ # locates signtool.exe for Tauri, so use the SDK verifier as a fallback.+ Write-Host "WARN: Get-AuthenticodeSignature unavailable: $($_.Exception.Message)"+ $signtoolPath = $env:TAURI_WINDOWS_SIGNTOOL_PATH+ if (-not $signtoolPath) {+ $signtoolCommand = Get-Command signtool.exe -ErrorAction SilentlyContinue+ if ($signtoolCommand) {+ $signtoolPath = $signtoolCommand.Source+ }+ }++ if ($signtoolPath -and (Test-Path $signtoolPath)) {+ & $signtoolPath verify /pa /all $Path | Out-Host+ if ($LASTEXITCODE -eq 0) {+ return $true+ }+ Write-Host "WARN: signtool verification failed with exit $LASTEXITCODE`: $Path"+ } else {+ Write-Host "WARN: PowerShell verifier unavailable and signtool.exe not found"+ }+ }++ return $false+}++$originalFilePath = $FilePath+$signatureCacheFile = $null+if ($env:SCREENPIPE_SIGNED_BINARY_CACHE_DIR -and $env:ESIGNER_CREDENTIAL_ID) {+ New-Item -ItemType Directory -Force -Path $env:SCREENPIPE_SIGNED_BINARY_CACHE_DIR | Out-Null+ $unsignedHash = (Get-FileHash -LiteralPath $originalFilePath -Algorithm SHA256).Hash.ToLowerInvariant()+ $cacheIdentity = "v1|$env:ESIGNER_CREDENTIAL_ID|$unsignedHash"+ $sha256 = [System.Security.Cryptography.SHA256]::Create()+ try {+ $cacheKeyBytes = [System.Text.Encoding]::UTF8.GetBytes($cacheIdentity)+ $signatureCacheKey = ([BitConverter]::ToString($sha256.ComputeHash($cacheKeyBytes))).Replace('-', '').ToLowerInvariant()+ } finally {+ $sha256.Dispose()+ }+ $signatureCacheFile = Join-Path $env:SCREENPIPE_SIGNED_BINARY_CACHE_DIR "$signatureCacheKey.exe"++ if (Test-Path -LiteralPath $signatureCacheFile) {+ if (Test-ScreenpipeAuthenticodeSignature -Path $signatureCacheFile) {+ Copy-Item -LiteralPath $signatureCacheFile -Destination $originalFilePath -Force+ Write-Host "Reused verified signed binary: $originalFilePath"+ exit 0+ }+ Write-Host "WARN: removing invalid signed binary cache entry: $signatureCacheFile"+ Remove-Item -LiteralPath $signatureCacheFile -Force+ }+}+$jarFile = Get-ChildItem $env:CODESIGNTOOL_PATH -Recurse -Filter "code_sign_tool*.jar" | Select-Object -First 1$javaFile = Get-ChildItem $env:CODESIGNTOOL_PATH -Recurse -Filter "java.exe" | Select-Object -First 1@@ -76,7 +141,6 @@ if (-not $jarFile -or -not $javaFile) {exit 1}-$originalFilePath = $FilePath$temporarySigningCopy = $nullif ($requiresExeAlias) {$temporarySigningCopy = "$FilePath.signing.exe"@@ -192,40 +256,8 @@ if (-not $signed) {exit 1}-$signatureValid = $false-$signatureStatus = "unknown"-try {- $signature = Get-AuthenticodeSignature $signedFile -ErrorAction Stop- $signatureStatus = $signature.Status- $signatureValid = ($signature.Status -eq 'Valid')-} catch {- # Windows ARM64 hosted runners can find Get-AuthenticodeSignature while- # failing to autoload Microsoft.PowerShell.Security. The workflow already- # locates signtool.exe for Tauri, so use the SDK verifier as a fallback.- Write-Host "WARN: Get-AuthenticodeSignature unavailable: $($_.Exception.Message)"- $signtoolPath = $env:TAURI_WINDOWS_SIGNTOOL_PATH- if (-not $signtoolPath) {- $signtoolCommand = Get-Command signtool.exe -ErrorAction SilentlyContinue- if ($signtoolCommand) {- $signtoolPath = $signtoolCommand.Source- }- }-- if ($signtoolPath -and (Test-Path $signtoolPath)) {- & $signtoolPath verify /pa /all $signedFile- if ($LASTEXITCODE -eq 0) {- $signatureValid = $true- $signatureStatus = "Valid (signtool fallback)"- } else {- $signatureStatus = "signtool exit $LASTEXITCODE"- }- } else {- $signatureStatus = "PowerShell verifier unavailable and signtool.exe not found"- }-}--if (-not $signatureValid) {- Write-Host "ERROR: signed output failed Authenticode verification (status=$signatureStatus): $signedFile"+if (-not (Test-ScreenpipeAuthenticodeSignature -Path $signedFile)) {+ Write-Host "ERROR: signed output failed Authenticode verification: $signedFile"if (Test-Path $signedDir) {Remove-Item $signedDir -Recurse -Force}@@ -236,6 +268,17 @@ if (-not $signatureValid) {}Copy-Item $signedFile $originalFilePath -Force+if ($signatureCacheFile) {+ $temporaryCacheFile = "$signatureCacheFile.$([Guid]::NewGuid().ToString('N')).tmp"+ try {+ Copy-Item $signedFile $temporaryCacheFile -Force+ Move-Item $temporaryCacheFile $signatureCacheFile -Force+ } finally {+ if (Test-Path -LiteralPath $temporaryCacheFile) {+ Remove-Item -LiteralPath $temporaryCacheFile -Force+ }+ }+}Remove-Item $signedDir -Recurse -Forceif ($temporarySigningCopy -and (Test-Path $temporarySigningCopy)) {Remove-Item $temporarySigningCopy -Force