Merge pull request #16 from Ismail-Mouyahada/main #1
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: Development Workflow | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
create-environment: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: satsquare_user | |
POSTGRES_PASSWORD: satsquare_password | |
POSTGRES_DB: satsquare_db | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd="pg_isready -U satsquare_user" | |
--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 | |
- name: Install dependencies | |
run: npm install | |
- name: Run database migrations | |
run: npx prisma db push | |
env: | |
DATABASE_URL: postgresql://satsquare_user:satsquare_password@localhost:5432/satsquare_db | |
- name: Seed the database | |
run: npx prisma seed | |
env: | |
DATABASE_URL: postgresql://satsquare_user:satsquare_password@localhost:5432/satsquare_db | |
test: | |
needs: create-environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests | |
run: npm test | |
security: | |
needs: create-environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm install | |
- name: Run security checks | |
run: npm audit --audit-level=moderate |