diff --git a/.github/workflows/pull_request.workflow.yml b/.github/workflows/pull_request.workflow.yml index 6c8c8bc2c..191b4a790 100644 --- a/.github/workflows/pull_request.workflow.yml +++ b/.github/workflows/pull_request.workflow.yml @@ -39,16 +39,46 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + - name: Start Kuzzle run: docker compose up --wait + - name: Start preview server + run: npm run preview & + env: + PORT: 8080 + + - name: Wait for preview server + run: | + timeout=30 + while ! nc -z localhost 8080; do + if [ $timeout -le 0 ]; then + echo "Timeout waiting for preview server" + exit 1 + fi + timeout=$((timeout-1)) + sleep 1 + done + - name: Cypress run uses: cypress-io/github-action@v6 with: - build: npm run build - start: npm run preview browser: chrome - spec: test/e2e/cypress/integration/single-backend/${{ matrix.spec }} + spec: e2e/cypress/integration/single-backend/${{ matrix.spec }} + install: false # Skip installation as we already did npm ci + wait-on: 'http://localhost:8080' + wait-on-timeout: 60 - name: Upload screenshots uses: actions/upload-artifact@v4