rookeries/Makefile

71 lines
1.8 KiB
Makefile
Raw Normal View History

.PHONY = build-api, build-webapp, build, test, test-api, test-webapp, test-functional-api, test-functional-webapp, \
demo, start, status, stop, bootstrap
# Global values for Rookeries components
DB_CONNECTION = "postgresql+psycopg2://admin:password@db:5432/postgres"
# Build the API image
build-api:
docker build --tag rookeries/api:build api
# Build the webapp image
build-webapp:
docker build --tag rookeries/webapp:build webapp
# Build all the images
build: build-api build-webapp
# Runs all the tests
test: test-api test-webapp
# Runs api tests
test-api: stop build-api
docker-compose up -d db
docker-compose run api \
inv test.style
docker-compose run api \
inv test.server --db-connection=$(DB_CONNECTION) --verbosity=3
# Runs webapp tests
test-webapp: stop build-webapp
docker-compose run webapp npm run lint
docker-compose run webapp npm run tests-unit
# Runs functional tests for api
test-functional-api:
docker-compose up -d --build --force-recreate db api
docker-compose run api \
inv test.functional --db-connection=$(DB_CONNECTION) --server-host=api --verbosity=3 --keep-test-db
# Runs functional test for webapp
test-functional-webapp:
scripts/verify_sauceconnect_env_ready.sh
docker-compose up -d --build --force-recreate
docker-compose run \
-e SAUCE_USERNAME=$SAUCE_USERNAME \
-e SAUCE_ACCESS_KEY=$SAUCE_ACCESS_KEY webapp \
npm run tests-functional
# Demos Rookeries in a browser
demo:
docker-compose up -d --remove-orphans
python -m webbrowser -n http://localhost:3000/
# Starts Rookeries
start: build
docker-compose up --remove-orphans
# Starts Rookeries
status:
docker-compose ps
# Shuts down Rookeries
stop:
docker-compose down --remove-orphans --volumes
# Bootstrap DB
bootstrap: build
docker-compose up -d db
docker-compose run api \
inv db.bootstrap --db-connection=$(DB_CONNECTION) --reset-db