ci: stabilize pipeline
This commit is contained in:
		
							
								
								
									
										52
									
								
								docker-compose.test.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								docker-compose.test.yml
									
									
									
									
									
										Normal 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 | ||||
		Reference in New Issue
	
	Block a user