Files
wallet/.gitea/workflows/ci.yaml
T
grenadeandClaude Fable 5.1 d951ce07e7
ci / gate (push) Waiting to run
feat(ui): a typed command client, and one file allowed to touch the IPC
Commands now return `Result<T, WalletError>`; Tauri rejects the promise with
the serialised error, and `ui/src/api/wallet.ts` is the one place that turns
it back into a thrown `WalletError` with the same `kind` the Rust enum has.
Anything that is not a `WalletError` is a bug on one side of the boundary and
is rethrown untouched so it is loud.

Screens never call `invoke` themselves. React Query holds what Rust knows,
with retries off (a wallet must not silently retry a command that failed)
and refetch-on-focus off. CI counts the files importing Tauri's IPC module
and fails unless the count is exactly one.

The first command is `app_info`, so the window shows a version that came
across the boundary as a typed struct rather than a string.

Closes #13

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ftBXYuba8ARhQeF74oUgW
2026-09-15 18:07:48 +03:00

59 lines
1.8 KiB
YAML

name: ci
# The quality gate (architecture/generic.md §12): format, lint as error, tests,
# and a frontend that typechecks and builds. Packaging and release live in
# their own workflow once the packaging epic lands.
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
gate:
# `rust-gtk3`, not `rust`: tauri-build links against GTK and WebKitGTK dev
# libraries, which only that image carries (gitea-runners.md §3).
runs-on: rust-gtk3
steps:
- uses: actions/checkout@v4
- name: webview dependencies
working-directory: ui
run: pnpm install --frozen-lockfile
- name: webview gate
working-directory: ui
run: |
set -euo pipefail
pnpm typecheck
pnpm lint
pnpm format:check
pnpm build
- name: rust gate
run: |
set -euo pipefail
cargo fmt --check --all
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
- name: rust talks to the webview through one file
# `ui/src/api/wallet.ts` is the only module allowed to import Tauri's
# IPC. A screen that reaches for `invoke` itself bypasses the typed
# client and its error mapping, and this is where that is caught.
run: |
set -euo pipefail
hits=$(grep -rl "@tauri-apps/api/core" ui/src || true)
if [ "$hits" != "ui/src/api/wallet.ts" ]; then
echo "Tauri IPC imported outside ui/src/api/wallet.ts:"; echo "$hits"; exit 1
fi
- name: generated types are current
# `cargo test` regenerates ui/src/api/generated via ts-rs. A diff here
# means an entities change was committed without its TypeScript.
run: git diff --exit-code -- ui/src/api/generated