Skip to content

Commit 81d5e8a

Browse files
committed
Merge remote-tracking branch 'origin/main' into gpui/export-loudness
# Conflicts: # apps/desktop-gpui/src/editor_export.rs # apps/desktop-gpui/src/editor_tabs.rs
2 parents c10f698 + af9a65a commit 81d5e8a

463 files changed

Lines changed: 85736 additions & 13170 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.config/nextest.toml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ filter = '(binary_id(cap-verify::crash) and test(=crash_safety)) or (binary_id(c
4848
threads-required = "num-test-threads"
4949
priority = 100
5050

51+
# Playback and seek ask for each frame with a deadline (2 s, 10 s for a
52+
# seek's first frame). On the blacksmith macOS VMs, Apple's video decoding
53+
# stalls once every core is busy: a standalone AVAssetReader read went from
54+
# 0.4 ms to 55-77 ms a frame with all 6 cores loaded, and stayed under 1 ms
55+
# with half of them loaded (a real Mac and the hosted macos-15 VM are
56+
# unaffected). Shared with the export and chaos tests, frames then missed
57+
# their deadline ("decoders returned no frame"), so on macOS these run alone,
58+
# after the wall-clock tests.
59+
[[profile.ci.overrides]]
60+
platform = 'cfg(target_os = "macos")'
61+
filter = '(binary_id(cap-verify::playback) and not test(=realtime_loop)) or binary_id(cap-verify::seek)'
62+
threads-required = "num-test-threads"
63+
priority = 90
5164

5265
# The FULL-tier seek storms (3000 seeks per decoder) are the slowest tests:
5366
# on the macos-15 runner one storm fixture takes 240 to 570 s per decoder,

‎.github/workflows/ci.yml‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ jobs:
159159
__tests__/unit/space-page-round-trips.test.ts
160160
__tests__/unit/speed-controller-playback-failure.test.ts
161161
__tests__/unit/speed-controller.test.ts
162+
__tests__/unit/summary-chapters.test.ts
162163
__tests__/unit/summary-editor.test.ts
163164
__tests__/unit/sso-login-pages.test.ts
164165
__tests__/unit/timeline-paused-window.test.ts
@@ -420,6 +421,7 @@ jobs:
420421
cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked --target ${{ matrix.settings.target }} --bin cap-gpui
421422
fi
422423
cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked --target ${{ matrix.settings.target }} -p cap-gpui-kernels
424+
cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked --target ${{ matrix.settings.target }} -p cap-glass
423425
cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked --target ${{ matrix.settings.target }} -p cap-i18n-build
424426
425427
# Cap only builds gpui's crates as dependencies, so their own tests never run
@@ -481,7 +483,20 @@ jobs:
481483
WGPU_BACKEND=gl cargo +1.95.0 test -p gpui_wgpu --lib wgpu_atlas -- --nocapture
482484
elif [[ "$RUNNER_OS" == "macOS" ]]; then
483485
cargo +1.95.0 test -p gpui_wgpu --lib wgpu_atlas -- --nocapture
484-
cargo +1.95.0 test -p gpui_macos --lib -- metal_atlas metal_renderer
486+
# Run under lldb: a SIGSEGV in these tests (1 run in about 36 so
487+
# far) leaves no Rust backtrace, and Blacksmith's macOS VMs write
488+
# no crash reports. lldb exits 0 whatever the tests return, so
489+
# pass their exit status through.
490+
exe=$(cargo +1.95.0 test -p gpui_macos --lib --no-run --message-format json \
491+
| jq -r 'select(.reason == "compiler-artifact" and .target.name == "gpui_macos" and .profile.test) | .executable' | tail -1)
492+
lldb --batch -o "process launch" -k "thread backtrace all" -k "quit 1" \
493+
-- "$exe" metal_atlas metal_renderer 2>&1 | tee "$RUNNER_TEMP/gpui-macos-tests.log"
494+
if grep -q "stop reason = " "$RUNNER_TEMP/gpui-macos-tests.log"; then
495+
echo "::error::gpui_macos tests crashed; the backtrace is above"
496+
exit 1
497+
fi
498+
status=$(sed -n 's/.*exited with status = \([0-9]*\).*/\1/p' "$RUNNER_TEMP/gpui-macos-tests.log" | tail -1)
499+
[[ "$status" == 0 ]] || { echo "::error::gpui_macos tests exited with status ${status:-unknown}"; exit 1; }
485500
else
486501
cargo +1.95.0 test -p gpui_windows --lib directx_atlas
487502
fi

‎.github/workflows/database-profile-reliability.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
run: >-
5454
bun test
5555
scripts/loops/activation.test.ts
56+
scripts/loops/batch.test.ts
5657
scripts/loops/sources.test.ts
5758
scripts/loops/profile.test.ts
5859
scripts/loops/lifecycle.test.ts

‎.github/workflows/desktop-release.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,17 @@ jobs:
745745
echo "::error::The Cap AppImage bundles PipeWire that can conflict with host ALSA plugins"
746746
exit 1
747747
fi
748+
if [[ -n "$(find "$APPROOT/usr/lib" -maxdepth 1 -name 'libva*.so*' -print -quit)" ]]; then
749+
echo "::error::The Cap AppImage puts its libva where Cap loads it ahead of the host's, which breaks host PipeWire plugins"
750+
exit 1
751+
fi
752+
test -e "$APPROOT/usr/lib/cap/libva/libva.so.2"
753+
test -e "$APPROOT/usr/lib/cap/libva/libva-drm.so.2"
754+
grep -qx 'exec "$cap_appdir/usr/bin/Cap" "$@"' "$APPROOT/AppRun"
755+
if grep -q 'AppRun.cap-original' "$APPROOT/AppRun"; then
756+
echo "::error::The Cap AppImage still starts through the generic AppImage launcher"
757+
exit 1
758+
fi
748759
749760
- name: Build Arch Linux package
750761
id: build_arch

‎.github/workflows/docker-build-media-server.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ jobs:
129129
src/__tests__/lib/media-routes-real-world.integration.test.ts
130130
docker run --rm --network none --entrypoint bun "$MEDIA_IMAGE" test \
131131
src/__tests__/lib/media-video.integration.test.ts
132+
docker run --rm --network none --entrypoint bun "$MEDIA_IMAGE" test \
133+
src/__tests__/lib/video-input-validation.integration.test.ts
134+
docker run --rm --network none --entrypoint bun "$MEDIA_IMAGE" test \
135+
src/__tests__/loom-importer/
132136
133137
- name: Verify long recording performance in the production image
134138
env:

‎.github/workflows/engine-verify-os.yml‎

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,26 @@ jobs:
185185
shell: bash
186186
run: touch "$RUNNER_TEMP/crash-reports-since"
187187

188+
# A test process that crashes on Windows (0xc0000005) leaves nothing:
189+
# Git Bash starts run.sh's children with crash reporting off. Tests run
190+
# through PowerShell instead (scripts/verify/native-launch.ps1, about
191+
# 1 s per test process), and Windows keeps a dump of any crash.
192+
- name: Keep Windows crash dumps
193+
if: inputs.platform == 'windows'
194+
shell: pwsh
195+
run: |
196+
$dir = "$env:RUNNER_TEMP\verify-report\crash-dumps"
197+
New-Item -ItemType Directory -Force $dir | Out-Null
198+
$key = "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps"
199+
New-Item -Path $key -Force | Out-Null
200+
New-ItemProperty -Path $key -Name DumpFolder -Value $dir -PropertyType ExpandString -Force | Out-Null
201+
New-ItemProperty -Path $key -Name DumpType -Value 1 -PropertyType DWord -Force | Out-Null
202+
New-ItemProperty -Path $key -Name DumpCount -Value 10 -PropertyType DWord -Force | Out-Null
203+
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name DontShowUI -Value 1 -Type DWord
204+
Start-Service WerSvc
205+
$launcher = Join-Path $env:GITHUB_WORKSPACE "scripts\verify\native-launch.ps1"
206+
"CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER=powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File $launcher" | Out-File -Append -Encoding utf8 $env:GITHUB_ENV
207+
188208
- name: Prepare recorded fixtures without concurrent rendering
189209
if: contains(format(',{0},', inputs.suites), ',export,')
190210
shell: bash
@@ -243,8 +263,25 @@ jobs:
243263
echo "collected=true" >> "$GITHUB_OUTPUT"
244264
fi
245265
266+
- name: Print Windows crash stacks
267+
id: windows-crash-dumps
268+
if: failure() && inputs.platform == 'windows'
269+
continue-on-error: true
270+
shell: bash
271+
run: |
272+
cdb="/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/cdb.exe"
273+
symbols="$(cygpath -w "$GITHUB_WORKSPACE/target/$CAP_VERIFY_CARGO_PROFILE/deps");srv*$(cygpath -w "$RUNNER_TEMP/symbols")*https://msdl.microsoft.com/download/symbols"
274+
for dump in "$RUNNER_TEMP"/verify-report/crash-dumps/*.dmp; do
275+
[[ -f "$dump" ]] || continue
276+
echo "::group::$(basename "$dump")"
277+
"$cdb" -z "$(cygpath -w "$dump")" -y "$symbols" -c ".ecxr; kn 40; q" 2>&1 |
278+
grep -E 'Access violation|code [0-9a-f]{8} |^[^ ]+![^ ]+.*:$|^ # Child-SP|^[0-9a-f]{2} ' | head -60
279+
echo "::endgroup::"
280+
echo "collected=true" >> "$GITHUB_OUTPUT"
281+
done
282+
246283
- name: Upload report
247-
if: always() && (steps.test.outcome != 'skipped' || steps.crash-reports.outputs.collected == 'true')
284+
if: always() && (steps.test.outcome != 'skipped' || steps.crash-reports.outputs.collected == 'true' || steps.windows-crash-dumps.outputs.collected == 'true')
248285
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
249286
with:
250287
name: verify-report-${{ inputs.platform }}-${{ inputs.tier }}-${{ matrix.shard }}

‎.github/workflows/glass-probe.yml‎

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
name: Glass probe (real app)
2+
# Draws Cap Glass in the real GPUI app on macOS (Metal), Windows (Direct3D 11
3+
# on WARP) and Linux (wgpu on lavapipe), captures the window and scores every
4+
# scene and preset against the CPU model in apps/desktop-gpui/glass, which is
5+
# fitted to Apple's own glass.
6+
7+
on:
8+
pull_request:
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
paths:
11+
- "apps/desktop-gpui/glass/**"
12+
- "apps/desktop-gpui/patches/zed-glass.patch"
13+
- "apps/desktop-gpui/src/ui/glass.rs"
14+
- "apps/desktop-gpui/src/glass_probe.rs"
15+
- "scripts/glass-probe/**"
16+
- ".github/workflows/glass-probe.yml"
17+
workflow_dispatch:
18+
19+
permissions:
20+
contents: read
21+
pull-requests: read
22+
23+
concurrency:
24+
group: glass-probe-${{ github.event.pull_request.number || github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
# A pull request from a fork that changes only this workflow or the probe's
29+
# scripts does not queue the three-runner matrix; one that also changes the
30+
# glass itself does, and so does any change from this repository.
31+
scope:
32+
name: Scope
33+
runs-on: blacksmith-2vcpu-ubuntu-2404
34+
timeout-minutes: 5
35+
outputs:
36+
run: ${{ steps.scope.outputs.run }}
37+
steps:
38+
- name: Scope
39+
id: scope
40+
env:
41+
GH_TOKEN: ${{ github.token }}
42+
EVENT: ${{ github.event_name }}
43+
PR: ${{ github.event.pull_request.number }}
44+
SAME_REPO: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
45+
run: |
46+
set -euo pipefail
47+
if [[ "$EVENT" != pull_request || "$SAME_REPO" == true ]]; then
48+
echo "run=true" >> "$GITHUB_OUTPUT"; exit 0
49+
fi
50+
gh api "repos/$GITHUB_REPOSITORY/pulls/$PR/files" --paginate --jq '.[].filename' > "$RUNNER_TEMP/changed.txt"
51+
glass='^apps/desktop-gpui/(glass/.*|patches/zed-glass\.patch|src/ui/glass\.rs|src/glass_probe\.rs)$'
52+
if grep -qE "$glass" "$RUNNER_TEMP/changed.txt"; then
53+
echo "run=true" >> "$GITHUB_OUTPUT"
54+
else
55+
echo "run=false" >> "$GITHUB_OUTPUT"
56+
echo "A fork pull request that changes no glass code does not run the glass probe." | tee -a "$GITHUB_STEP_SUMMARY"
57+
fi
58+
59+
probe:
60+
name: Glass probe (${{ matrix.settings.name }})
61+
needs: scope
62+
if: needs.scope.outputs.run == 'true'
63+
timeout-minutes: 75
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
settings:
68+
- name: macOS
69+
slug: macos
70+
target: aarch64-apple-darwin
71+
runner: blacksmith-6vcpu-macos-15
72+
- name: Windows
73+
slug: windows
74+
target: x86_64-pc-windows-msvc
75+
runner: windows-2022
76+
- name: Linux X11
77+
slug: linux-x11
78+
target: x86_64-unknown-linux-gnu
79+
runner: blacksmith-8vcpu-ubuntu-2404
80+
runs-on: ${{ matrix.settings.runner }}
81+
env:
82+
CARGO_PROFILE_DEV_DEBUG: "0"
83+
steps:
84+
- name: Checkout repository
85+
uses: actions/checkout@v4
86+
87+
- name: Install Linux desktop dependencies
88+
if: ${{ runner.os == 'Linux' }}
89+
uses: ./.github/actions/install-desktop-deps
90+
91+
- name: Install a window manager and software Vulkan
92+
if: ${{ runner.os == 'Linux' }}
93+
run: sudo apt-get install -y openbox mesa-vulkan-drivers libvulkan1
94+
95+
- name: Rust setup
96+
uses: dtolnay/rust-toolchain@1.95.0
97+
with:
98+
targets: ${{ matrix.settings.target }}
99+
100+
- uses: ./.github/actions/setup-rust-cache
101+
with:
102+
target: ${{ matrix.settings.target }}
103+
prefix-key: v1-rust-gpui
104+
save-cache: "false"
105+
workspaces: apps/desktop-gpui -> target
106+
107+
- name: Run setup
108+
shell: bash
109+
run: node scripts/setup.js
110+
env:
111+
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
112+
113+
- name: Prepare GPUI dependency
114+
shell: bash
115+
run: |
116+
node scripts/sync-desktop-versions.mjs
117+
./scripts/prepare-gpui-dependency.sh
118+
119+
- name: Test the glass model
120+
shell: bash
121+
run: cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked -p cap-glass
122+
123+
- name: Build the app
124+
shell: bash
125+
run: |
126+
cargo +1.95.0 build --manifest-path apps/desktop-gpui/Cargo.toml --locked \
127+
--target ${{ matrix.settings.target }} --bin cap-gpui
128+
if [[ "$RUNNER_OS" == "macOS" ]]; then
129+
for frameworks in "$GITHUB_WORKSPACE/apps/desktop-gpui/target/${{ matrix.settings.target }}/debug/Frameworks" \
130+
"$GITHUB_WORKSPACE/apps/desktop-gpui/target/${{ matrix.settings.target }}/Frameworks"; do
131+
mkdir -p "$frameworks"
132+
ln -sfn "$GITHUB_WORKSPACE/target/Frameworks/Spacedrive.framework" "$frameworks/Spacedrive.framework"
133+
done
134+
fi
135+
136+
- name: Screen capture permission
137+
if: ${{ runner.os == 'macOS' }}
138+
run: |
139+
set -euo pipefail
140+
sudo pmset -a displaysleep 0 sleep 0 || true
141+
caffeinate -u -t 2
142+
app="$GITHUB_WORKSPACE/apps/desktop-gpui/target/${{ matrix.settings.target }}/debug/cap-gpui"
143+
db="/Library/Application Support/com.apple.TCC/TCC.db"
144+
now=$(date +%s)
145+
for client in "$app" /bin/bash /Users/runner/bin/Runner.Worker /Users/runner/bin/Runner.Listener; do
146+
sudo sqlite3 "$db" "INSERT OR REPLACE INTO access (service,client,client_type,auth_value,auth_reason,auth_version,indirect_object_identifier,flags,last_modified) VALUES ('kTCCServiceScreenCapture','$client',1,2,4,1,'UNUSED',0,$now);"
147+
done
148+
sudo killall tccd || true
149+
sleep 2
150+
151+
- name: Glass probe
152+
shell: bash
153+
run: |
154+
app="$GITHUB_WORKSPACE/apps/desktop-gpui/target/${{ matrix.settings.target }}/debug/cap-gpui"
155+
out="$RUNNER_TEMP/glass-probe"
156+
case "$RUNNER_OS" in
157+
macOS)
158+
scripts/glass-probe/run.sh "$app" "$out"
159+
;;
160+
Windows)
161+
export PATH="$(cygpath "$GITHUB_WORKSPACE/target/debug"):$PATH"
162+
scripts/glass-probe/run.sh "$app.exe" "$out"
163+
;;
164+
Linux)
165+
export LD_LIBRARY_PATH="$GITHUB_WORKSPACE/target/native-deps/lib:$GITHUB_WORKSPACE/target/debug${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
166+
Xvfb :99 -screen 0 1920x1080x24 -noreset &
167+
export DISPLAY=:99
168+
sleep 1
169+
openbox &
170+
sleep 1
171+
scripts/glass-probe/run.sh "$app" "$out"
172+
;;
173+
esac
174+
175+
- name: Upload captures
176+
if: always()
177+
uses: actions/upload-artifact@v4
178+
with:
179+
name: glass-probe-${{ matrix.settings.slug }}
180+
path: ${{ runner.temp }}/glass-probe
181+
retention-days: 7
182+
183+
# The probed build itself, so the same binary can run on machines with
184+
# real GPUs (the hosted runners draw on WARP and lavapipe).
185+
- name: Stage the build
186+
if: ${{ success() && runner.os != 'macOS' }}
187+
shell: bash
188+
run: |
189+
out="$RUNNER_TEMP/cap-gpui-build"
190+
mkdir -p "$out"
191+
bin="$GITHUB_WORKSPACE/apps/desktop-gpui/target/${{ matrix.settings.target }}/debug/cap-gpui"
192+
if [[ "$RUNNER_OS" == Windows ]]; then
193+
cp "$bin.exe" "$out/"
194+
cp "$GITHUB_WORKSPACE"/target/debug/*.dll "$out/" 2>/dev/null || true
195+
else
196+
cp "$bin" "$out/"
197+
cp -r "$GITHUB_WORKSPACE/target/native-deps/lib" "$out/lib" 2>/dev/null || true
198+
fi
199+
200+
- name: Upload the build
201+
if: ${{ success() && runner.os != 'macOS' }}
202+
uses: actions/upload-artifact@v4
203+
with:
204+
name: cap-gpui-debug-${{ matrix.settings.slug }}
205+
path: ${{ runner.temp }}/cap-gpui-build
206+
if-no-files-found: ignore
207+
retention-days: 3

0 commit comments

Comments
 (0)