Skip to content

Update ci-cd.yml (#243) #120

Update ci-cd.yml (#243)

Update ci-cd.yml (#243) #120

Workflow file for this run

name: "CI-CD"
on:
push:
branches:
- main
jobs:
Setup:
name: CI/CD Pipeline
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22.12.0'
- name: Install pm2
run: |
echo "### Installing pm2... ###"
npm install pm2 -g
- name: Install backend dependencies
run: |
echo "### Installing backend dependencies... ###"
npm ci
working-directory: backend
- name: Install frontend dependencies
run: |
echo "### Installing frontend dependencies... ###"
ls -1
npm ci
working-directory: frontend
#- name: Install tests dependencies
# run: |
# echo "### Installing test dependencies... ###"
# npm ci
# working-directory: tests
#- name: Seed test database
# run: |
# echo "### Start seed test database... ###"
# npm run seed:test
# working-directory: backend
#- name: Start backend tests with pm2
# run: |
# echo "### Starting backend tests with pm2... ###"
# pm2 start 0
# working-directory: backend
#- name: Wait for backend to be ready
# run: |
# echo "### Waiting for backend to be ready... ###"
# while ! nc -z localhost 8010; do
# echo "Backend is not ready yet. Retrying in 5 seconds..."
# sleep 5
# done
#- name: Build frontend for tests
# run: |
# echo "### Build test frontend"
# npm run build:test
# working-directory: frontend
#- name: Start frontend tests with pm2
# run: |
# echo "### Starting frontend tests with pm2... ###"
# pm2 start 1
# working-directory: frontend
#- name: Wait for frontend to be ready
# run: |
# echo "### Waiting for frontend to be ready... ###"
# while ! nc -z localhost 5183; do
# echo "Frontend is not ready yet. Retrying in 5 seconds..."
# sleep 5
# done
#- name: Run tests
# run: |
# echo "### Start tests... ###"
# npx codeceptjs run --steps || true
# working-directory: tests
#- name: Stop test processes
# run: |
# echo "### Stop test pm2 process... ###"
# pm2 stop 0 1
- name: Restart backend
run: |
echo "### Restart backend... ###"
pm2 restart 0
working-directory: backend
- name: Wait for backend to be ready
run: |
echo "### Waiting for backend to be ready... ###"
while ! nc -z localhost 8000; do
echo "Backend is not ready yet. Retrying in 5 seconds..."
sleep 5
done
- name: Build frontend
run: |
echo "### Build frontend... ###"
npm run build
working-directory: frontend
- name: Restart frontend
run: |
echo "### Restart frontend... ###"
pm2 restart 1
working-directory: frontend
- name: Wait for frontend to be ready
run: |
echo "### Waiting for frontend to be ready... ###"
while ! nc -z localhost 3000; do
echo "Frontend is not ready yet. Retrying in 5 seconds..."
sleep 5
done
- name: Finish♥️♥️♥️
run: |
echo "♥️♥️♥️ Поздравляю тебя милый мой! У тебя все получилось ♥️♥️♥️"