Skip to content

install sharp package #108

install sharp package

install sharp package #108

Workflow file for this run

name: CI/CD Backend
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
ports:
- 5432:5432
env:
DATABASE_HOST: ${{ secrets.DATABASE_HOST }}
DATABASE_PORT: ${{ secrets.DATABASE_PORT }}
DATABASE_USER: ${{ secrets.DATABASE_USER }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18.19.1"
- name: Install dependencies
run: |
cd backend
npm install
- name: Set executable permissions
run: |
cd backend
chmod +x node_modules/.bin/eslint node_modules/.bin/jest
- name: Run lint
run: |
cd backend
npm run lint
- name: Run tests
env:
DATABASE_HOST: ${{ secrets.DATABASE_HOST }}
DATABASE_PORT: ${{ secrets.DATABASE_PORT }}
DATABASE_USER: ${{ secrets.DATABASE_USER }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
run: |
cd backend
npm test
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/backend:latest -f backend/Dockerfile ./backend
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/backend:latest
- name: Deploy to Render
if: github.ref == 'refs/heads/main'
env:
_API_KEY: ${{ secrets.RENDER_API_KEY }}
run: |
curl -X POST -H "Accept: application/json" -H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}" -d '' https://api.render.com/deploy/srv-xxxxxxxxxxxxxxxxxx