Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/avatar-restore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Avatar restore

on:
pull_request:
paths:
- 'crates/gui/src/session/avatar/**'
- '.github/workflows/avatar-restore.yml'

permissions:
contents: read

concurrency:
group: avatar-restore-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: line-tables-only

jobs:
compare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libasound2-dev libxkbcommon-dev libxkbcommon-x11-dev \
libwayland-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev \
libxcb-xfixes0-dev libfontconfig1-dev libfreetype6-dev protobuf-compiler
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0
with:
key: ${{ hashFiles('Cargo.toml') }}
save-if: 'false'
# Only avatar implementation files change between measurements. The
# decoder, dependencies, profile, runner and synthetic probe stay fixed.
- name: Measure base implementation
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
base=$(git merge-base HEAD "$BASE_SHA")
echo "Comparing avatar implementation at $base with $(git rev-parse HEAD)"
for file in mod.rs native.rs web.rs; do
git show "$base:crates/gui/src/session/avatar/$file" > "crates/gui/src/session/avatar/$file"
done
python3 - <<'PY'
from pathlib import Path
root = Path('crates/gui/src/session/avatar')
mod = root / 'mod.rs'
text = mod.read_text()
marker = 'mod native;'
assert marker in text
mod.write_text(text.replace(marker, marker + '\n#[cfg(all(test, not(target_family = "wasm")))]\nmod probe;', 1))
native = root / 'native.rs'
text = native.read_text()
marker = 'pub async fn read_persistent(key: &str) -> Option<Vec<u8>> {'
assert marker in text
text = text.replace(marker, marker + '\n #[cfg(test)]\n PERSISTENT_READS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);', 1)
text += '\n#[cfg(test)]\npub(super) static PERSISTENT_READS: portable_atomic::AtomicU64 = portable_atomic::AtomicU64::new(0);\n'
native.write_text(text)
PY
cargo test -p oxidezap-gui --bin oxidezap --locked native_restore_probe -- --ignored --nocapture
OXIDEZAP_AVATAR_PROBE_FORMAT=jpeg cargo test -p oxidezap-gui --bin oxidezap --locked native_restore_probe -- --ignored --nocapture
- name: Restore candidate implementation
if: always()
run: git restore --source=HEAD -- crates/gui/src/session/avatar/mod.rs crates/gui/src/session/avatar/native.rs crates/gui/src/session/avatar/web.rs
- name: Test candidate lifecycle and responsiveness
run: |
cargo test -p oxidezap-gui --bin oxidezap --locked session::avatar:: -- --test-threads=1
- name: Measure candidate implementation
run: |
cargo test -p oxidezap-gui --bin oxidezap --locked native_restore_probe -- --ignored --nocapture
OXIDEZAP_AVATAR_PROBE_FORMAT=jpeg cargo test -p oxidezap-gui --bin oxidezap --locked native_restore_probe -- --ignored --nocapture
Loading
Loading