Makefile: Add make targets for test (#3032)

This commit is contained in:
koooge
2018-11-12 17:06:25 +09:00
committed by Arik Fraimovich
parent 46363ccc70
commit c2bd8518a6
3 changed files with 26 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ version: 2.0
flake8-steps: &steps
- checkout
- run: sudo pip install flake8
- run: ./flake8_tests.sh
- run: ./bin/flake8_tests.sh
jobs:
python-flake8-tests:
docker:

View File

@@ -1,10 +1,17 @@
.PHONY: compose_build test_db create_database clean bundle tests build watch start
.PHONY: compose_build up test_db create_database clean down bundle tests lint backend-unit-tests frontend-unit-tests test build watch start
compose_build:
docker-compose build
up:
docker-compose up -d --build
test_db:
docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"
@for i in `seq 1 5`; do \
if (docker-compose exec postgres sh -c 'psql -U postgres -c "select 1;"' 2>&1 > /dev/null) then break; \
else echo "postgres initializing..."; sleep 5; fi \
done
docker-compose exec postgres sh -c 'psql -U postgres -c "drop database if exists tests;" && psql -U postgres -c "create database tests;"'
create_database:
docker-compose run server create_db
@@ -12,12 +19,28 @@ create_database:
clean:
docker ps -a -q | xargs docker kill;docker ps -a -q | xargs docker rm
down:
docker-compose down
bundle:
docker-compose run server bin/bundle-extensions
tests:
docker-compose run server tests
lint:
./bin/flake8_tests.sh
backend-unit-tests: up test_db
docker-compose run --rm --name tests server tests
frontend-unit-tests: bundle
npm install
npm run bundle
npm test
test: lint backend-unit-tests frontend-unit-tests
build: bundle
npm run build