26e7d92079
The CIMA search API returns {results: [...]} but the admin panel
was treating it as an array, causing CIMA products to be lost.
Now handles both formats:
- Array: [...]
- Object: {results: [...]}
111 lines
3.1 KiB
YAML
111 lines
3.1 KiB
YAML
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 }}
|
|
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/**'
|
|
|
|
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
|
|
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 parapharmacy-api native deps
|
|
run: npm rebuild sqlite3 bcrypt --workspace=farma-clic-parapharmacy-api
|
|
- name: Run Parapharmacy API Tests
|
|
run: npm test --workspace=farma-clic-parapharmacy-api
|