|
| 1 | +name: Test Suite |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + # Rust source and config |
| 8 | + - '**/*.rs' |
| 9 | + - '**/Cargo.toml' |
| 10 | + - '**/Cargo.lock' |
| 11 | + - '**/build.rs' |
| 12 | + # JavaScript source |
| 13 | + - '**/*.js' |
| 14 | + - '**/*.mjs' |
| 15 | + # Frontend assets |
| 16 | + - '**/*.html' |
| 17 | + - '**/*.css' |
| 18 | + # Deno/Node config |
| 19 | + - '**/deno.jsonc' |
| 20 | + - '**/package.json' |
| 21 | + - '**/package-lock.json' |
| 22 | + - '**/vitest.config.js' |
| 23 | + - '**/playwright.config.js' |
| 24 | + # Tauri config |
| 25 | + - '**/tauri.conf.json' |
| 26 | + # Task runner config |
| 27 | + - 'Taskfile.yml' |
| 28 | + - 'taskfiles/**' |
| 29 | + # Test files |
| 30 | + - 'tests/**/*' |
| 31 | + - '**/tests/**/*' |
| 32 | + - '**/__tests__/**/*' |
| 33 | + # CI workflow itself |
| 34 | + - '.github/workflows/test.yml' |
| 35 | + pull_request: |
| 36 | + branches: [main] |
| 37 | + paths: |
| 38 | + # Rust source and config |
| 39 | + - '**/*.rs' |
| 40 | + - '**/Cargo.toml' |
| 41 | + - '**/Cargo.lock' |
| 42 | + - '**/build.rs' |
| 43 | + # JavaScript source |
| 44 | + - '**/*.js' |
| 45 | + - '**/*.mjs' |
| 46 | + # Frontend assets |
| 47 | + - '**/*.html' |
| 48 | + - '**/*.css' |
| 49 | + # Deno/Node config |
| 50 | + - '**/deno.jsonc' |
| 51 | + - '**/package.json' |
| 52 | + - '**/package-lock.json' |
| 53 | + - '**/vitest.config.js' |
| 54 | + - '**/playwright.config.js' |
| 55 | + # Tauri config |
| 56 | + - '**/tauri.conf.json' |
| 57 | + # Task runner config |
| 58 | + - 'Taskfile.yml' |
| 59 | + - 'taskfiles/**' |
| 60 | + # Test files |
| 61 | + - 'tests/**/*' |
| 62 | + - '**/tests/**/*' |
| 63 | + - '**/__tests__/**/*' |
| 64 | + # CI workflow itself |
| 65 | + - '.github/workflows/test.yml' |
| 66 | + |
| 67 | +# Cancel in-progress runs when a new push supersedes them |
| 68 | +concurrency: |
| 69 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 70 | + cancel-in-progress: true |
| 71 | + |
| 72 | +jobs: |
| 73 | + # Linting and code quality |
| 74 | + lint: |
| 75 | + name: Lint and Format Check |
| 76 | + runs-on: ubuntu-latest |
| 77 | + |
| 78 | + steps: |
| 79 | + - name: Checkout code |
| 80 | + uses: actions/checkout@v6 |
| 81 | + |
| 82 | + - name: Install Deno |
| 83 | + uses: denoland/setup-deno@v2 |
| 84 | + with: |
| 85 | + deno-version: v2.x |
| 86 | + |
| 87 | + - name: Check Deno formatting |
| 88 | + run: deno fmt --check |
| 89 | + |
| 90 | + - name: Run Deno lint |
| 91 | + run: deno lint |
| 92 | + |
| 93 | + # Vitest unit tests with coverage |
| 94 | + vitest-tests: |
| 95 | + name: Vitest Unit Tests |
| 96 | + runs-on: ubuntu-latest |
| 97 | + timeout-minutes: 10 |
| 98 | + |
| 99 | + steps: |
| 100 | + - name: Checkout code |
| 101 | + uses: actions/checkout@v6 |
| 102 | + |
| 103 | + - name: Setup Node.js |
| 104 | + uses: actions/setup-node@v4 |
| 105 | + with: |
| 106 | + node-version: '22' |
| 107 | + cache: 'npm' |
| 108 | + cache-dependency-path: src-tauri/dist/package-lock.json |
| 109 | + |
| 110 | + - name: Install frontend dependencies |
| 111 | + working-directory: ./src-tauri/dist |
| 112 | + run: npm ci |
| 113 | + |
| 114 | + - name: Run Vitest with coverage |
| 115 | + working-directory: ./src-tauri/dist |
| 116 | + run: npm run test:coverage |
| 117 | + |
| 118 | + - name: Upload coverage report |
| 119 | + if: always() |
| 120 | + continue-on-error: true |
| 121 | + uses: actions/upload-artifact@v4 |
| 122 | + with: |
| 123 | + name: vitest-coverage |
| 124 | + path: src-tauri/dist/coverage/ |
| 125 | + retention-days: 30 |
| 126 | + |
| 127 | + # Frontend E2E tests with Playwright |
| 128 | + playwright-tests: |
| 129 | + name: Playwright E2E Tests |
| 130 | + runs-on: ubuntu-latest |
| 131 | + timeout-minutes: 20 |
| 132 | + |
| 133 | + steps: |
| 134 | + - name: Checkout code |
| 135 | + uses: actions/checkout@v6 |
| 136 | + |
| 137 | + - name: Setup Node.js |
| 138 | + uses: actions/setup-node@v4 |
| 139 | + with: |
| 140 | + node-version: '22' |
| 141 | + cache: 'npm' |
| 142 | + cache-dependency-path: src-tauri/dist/package-lock.json |
| 143 | + |
| 144 | + - name: Install frontend dependencies |
| 145 | + working-directory: ./src-tauri/dist |
| 146 | + run: npm ci |
| 147 | + |
| 148 | + - name: Install Playwright browsers |
| 149 | + working-directory: ./src-tauri/dist |
| 150 | + run: npx playwright install --with-deps chromium |
| 151 | + |
| 152 | + - name: Run Playwright tests |
| 153 | + working-directory: ./src-tauri/dist |
| 154 | + run: npx playwright test |
| 155 | + env: |
| 156 | + CI: true |
| 157 | + |
| 158 | + - name: Upload Playwright report |
| 159 | + if: always() |
| 160 | + continue-on-error: true |
| 161 | + uses: actions/upload-artifact@v4 |
| 162 | + with: |
| 163 | + name: playwright-report |
| 164 | + path: src-tauri/dist/playwright-report/ |
| 165 | + retention-days: 30 |
| 166 | + |
| 167 | + - name: Upload test results |
| 168 | + if: always() |
| 169 | + continue-on-error: true |
| 170 | + uses: actions/upload-artifact@v4 |
| 171 | + with: |
| 172 | + name: playwright-results |
| 173 | + path: src-tauri/dist/test-results/ |
| 174 | + retention-days: 30 |
| 175 | + |
| 176 | + # Rust backend tests |
| 177 | + rust-tests: |
| 178 | + name: Rust Backend Tests |
| 179 | + runs-on: ubuntu-latest |
| 180 | + timeout-minutes: 10 |
| 181 | + env: |
| 182 | + CARGO_TERM_COLOR: always |
| 183 | + |
| 184 | + steps: |
| 185 | + - name: Checkout code |
| 186 | + uses: actions/checkout@v6 |
| 187 | + |
| 188 | + - name: Setup Rust |
| 189 | + uses: dtolnay/rust-toolchain@stable |
| 190 | + |
| 191 | + - name: Cache Cargo |
| 192 | + uses: actions/cache@v4 |
| 193 | + with: |
| 194 | + path: | |
| 195 | + ~/.cargo/bin/ |
| 196 | + ~/.cargo/registry/index/ |
| 197 | + ~/.cargo/registry/cache/ |
| 198 | + ~/.cargo/git/db/ |
| 199 | + src-tauri/target/ |
| 200 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 201 | + restore-keys: | |
| 202 | + ${{ runner.os }}-cargo- |
| 203 | +
|
| 204 | + - name: Install cargo-nextest |
| 205 | + uses: taiki-e/install-action@nextest |
| 206 | + |
| 207 | + - name: Install Tauri system dependencies (Linux) |
| 208 | + run: | |
| 209 | + sudo apt-get update |
| 210 | + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf |
| 211 | +
|
| 212 | + - name: Run Rust tests |
| 213 | + run: cargo nextest run --manifest-path src-tauri/Cargo.toml |
| 214 | + |
| 215 | + # Build verification |
| 216 | + build: |
| 217 | + name: Build Verification |
| 218 | + runs-on: ubuntu-latest |
| 219 | + timeout-minutes: 15 |
| 220 | + env: |
| 221 | + CARGO_TERM_COLOR: always |
| 222 | + |
| 223 | + steps: |
| 224 | + - name: Checkout code |
| 225 | + uses: actions/checkout@v6 |
| 226 | + |
| 227 | + - name: Setup Rust |
| 228 | + uses: dtolnay/rust-toolchain@stable |
| 229 | + |
| 230 | + - name: Cache Cargo |
| 231 | + uses: actions/cache@v4 |
| 232 | + with: |
| 233 | + path: | |
| 234 | + ~/.cargo/bin/ |
| 235 | + ~/.cargo/registry/index/ |
| 236 | + ~/.cargo/registry/cache/ |
| 237 | + ~/.cargo/git/db/ |
| 238 | + src-tauri/target/ |
| 239 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 240 | + restore-keys: | |
| 241 | + ${{ runner.os }}-cargo- |
| 242 | +
|
| 243 | + - name: Install Tauri system dependencies (Linux) |
| 244 | + run: | |
| 245 | + sudo apt-get update |
| 246 | + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf |
| 247 | +
|
| 248 | + - name: Check Rust build |
| 249 | + run: cargo check --manifest-path src-tauri/Cargo.toml --all-features |
0 commit comments