Merge pull request #19 from devzero-inc/dependabot/npm_and_yarn/front… #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Stable Diffusion CI | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- '**' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- '**' | |
jobs: | |
backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node.js for linting | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install backend dependencies | |
run: | | |
cd backend | |
npm install | |
- name: Lint backend | |
run: | | |
cd backend | |
npm run lint | |
- name: Run backend tests | |
run: | | |
cd backend | |
npm run test | |
frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node.js for linting | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install frontend dependencies | |
run: | | |
cd frontend | |
npm install | |
- name: Lint frontend | |
run: | | |
cd frontend | |
npm run lint | |
- name: Run frontend tests | |
run: | | |
cd frontend | |
npm run test | |
check-docker-compose: | |
runs-on: ubuntu-latest | |
needs: [backend, frontend] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Start services | |
run: docker-compose up -d | |
- name: Wait for frontend service to become healthy | |
run: | | |
echo "Waiting for frontend service to become healthy..." | |
RETRIES=10 | |
while [ $RETRIES -gt 0 ]; do | |
HEALTH_STATUS=$(docker inspect --format='{{.State.Health.Status}}' $(docker-compose ps -q frontend)) | |
if [ "$HEALTH_STATUS" == "healthy" ]; then | |
echo "frontend service is healthy." | |
break | |
else | |
echo "Waiting for frontend service to become healthy. Current status: $HEALTH_STATUS" | |
sleep 10 | |
RETRIES=$((RETRIES-1)) | |
fi | |
done | |
if [ $RETRIES -le 0 ]; then | |
echo "frontend service did not become healthy in time." | |
exit 1 | |
fi | |
- name: Shutdown services | |
run: docker-compose down |