Build Scripts & CI/CD
Relevant source files
The following files were used as context for generating this wiki page:
The Dotorixel project utilizes a multi-platform build system designed to support Web (SvelteKit + WASM) and Apple native (SwiftUI + Rust static library) targets. The architecture centers around a shared Rust core that is compiled into different formats depending on the target environment.
The pipeline ensures code quality through a combination of git hooks, automated type checking, and comprehensive testing across different environments. Web deployment is automated via Vercel, integrating directly with the GitHub repository.
Sources: CLAUDE.md:1-20, README.md:30-40, tasks/records/001-pre-workflow-migration.md:10-20
Build Architecture
The build process is split into two primary paths: the Web path which generates WebAssembly (WASM) modules, and the Apple path which generates static libraries and Swift bindings.
Web Build Pipeline
The Web pipeline uses bun as the package manager and wasm-pack to compile the Rust core logic into WASM. SvelteKit, configured with adapter-static, handles the UI and generates a Single Page Application (SPA).
The diagram shows the transformation of Rust source code into a deployed web application via the WASM build path.
Sources: CLAUDE.md:12-25, README.md:42-50, tasks/records/001-pre-workflow-migration.md:65-70
Apple Native Build Pipeline
The native pipeline utilizes XcodeGen to manage project files and a custom shell script to bridge the Rust core with SwiftUI.
| Component | Tool / Target | Purpose |
|---|---|---|
| Project Manager | XcodeGen | Generates .xcodeproj from project.yml |
| Binding Generator | UniFFI | Generates Swift bindings from Rust code |
| Target Platforms | macOS, iPadOS | Native Apple operating systems |
| Static Library | libdotorixel_core.a | Compiled Rust logic linked to Xcode targets |
Sources: README.md:38-40, tasks/records/010-xcode-project.md:5-20, issues/013-apple-native-catchup.md:20-25
Development Scripts
The project defines several bun scripts in package.json to streamline the development lifecycle and build processes.
| Command | Action | Description |
|---|---|---|
bun run dev | bun run wasm:build && vite dev | Builds WASM and starts the SvelteKit dev server |
bun run build | bun run wasm:build && vite build | Compiles WASM and creates production web build |
bun run wasm:build | wasm-pack build wasm --target web | Compiles the Rust core specifically for web use |
bun run check | svelte-kit sync && svelte-check | Performs Svelte type checking and syncs manifests |
bun run test | bun run wasm:build && vitest run | Runs unit tests using Vitest after ensuring WASM is ready |
bun run test:e2e | playwright test | Executes End-to-End tests using Playwright |
Sources: package.json:10-25, README.md:54-65, tasks/records/037-landing-page.md:35-40
CI/CD and Quality Assurance
Pre-commit Hooks
The project uses lefthook to enforce code quality before commits are finalized. This ensures that only code passing specific checks enters the version control history.
This diagram illustrates the automated gatekeeping process performed by Lefthook during the commit phase.
Sources: lefthook.yml:1-10, tasks/records/013-fix-svelte-check.md:10-15
Automation and Testing
- Vitest: Acts as the unified test runner for pure functions and WASM integration. It utilizes a setup file (
src/lib/wasm/setup.ts) to initialize the WASM environment for tests. - Playwright: Used for E2E testing, specifically verifying language navigation and multi-locale behavior that cannot be caught by unit tests.
- Vercel: Handles the CI/CD for the web frontend, performing auto-deployment on every push to the
mainbranch. It enforces a Content Security Policy (CSP) viavercel.jsonto secure WASM execution.
Sources: tasks/records/013-fix-svelte-check.md:20-25, tasks/records/037-landing-page.md:45-50, tasks/records/038-privacy-friendly-analytics.md:55-65
Native Shell Build Script
For Apple platforms, a dedicated script (apple/scripts/build-rust.sh) manages the Rust compilation within the Xcode build lifecycle.
# Example logic from the Apple build script
TARGET_ARCH=$ARCHS
if [ "$TARGET_ARCH" = "arm64" ]; then
# Build for Apple Silicon or iPhone
cargo build --manifest-path ../Cargo.toml --target aarch64-apple-ios
fi
The script identifies the target architecture (e.g., arm64, x86_64) and platform provided by Xcode environment variables and executes the corresponding cargo build command with the appropriate target triple.
Sources: apple/scripts/build-rust.sh:1-20, tasks/records/010-xcode-project.md:10-15
Conclusion
Dotorixel's build and CI/CD infrastructure is characterized by its "shared core, multiple shells" philosophy. By centralizing core logic in Rust and automating the bridge to both Web (via WASM) and Apple native (via UniFFI), the project maintains high technical standards while ensuring consistent behavior across all deployment targets.