name: Run Tests on Branches on: push: branches-ignore: - 'main' jobs: detect-changes: name: Detect Changes runs-on: ubuntu-latest outputs: backend: ${{ steps.filter.outputs.backend }} frontend: ${{ steps.filter.outputs.frontend }} frontend-mobile: ${{ steps.filter.outputs.frontend-mobile }} parapharmacy-api: ${{ steps.filter.outputs.parapharmacy-api }} pip-platform: ${{ steps.filter.outputs.pip-platform }} steps: - uses: actions/checkout@v4 - uses: dorny/paths-filter@v3 id: filter with: filters: | backend: - 'apps/backend/**' - 'packages/**' frontend: - 'apps/frontend/**' - 'packages/**' frontend-mobile: - 'apps/frontend-mobile/**' - 'packages/**' parapharmacy-api: - 'apps/parapharmacy-api/**' - 'packages/**' pip-platform: - 'apps/pip-platform/**' test-backend: name: Backend Tests needs: detect-changes if: needs.detect-changes.outputs.backend == 'true' runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' cache: 'npm' - name: Install dependencies run: npm ci --ignore-scripts - name: Install backend native deps run: npm rebuild sqlite3 bcrypt --workspace=farma-clic-backend - name: Run Backend Tests run: npm test --workspace=farma-clic-backend test-frontend: name: Frontend Tests needs: detect-changes if: needs.detect-changes.outputs.frontend == 'true' runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' cache: 'npm' - name: Install dependencies run: npm ci --ignore-scripts - name: Run Frontend Tests run: npm test --workspace=farma-clic-frontend -- --run --reporter=basic test-frontend-mobile: name: Frontend Mobile Tests needs: detect-changes if: needs.detect-changes.outputs.frontend-mobile == 'true' runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' cache: 'npm' - name: Install dependencies run: npm ci --ignore-scripts - name: Run Frontend Mobile Tests run: npm test --workspace=frontend-mobile -- --ci continue-on-error: true test-parapharmacy-api: name: Parapharmacy API Tests needs: detect-changes if: needs.detect-changes.outputs.parapharmacy-api == 'true' runs-on: ubuntu-latest timeout-minutes: 15 services: mongodb: image: mongo:7 ports: - 27017:27017 steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' cache: 'npm' - name: Install dependencies run: npm ci --ignore-scripts - name: Run Parapharmacy API Tests run: npm test --workspace=farmafinder-parapharmacy-api test-pip-platform: name: PIP Platform Tests needs: detect-changes if: false && needs.detect-changes.outputs.pip-platform == 'true' runs-on: ubuntu-latest timeout-minutes: 15 services: postgres: image: postgres:16-alpine env: POSTGRES_DB: pip_test POSTGRES_USER: pip POSTGRES_PASSWORD: pip_test ports: - 5432:5432 options: >- --health-cmd="pg_isready -U pip" --health-interval=10s --health-timeout=5s --health-retries=5 redis: image: redis:alpine ports: - 6379:6379 options: >- --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=5 steps: - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Install uv run: pip install uv - name: Install dependencies working-directory: apps/pip-platform run: uv sync --extra dev - name: Run Tests working-directory: apps/pip-platform run: uv run pytest