Skip to content

Merge pull request #445 from OthmanImam/feat/Issue288 #313

Merge pull request #445 from OthmanImam/feat/Issue288

Merge pull request #445 from OthmanImam/feat/Issue288 #313

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
NODE_ENV: test
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/propchain_test?sslmode=disable
jobs:
lint-and-build:
name: Lint & Build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: propchain_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 20
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Generate Prisma Client
run: npx prisma generate
- name: Run Linter
run: npm run lint
- name: Build Application
run: npm run build
test:
name: Run Tests
needs: lint-and-build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: propchain_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 20
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Generate Prisma Client
run: npx prisma generate
- name: Run Tests
run: npm test
env:
NODE_ENV: test
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/propchain_test
deploy-staging:
name: Deploy to Staging
needs: [lint-and-build, test]
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Deploy to Staging
run: echo "Deploying to staging environment..."
# Add your deployment steps here
deploy-production:
name: Deploy to Production
needs: [lint-and-build, test]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Deploy to Production
run: echo "Deploying to production environment..."
# Add your deployment steps here