Skip to content

removed console logs #20

removed console logs

removed console logs #20

Workflow file for this run

name: End-to-End Testing
on:
push:
branches:
- main
pull_request:
jobs:
cypress-tests:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
# Step : Connect containers
- name: Create container network
run: |
docker network create docker_network_crowdfund
# Step 3: Pull and Run Database Docker Image
- name: Run MySQL database service
run: |
docker pull ${{ secrets.DOCKER_USERNAME }}/raisehub_database:latest
docker run -d --name raisehub_database \
-p 3306:3306 \
--env MYSQL_ROOT_PASSWORD=${{ secrets.MYSQL_ROOT_PASSWORD }} \
--env MYSQL_DATABASE=crowdfund_db \
${{ secrets.DOCKER_USERNAME }}/raisehub_database:latest
docker network connect docker_network_crowdfund raisehub_database
# Step 3.1: Wait for MySQL to Start and Verify Service
- name: Wait for MySQL Service to Start
run: |
for i in {1..10}; do
docker exec raisehub_database mysqladmin ping -h 127.0.0.1 -u root -p${{ secrets.MYSQL_ROOT_PASSWORD }} && break
echo "Waiting for MySQL to be ready..."
sleep 5
done || (echo "MySQL failed to start" && exit 1)
- name: Debug MySQL Logs
if: failure()
run: |
docker logs raisehub_database
# Step 4: Pull and Run Backend Docker Image
- name: Run backend service
run: |
docker pull ${{ secrets.DOCKER_USERNAME }}/raisehub_backend:latest
docker run -d --name backend \
-p 8080:8080 \
--env MYSQL_USERNAME=${{ secrets.MYSQL_USERNAME }} \
--env MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }} \
--env JWT_SECRET=${{ secrets.JWT_SECRET }} \
${{ secrets.DOCKER_USERNAME }}/raisehub_backend:latest
docker network connect docker_network_crowdfund backend
# Step :
- name: See networks and connections
run: |
docker network ls
docker network inspect docker_network_crowdfund
# Step 4.1: Wait for Backend to Start and Verify Service
- name: Wait for Backend Service to Start
run: |
for i in {1..10}; do
curl -sSf http://localhost:8080/health && break
echo "Waiting for Backend to be ready..."
sleep 5
done || (echo "Backend failed to start" && exit 1)
docker logs -f backend
# Step 5: Pull and Run Frontend Docker Image
- name: Wait for Backend Service to Start
run: |
for i in {1..10}; do
curl -sSf http://localhost:8080/health && break
echo "Waiting for Backend to be ready..."
sleep 5
done || (echo "Backend failed to start" && exit 1)
docker logs -f backend
# Step 6: Start the frontend application
- name: Start frontend server
run: |
npm run build
npm run start &
env:
REACT_APP_API_URL: http://localhost:8080 # Set backend API URL
# Step 7: Wait for frontend service
- name: Wait for Frontend Service
run: |
npx wait-on http://localhost:3000
# Step 8: Run Cypress tests
- name: Run Cypress tests
uses: cypress-io/github-action@v5
with:
browser: chrome
config-file: cypress.config.js