|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Run on pushes and pull requests targeting the default branch. |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [master] |
| 7 | + pull_request: |
| 8 | + branches: [master] |
| 9 | + |
| 10 | +# Cancel an in-progress run when a newer commit is pushed to the same |
| 11 | +# branch/PR so we don't waste runners on superseded work. |
| 12 | +concurrency: |
| 13 | + group: ci-${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + # --------------------------------------------------------------------------- |
| 18 | + # Frontend: type-check (svelte-check) and unit tests (vitest). |
| 19 | + # Runs on Linux because the JS toolchain has no platform-specific needs here. |
| 20 | + # --------------------------------------------------------------------------- |
| 21 | + frontend: |
| 22 | + name: Frontend (check + test) |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 27 | + with: |
| 28 | + # Binary assets (png/ico/icns/...) are stored in Git LFS. |
| 29 | + lfs: true |
| 30 | + |
| 31 | + # pnpm must be installed before setup-node so the pnpm cache can resolve. |
| 32 | + # The pnpm version comes from package.json's "packageManager" field. |
| 33 | + - name: Setup pnpm |
| 34 | + uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 |
| 35 | + with: |
| 36 | + run_install: false |
| 37 | + |
| 38 | + - name: Setup Node |
| 39 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 40 | + with: |
| 41 | + node-version: 26 |
| 42 | + cache: pnpm |
| 43 | + |
| 44 | + - name: Install dependencies |
| 45 | + run: pnpm install --frozen-lockfile |
| 46 | + |
| 47 | + # `check` chains `svelte-kit sync` first, so generated types exist. |
| 48 | + - name: Type-check |
| 49 | + run: pnpm check |
| 50 | + |
| 51 | + - name: Unit tests |
| 52 | + run: pnpm test |
| 53 | + |
| 54 | + # --------------------------------------------------------------------------- |
| 55 | + # Rust: format, lint and test the Tauri crate. |
| 56 | + # Runs on Windows (the app's target) to avoid installing Tauri's Linux |
| 57 | + # system dependencies (webkit2gtk, etc.). Uses the runner's preinstalled |
| 58 | + # rustup and the official actions/cache, no third-party actions. |
| 59 | + # --------------------------------------------------------------------------- |
| 60 | + rust: |
| 61 | + name: Rust (fmt + clippy + test) |
| 62 | + runs-on: windows-latest |
| 63 | + defaults: |
| 64 | + run: |
| 65 | + # All cargo steps operate inside the Tauri crate. |
| 66 | + working-directory: src-tauri |
| 67 | + steps: |
| 68 | + - name: Checkout |
| 69 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 70 | + with: |
| 71 | + lfs: true |
| 72 | + |
| 73 | + # rustup ships preinstalled on GitHub runners; just select stable and |
| 74 | + # ensure the components we lint with are present. |
| 75 | + - name: Set up Rust |
| 76 | + run: | |
| 77 | + rustup default stable |
| 78 | + rustup component add rustfmt clippy |
| 79 | +
|
| 80 | + # Cache the cargo registry/git deps and the crate's target dir. |
| 81 | + - name: Cache cargo |
| 82 | + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 83 | + with: |
| 84 | + path: | |
| 85 | + ~/.cargo/registry |
| 86 | + ~/.cargo/git |
| 87 | + src-tauri/target |
| 88 | + key: ${{ runner.os }}-cargo-${{ hashFiles('src-tauri/Cargo.lock') }} |
| 89 | + restore-keys: | |
| 90 | + ${{ runner.os }}-cargo- |
| 91 | +
|
| 92 | + - name: Format check |
| 93 | + run: cargo fmt --all -- --check |
| 94 | + |
| 95 | + - name: Clippy |
| 96 | + run: cargo clippy --all-targets -- -D warnings |
| 97 | + |
| 98 | + - name: Tests |
| 99 | + run: cargo test |
0 commit comments