name: Run Tests on Branches on: push: branches-ignore: - 'main' jobs: test: name: Run Tests runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v4 with: fetch-depth: 2 - name: Detect Changes id: changes run: | BASE=${{ github.event.before }} [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ] && BASE=$(git rev-parse HEAD~1) echo "backend=$(git diff --name-only "$BASE"...HEAD | grep -qE '^(apps/backend/|packages/)' && echo true || echo false)" >> "$GITHUB_OUTPUT" echo "frontend=$(git diff --name-only "$BASE"...HEAD | grep -qE '^(apps/frontend/|packages/)' && echo true || echo false)" >> "$GITHUB_OUTPUT" echo "frontend-mobile=$(git diff --name-only "$BASE"...HEAD | grep -qE '^(apps/frontend-mobile/|packages/)' && echo true || echo false)" >> "$GITHUB_OUTPUT" - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' cache: 'npm' - name: Install Dependencies run: npm ci - name: Run Backend Tests if: steps.changes.outputs.backend == 'true' run: npm test --workspace=farma-clic-backend -- --ci - name: Run Frontend Tests if: steps.changes.outputs.frontend == 'true' run: npm test --workspace=farma-clic-frontend -- --run --reporter=basic - name: Run Frontend Mobile Tests if: steps.changes.outputs.frontend-mobile == 'true' run: npm test --workspace=frontend-mobile -- --ci continue-on-error: true