# .github/workflows/ci.yml name: CI on: push: branches: [ main ] pull_request: branches: [ main ] workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - name: Checkout (with submodules) uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - name: Cache Rust toolchain uses: actions/cache@v4 with: path: | ~/.rustup/toolchains ~/.rustup/update-hashes ~/.rustup/settings.toml key: ${{ runner.os }}-rustup-${{ hashFiles('rust-toolchain.toml') }} restore-keys: | ${{ runner.os }}-rustup- - name: Cache cargo registry and index uses: actions/cache@v4 with: path: | ~/.cargo/registry/index ~/.cargo/registry/cache ~/.cargo/git/db key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-registry- - name: Cache target directory uses: actions/cache@v4 with: path: target key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/*.rs') }} restore-keys: | ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}- ${{ runner.os }}-target- - name: Setup Node.js (LTS) uses: actions/setup-node@v4 with: node-version: 20 cache: npm cache-dependency-path: ui/package-lock.json - name: Cache Node.js modules uses: actions/cache@v4 with: path: | ui/node_modules ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('ui/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Cache Rust build artifacts uses: actions/cache@v4 with: path: | target/debug/deps target/debug/build target/debug/.fingerprint key: ${{ runner.os }}-rust-build-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/*.rs') }} restore-keys: | ${{ runner.os }}-rust-build-${{ hashFiles('**/Cargo.lock') }}- ${{ runner.os }}-rust-build- - name: Install UI deps working-directory: ui run: | if [ -f package-lock.json ]; then npm ci else npm install fi - name: Build run: cargo build --verbose - name: Run tests run: cargo test --verbose - name: Lint (clippy) run: cargo clippy -- -D warnings - name: Format check run: cargo fmt -- --check