mirror of
https://github.com/lahfir/agent-desktop.git
synced 2026-08-05 05:30:21 +00:00
Integrate main-branch changes that landed in parallel with this PR:
- Cargo.toml: keep both [profile.ci] (fast CI builds, from main) and
[profile.release-ffi] (panic=unwind for the cdylib, this branch).
Workspace version tracks main at 0.1.12.
- .github/workflows/ci.yml: keep main's concurrency block, pinned
action SHAs, permissions hardening, and the new ci profile used for
binary size checks; re-add this branch's FFI cdylib build and header
drift check as trailing steps.
- crates/ffi/src/tree/get.rs, observation/{find,is}.rs: TreeOptions
gained a `skeleton: bool` field on main — pass `false` since the FFI
snapshots are already full trees.
- crates/ffi/src/actions/resolve.rs, observation/find.rs: RefEntry
gained a `root_ref: Option<String>` field (progressive skeleton
traversal) — pass `None` from the FFI layer.
- crates/ffi/src/tree/flatten.rs test helper: AccessibilityNode gained
a `children_count: Option<usize>` field — initialize to None.
Verified: 111 workspace lib tests pass, 62 FFI tests pass (52 lib + 10
integration), clippy --all-targets -D warnings clean.
103 lines
3.2 KiB
YAML
103 lines
3.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
# Cancel in-progress runs for the same ref so stale PR builds don't burn minutes.
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
# Deny all permissions at workflow level; each job declares only what it needs.
|
|
permissions: {}
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUST_BACKTRACE: 1
|
|
|
|
jobs:
|
|
fmt:
|
|
name: Format
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- run: rustup component add rustfmt
|
|
- run: cargo fmt --all -- --check
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: macos-latest
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Install Rust toolchain
|
|
run: rustup show
|
|
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
|
|
restore-keys: ${{ runner.os }}-cargo-
|
|
|
|
- name: Cache build artifacts
|
|
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
path: target/
|
|
key: ${{ runner.os }}-build-ci-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/*.rs') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-ci-${{ hashFiles('**/Cargo.toml') }}-
|
|
${{ runner.os }}-build-ci-
|
|
|
|
- name: Check dependency isolation
|
|
run: |
|
|
if cargo tree -p agent-desktop-core 2>/dev/null | grep -E 'agent-desktop-(macos|windows|linux)'; then
|
|
echo "FAIL: core crate depends on platform crates"
|
|
exit 1
|
|
fi
|
|
echo "OK: core crate has no platform dependencies"
|
|
|
|
- name: Clippy
|
|
run: cargo clippy --all-targets -- -D warnings
|
|
|
|
- name: Unit tests
|
|
run: cargo test --lib --workspace
|
|
|
|
# Use the ci profile (no LTO, opt-level 1) — fast compile, still checks the binary builds.
|
|
- name: Build binary (ci profile)
|
|
run: cargo build --profile ci
|
|
|
|
- name: Check binary size
|
|
run: |
|
|
SIZE=$(stat -f%z target/ci/agent-desktop)
|
|
LIMIT=$((15 * 1024 * 1024))
|
|
echo "Binary size: $(du -sh target/ci/agent-desktop | cut -f1)"
|
|
if [ "$SIZE" -gt "$LIMIT" ]; then
|
|
echo "FAIL: binary exceeds 15MB limit (${SIZE} bytes)"
|
|
exit 1
|
|
fi
|
|
echo "OK: binary within 15MB limit"
|
|
|
|
- name: FFI cdylib build (release-ffi profile)
|
|
run: cargo build --profile release-ffi -p agent-desktop-ffi
|
|
|
|
- name: FFI header drift check
|
|
run: |
|
|
if ! git diff --exit-code crates/ffi/include/agent_desktop.h; then
|
|
echo "FAIL: crates/ffi/include/agent_desktop.h is out of date"
|
|
echo "Run 'cargo build -p agent-desktop-ffi' locally and commit the regenerated header."
|
|
exit 1
|
|
fi
|
|
echo "OK: FFI header is in sync with source"
|