|
| 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/TypeScript source |
| 13 | + - '**/*.js' |
| 14 | + - '**/*.ts' |
| 15 | + - '**/*.jsx' |
| 16 | + - '**/*.tsx' |
| 17 | + - '**/*.mjs' |
| 18 | + # Frontend assets and templates |
| 19 | + - '**/*.html' |
| 20 | + - '**/*.css' |
| 21 | + # Node.js config |
| 22 | + - '**/package.json' |
| 23 | + - '**/package-lock.json' |
| 24 | + - '**/tsconfig.json' |
| 25 | + - '**/vite.config.js' |
| 26 | + - '**/vitest.config.js' |
| 27 | + - '**/playwright.config.js' |
| 28 | + # Tauri config |
| 29 | + - '**/tauri.conf.json' |
| 30 | + # Task runner config |
| 31 | + - 'taskfile.yml' |
| 32 | + # Test files |
| 33 | + - 'tests/**/*' |
| 34 | + - '**/tests/**/*' |
| 35 | + # CI workflow itself |
| 36 | + - '.github/workflows/test.yml' |
| 37 | + pull_request: |
| 38 | + branches: [main] |
| 39 | + paths: |
| 40 | + # Rust source and config |
| 41 | + - '**/*.rs' |
| 42 | + - '**/Cargo.toml' |
| 43 | + - '**/Cargo.lock' |
| 44 | + - '**/build.rs' |
| 45 | + # JavaScript/TypeScript source |
| 46 | + - '**/*.js' |
| 47 | + - '**/*.ts' |
| 48 | + - '**/*.jsx' |
| 49 | + - '**/*.tsx' |
| 50 | + - '**/*.mjs' |
| 51 | + # Frontend assets and templates |
| 52 | + - '**/*.html' |
| 53 | + - '**/*.css' |
| 54 | + # Node.js config |
| 55 | + - '**/package.json' |
| 56 | + - '**/package-lock.json' |
| 57 | + - '**/tsconfig.json' |
| 58 | + - '**/vite.config.js' |
| 59 | + - '**/vitest.config.js' |
| 60 | + - '**/playwright.config.js' |
| 61 | + # Tauri config |
| 62 | + - '**/tauri.conf.json' |
| 63 | + # Task runner config |
| 64 | + - 'taskfile.yml' |
| 65 | + # Test files |
| 66 | + - 'tests/**/*' |
| 67 | + - '**/tests/**/*' |
| 68 | + # CI workflow itself |
| 69 | + - '.github/workflows/test.yml' |
| 70 | + |
| 71 | +# Cancel in-progress runs when a new push supersedes them |
| 72 | +concurrency: |
| 73 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 74 | + cancel-in-progress: true |
| 75 | + |
| 76 | +jobs: |
| 77 | + # Frontend E2E tests with Playwright |
| 78 | + playwright-tests: |
| 79 | + name: Playwright E2E Tests |
| 80 | + runs-on: [macOS, ARM64] |
| 81 | + timeout-minutes: 20 |
| 82 | + |
| 83 | + steps: |
| 84 | + - name: Checkout code |
| 85 | + uses: actions/checkout@v6 |
| 86 | + |
| 87 | + - name: Setup Node.js |
| 88 | + uses: actions/setup-node@v6 |
| 89 | + with: |
| 90 | + node-version: '20' |
| 91 | + |
| 92 | + - name: Install frontend dependencies |
| 93 | + working-directory: ./app/frontend |
| 94 | + run: npm ci |
| 95 | + |
| 96 | + - name: Install Playwright browsers |
| 97 | + working-directory: ./app/frontend |
| 98 | + run: npx playwright install --with-deps webkit |
| 99 | + |
| 100 | + - name: Run Playwright tests |
| 101 | + working-directory: ./app/frontend |
| 102 | + run: npx playwright test |
| 103 | + env: |
| 104 | + CI: true |
| 105 | + |
| 106 | + - name: Upload Playwright report |
| 107 | + if: always() |
| 108 | + uses: actions/upload-artifact@v6 |
| 109 | + with: |
| 110 | + name: playwright-report |
| 111 | + path: playwright-report/ |
| 112 | + retention-days: 30 |
| 113 | + |
| 114 | + - name: Upload test results |
| 115 | + if: always() |
| 116 | + uses: actions/upload-artifact@v6 |
| 117 | + with: |
| 118 | + name: playwright-results |
| 119 | + path: test-results/ |
| 120 | + retention-days: 30 |
| 121 | + |
| 122 | + # Linting and code quality |
| 123 | + lint: |
| 124 | + name: Lint and Format Check |
| 125 | + runs-on: ubuntu-latest |
| 126 | + |
| 127 | + steps: |
| 128 | + - name: Checkout code |
| 129 | + uses: actions/checkout@v6 |
| 130 | + |
| 131 | + - name: Setup Node.js |
| 132 | + uses: actions/setup-node@v6 |
| 133 | + with: |
| 134 | + node-version: '20' |
| 135 | + |
| 136 | + - name: Install Deno |
| 137 | + uses: denoland/setup-deno@v2 |
| 138 | + with: |
| 139 | + deno-version: v2.x |
| 140 | + |
| 141 | + - name: Check Deno formatting |
| 142 | + run: deno fmt --check |
| 143 | + |
| 144 | + - name: Run Deno lint |
| 145 | + run: deno lint |
| 146 | + |
| 147 | + # Vitest unit tests with coverage |
| 148 | + vitest-tests: |
| 149 | + name: Vitest Unit Tests |
| 150 | + runs-on: ubuntu-latest |
| 151 | + timeout-minutes: 10 |
| 152 | + |
| 153 | + steps: |
| 154 | + - name: Checkout code |
| 155 | + uses: actions/checkout@v6 |
| 156 | + |
| 157 | + - name: Setup Node.js |
| 158 | + uses: actions/setup-node@v6 |
| 159 | + with: |
| 160 | + node-version: '20' |
| 161 | + cache: 'npm' |
| 162 | + cache-dependency-path: app/frontend/package-lock.json |
| 163 | + |
| 164 | + - name: Install frontend dependencies |
| 165 | + working-directory: ./app/frontend |
| 166 | + run: npm ci |
| 167 | + |
| 168 | + - name: Run Vitest with coverage |
| 169 | + working-directory: ./app/frontend |
| 170 | + run: npm run test:coverage |
| 171 | + continue-on-error: true # Pre-existing prop-test failures |
| 172 | + |
| 173 | + - name: Upload coverage report |
| 174 | + if: always() |
| 175 | + uses: actions/upload-artifact@v6 |
| 176 | + with: |
| 177 | + name: vitest-coverage |
| 178 | + path: app/frontend/coverage/ |
| 179 | + retention-days: 30 |
| 180 | + |
| 181 | + # Build verification |
| 182 | + build: |
| 183 | + name: Build Verification |
| 184 | + runs-on: [macOS, ARM64] |
| 185 | + timeout-minutes: 5 |
| 186 | + env: |
| 187 | + CARGO_INCREMENTAL: 1 # Enable incremental compilation on self-hosted (reuses artifacts) |
| 188 | + CARGO_TERM_COLOR: always |
| 189 | + |
| 190 | + steps: |
| 191 | + - name: Checkout code |
| 192 | + uses: actions/checkout@v6 |
| 193 | + |
| 194 | + - name: Setup Node.js |
| 195 | + uses: actions/setup-node@v6 |
| 196 | + with: |
| 197 | + node-version: '20' |
| 198 | + |
| 199 | + - name: Setup Rust |
| 200 | + uses: dtolnay/rust-toolchain@stable |
| 201 | + |
| 202 | + - name: Install frontend dependencies |
| 203 | + working-directory: ./app/frontend |
| 204 | + run: npm ci |
| 205 | + |
| 206 | + - name: Build frontend |
| 207 | + working-directory: ./app/frontend |
| 208 | + run: npm run build |
| 209 | + |
| 210 | + - name: Check Rust build |
| 211 | + working-directory: ./src-tauri |
| 212 | + run: cargo check --all-features |
| 213 | + |
| 214 | + # Rust backend tests with coverage |
| 215 | + rust-tests: |
| 216 | + name: Rust Backend Tests |
| 217 | + runs-on: [macOS, ARM64] |
| 218 | + needs: build |
| 219 | + timeout-minutes: 5 |
| 220 | + env: |
| 221 | + CARGO_INCREMENTAL: 1 # Enable incremental compilation on self-hosted (reuses artifacts) |
| 222 | + CARGO_TERM_COLOR: always |
| 223 | + |
| 224 | + steps: |
| 225 | + - name: Checkout code |
| 226 | + uses: actions/checkout@v6 |
| 227 | + |
| 228 | + - name: Setup Rust |
| 229 | + uses: dtolnay/rust-toolchain@stable |
| 230 | + |
| 231 | + - name: Install cargo-tarpaulin |
| 232 | + run: | |
| 233 | + # Only install if not already cached |
| 234 | + if ! command -v cargo-tarpaulin &> /dev/null; then |
| 235 | + cargo install cargo-tarpaulin |
| 236 | + else |
| 237 | + echo "cargo-tarpaulin already installed (cached)" |
| 238 | + fi |
| 239 | +
|
| 240 | + - name: Run Rust tests with coverage |
| 241 | + working-directory: ./src-tauri |
| 242 | + run: | |
| 243 | + cargo tarpaulin --out Html --out Json --output-dir coverage \ |
| 244 | + --ignore-tests --skip-clean \ |
| 245 | + --fail-under 50 |
| 246 | + continue-on-error: true # Pre-existing prop-test failures |
| 247 | + |
| 248 | + - name: Upload coverage report |
| 249 | + if: always() |
| 250 | + uses: actions/upload-artifact@v6 |
| 251 | + with: |
| 252 | + name: rust-coverage |
| 253 | + path: src-tauri/coverage/ |
| 254 | + retention-days: 30 |
0 commit comments