mirror of
https://github.com/jaypyles/Scraperr.git
synced 2025-10-30 14:07:04 +00:00
67 lines
1.6 KiB
YAML
67 lines
1.6 KiB
YAML
name: Run Cypress Tests
|
|
|
|
description: Run Cypress tests
|
|
|
|
inputs:
|
|
openai_key:
|
|
description: "OpenAI API key"
|
|
required: true
|
|
default: ""
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Setup Docker project
|
|
shell: bash
|
|
env:
|
|
OPENAI_KEY: ${{ inputs.openai_key }}
|
|
run: make build-ci up-ci
|
|
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: yarn install
|
|
|
|
- name: Wait for frontend to be ready
|
|
shell: bash
|
|
run: |
|
|
for i in {1..10}; do
|
|
curl -s http://127.0.0.1:80 && echo "Frontend is ready" && exit 0
|
|
echo "Waiting for frontend to be ready... attempt $i"
|
|
sleep 1
|
|
done
|
|
echo "Frontend failed to be ready after 10 retries"
|
|
exit 1
|
|
|
|
- name: Wait for backend to be ready
|
|
shell: bash
|
|
run: |
|
|
for i in {1..10}; do
|
|
curl -s http://127.0.0.1:8000 && echo "Backend is ready" && exit 0
|
|
echo "Waiting for backend to be ready... attempt $i"
|
|
sleep 1
|
|
done
|
|
echo "Backend failed to be ready after 10 retries"
|
|
exit 1
|
|
|
|
- name: Show backend logs on failure
|
|
if: failure()
|
|
shell: bash
|
|
run: |
|
|
echo "== Docker Containers =="
|
|
docker ps -a
|
|
echo "== Backend Logs =="
|
|
docker logs $(docker ps -a --filter "name=scraperr_api" --format "{{.Names}}") || echo "Could not get backend logs"
|
|
|
|
- name: Run Cypress tests
|
|
shell: bash
|
|
run: npm run cy:run
|
|
|