forked from TonyMckes/conduit-realworld-example-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14303dd
commit ef8bd17
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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 |