name: Test on: push: branches: [main, develop] pull_request: branches: [main, develop] jobs: test-backend: name: Backend E2E Tests runs-on: ubuntu-latest defaults: run: working-directory: apps/backend services: postgres: image: postgres:15-alpine env: POSTGRES_USER: miinventario POSTGRES_PASSWORD: miinventario_pass POSTGRES_DB: miinventario_test ports: - 5433:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 redis: image: redis:7-alpine ports: - 6380:6379 options: >- --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 env: NODE_ENV: test DB_HOST: localhost DB_PORT: 5433 DB_USER: miinventario DB_PASSWORD: miinventario_pass DB_NAME: miinventario_test REDIS_HOST: localhost REDIS_PORT: 6380 JWT_SECRET: test-jwt-secret-for-ci JWT_REFRESH_SECRET: test-jwt-refresh-secret-for-ci steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' cache-dependency-path: apps/backend/package-lock.json - name: Install dependencies run: npm ci - name: Run migrations run: npm run migration:run || true - name: Run E2E tests run: npm run test:e2e -- --coverage - name: Upload coverage report uses: actions/upload-artifact@v4 with: name: backend-coverage path: apps/backend/coverage/ retention-days: 7 test-mobile: name: Mobile Unit Tests runs-on: ubuntu-latest defaults: run: working-directory: apps/mobile steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' cache-dependency-path: apps/mobile/package-lock.json - name: Install dependencies run: npm ci - name: Run unit tests run: npm run test:ci - name: Upload coverage report uses: actions/upload-artifact@v4 with: name: mobile-coverage path: apps/mobile/coverage/ retention-days: 7 - name: Upload test results uses: actions/upload-artifact@v4 if: always() with: name: mobile-test-results path: apps/mobile/junit.xml retention-days: 7