test(frontend): fix CI failures from stale mock defaults and outdated… #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| frontend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Test | |
| run: npm run test | |
| - name: Build | |
| run: npm run build | |
| env: | |
| VITE_API_BASE_URL: https://api.simpleinvoice.khangtran.dev | |
| backend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend | |
| services: | |
| postgres: | |
| image: postgres:18-alpine | |
| env: | |
| POSTGRES_USER: ci_simple_invoice_user | |
| POSTGRES_PASSWORD: ci_simple_invoice_password | |
| POSTGRES_DB: ci_simple_invoice_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U ci_simple_invoice_user -d ci_simple_invoice_test" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| NODE_ENV: test | |
| PORT: 4001 | |
| POSTGRES_HOST: localhost | |
| POSTGRES_PORT: 5432 | |
| POSTGRES_DB: ci_simple_invoice_test | |
| POSTGRES_USER: ci_simple_invoice_user | |
| POSTGRES_PASSWORD: ci_simple_invoice_password | |
| JWT_SECRET: ci-test-jwt-secret-must-be-at-least-32-characters | |
| JWT_EXPIRES_IN: 3600 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint:check | |
| - name: Build | |
| run: npm run build | |
| - name: Run migrations | |
| run: npm run migration:run | |
| - name: Test | |
| run: npm run test | |
| - name: Test (e2e) | |
| run: npm run test:e2e |