Skip to content

Commit

Permalink
Repare deleted files
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoguillin committed Mar 25, 2024
1 parent 14303dd commit ef8bd17
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/runTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run tests

on:
workflow_dispatch:

jobs:
test:
name: Spin up application to run tests

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Init app containers
run: docker-compose up -d

- name: Wait for containers to be ready
run: |
wget -O dockerize.tar.gz https://github.com/jwilder/dockerize/releases/download/v0.7.0/dockerize-alpine-linux-amd64-v0.7.0.tar.gz && tar -C /usr/local/bin -xzvf dockerize.tar.gz && rm dockerize.tar.gz
dockerize -wait tcp://localhost:5432 -wait tcp://localhost:3000 -timeout 1m
- name: Seed database
run: docker-compose exec -T app npm run sqlz -- db:seed:all

- name: Run Tests
run: docker-compose exec -T app npm test
39 changes: 39 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3.8"

services:
postgresql:
image: postgres:latest
restart: always
user: postgres
environment:
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 3s
timeout: 5s
retries: 5

app:
image: hugogc/realworldapp-for-test-automation:latest
ports:
- "3000:3000"
- "3001:3001"
depends_on:
postgresql:
condition: service_healthy
environment:
PORT: 3001
JWT_KEY: supersecretkey
DEV_DB_USERNAME: postgres
DEV_DB_PASSWORD: postgres
DEV_DB_NAME: db_dev
DEV_DB_HOSTNAME: postgresql
DEV_DB_DIALECT: postgres

volumes:
postgres-data:
driver: local

0 comments on commit ef8bd17

Please sign in to comment.