Skip to content

Commit

Permalink
add a service test in docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hyihua committed Dec 2, 2023
1 parent 85822b9 commit 37c3769
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ jobs:
run: docker-compose -f docker-compose.yml up --build --detach

- name: Run Python tests
run: docker-compose -f docker-compose.yml exec myapp python manage.py test

- name: Print Docker Compose Logs
run: docker-compose -f docker-compose.yml logs
run: docker-compose -f docker-compose.yml exec test python manage.py test

- name: Run JavaScript Tests
run: docker-compose -f docker-compose.yml exec myapp npm run test
run: docker-compose -f docker-compose.yml exec test npm run test

- name: Stop and remove containers
run: docker-compose -f path/to/your/docker-compose.yml down
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ services:
- ./manage.py:/code/manage.py
- ./webpack.common.js:/code/webpack.common.js
- ./webpack.dev.js:/code/webpack.dev.js
test:
build: .
env_file:
- ./.env
command:
- python manage.py test
- npm run test
depends_on:
- db
- create_table
- migrate

volumes:
demolab:

0 comments on commit 37c3769

Please sign in to comment.