ci: stabilize pipeline
All checks were successful
CI / Backend Tests (push) Successful in 31s
CI / Frontend Tests (push) Successful in 1m43s
CI / Build Docker Images (push) Successful in 4m45s

This commit is contained in:
2025-10-16 21:00:39 -05:00
parent 96dc42f0eb
commit a553b14017
12 changed files with 204 additions and 102 deletions

52
docker-compose.test.yml Normal file
View File

@@ -0,0 +1,52 @@
# This file is for running CI tests locally, mirroring .gitea/workflows/ci.yml
services:
# This is the test database, mirroring the 'services' block in the CI job.
merchantsofhope-supplyanddemandportal-test-database:
image: postgres:15-alpine
container_name: merchantsofhope-supplyanddemandportal-test-database
environment:
POSTGRES_DB: merchantsofhope_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# Add a healthcheck to ensure the database is ready before tests run
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- merchantsofhope-supplyanddemandportal-network
# This service runs the backend test suite.
backend-tester:
build:
context: ./backend
dockerfile: Dockerfile
container_name: merchantsofhope-supplyanddemandportal-backend-tester
command: >
sh -c "npm run migrate && npm test -- --runInBand"
environment:
NODE_ENV: test
DATABASE_URL: postgresql://postgres:postgres@merchantsofhope-supplyanddemandportal-test-database:5432/merchantsofhope_test
JWT_SECRET: merchantsofhope_test_secret
depends_on:
merchantsofhope-supplyanddemandportal-test-database:
condition: service_healthy
networks:
- merchantsofhope-supplyanddemandportal-network
# This service runs the frontend test suite.
frontend-tester:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: merchantsofhope-supplyanddemandportal-frontend-tester
command: npm test -- --watchAll=false
environment:
NODE_ENV: test
networks:
- merchantsofhope-supplyanddemandportal-network
networks:
merchantsofhope-supplyanddemandportal-network:
driver: bridge