2017-11-29 13:49:36 +00:00
|
|
|
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
|
2017-12-01 08:49:10 +00:00
|
|
|
NPM := docker-compose ${DOCKER_COMPOSE_FLAGS} run --rm npm npm -q
|
2017-11-23 16:01:32 +00:00
|
|
|
BUILD_NUMBER ?= local
|
|
|
|
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
PROJECT_NAME = web
|
|
|
|
|
|
|
|
all: install test
|
|
|
|
@echo "Run:"
|
|
|
|
@echo " make install to set up the project dependencies (in docker)"
|
|
|
|
@echo " make test to run all the tests for the project (in docker)"
|
|
|
|
|
2017-11-24 16:28:24 +00:00
|
|
|
add: docker-shared.yml
|
2017-11-23 16:01:32 +00:00
|
|
|
$(NPM) install --save ${P}
|
|
|
|
|
2017-11-24 16:28:24 +00:00
|
|
|
add_dev: docker-shared.yml
|
2017-11-23 16:01:32 +00:00
|
|
|
$(NPM) install --save-dev ${P}
|
|
|
|
|
2017-11-24 16:28:24 +00:00
|
|
|
install: docker-shared.yml
|
2017-12-14 09:32:38 +00:00
|
|
|
bin/generate_volumes_file
|
2017-11-23 16:01:32 +00:00
|
|
|
$(NPM) install
|
|
|
|
|
2017-12-14 09:32:38 +00:00
|
|
|
clean: ci_clean
|
2017-11-24 16:28:24 +00:00
|
|
|
rm -f app.js
|
|
|
|
rm -rf app/js
|
|
|
|
rm -rf test/unit/js
|
|
|
|
rm -rf test/acceptance/js
|
2017-11-27 16:55:11 +00:00
|
|
|
for dir in modules/*; \
|
|
|
|
do \
|
|
|
|
rm -f $$dir/index.js; \
|
|
|
|
rm -rf $$dir/app/js; \
|
|
|
|
rm -rf $$dir/test/unit/js; \
|
|
|
|
rm -rf $$dir/test/acceptance/js; \
|
|
|
|
done
|
2017-12-14 09:32:38 +00:00
|
|
|
|
|
|
|
ci_clean:
|
2017-12-02 13:02:37 +00:00
|
|
|
# Deletes node_modules volume
|
|
|
|
docker-compose down --volumes
|
2017-11-24 16:28:24 +00:00
|
|
|
|
|
|
|
# Need regenerating if you change the web modules you have installed
|
|
|
|
docker-shared.yml:
|
|
|
|
bin/generate_volumes_file
|
2017-11-23 16:01:32 +00:00
|
|
|
|
2017-12-14 09:32:38 +00:00
|
|
|
test: test_unit test_frontend test_acceptance
|
2017-11-23 16:01:32 +00:00
|
|
|
|
2017-11-24 16:28:24 +00:00
|
|
|
test_unit: docker-shared.yml
|
2017-11-30 11:00:28 +00:00
|
|
|
docker-compose ${DOCKER_COMPOSE_FLAGS} run --rm test_unit npm -q run test:unit -- ${MOCHA_ARGS}
|
2017-11-23 16:01:32 +00:00
|
|
|
|
2017-12-14 09:32:38 +00:00
|
|
|
test_frontend: docker-shared.yml
|
|
|
|
docker-compose ${DOCKER_COMPOSE_FLAGS} run --rm test_unit npm -q run test:frontend -- ${MOCHA_ARGS}
|
|
|
|
|
2017-11-24 17:40:24 +00:00
|
|
|
test_acceptance: test_acceptance_app test_acceptance_modules
|
2017-11-23 16:01:32 +00:00
|
|
|
|
2017-11-24 17:40:24 +00:00
|
|
|
test_acceptance_app: test_acceptance_app_start_service test_acceptance_app_run test_acceptance_app_stop_service
|
|
|
|
|
2017-11-29 13:49:36 +00:00
|
|
|
test_acceptance_app_start_service: test_acceptance_app_stop_service docker-shared.yml
|
|
|
|
docker-compose ${DOCKER_COMPOSE_FLAGS} up -d test_acceptance
|
2017-11-23 16:01:32 +00:00
|
|
|
|
2017-11-24 17:40:24 +00:00
|
|
|
test_acceptance_app_stop_service: docker-shared.yml
|
2017-11-29 13:49:36 +00:00
|
|
|
docker-compose ${DOCKER_COMPOSE_FLAGS} stop test_acceptance redis mongo
|
2017-11-23 16:01:32 +00:00
|
|
|
|
2017-11-24 17:40:24 +00:00
|
|
|
test_acceptance_app_run: docker-shared.yml
|
2017-11-30 11:00:28 +00:00
|
|
|
docker-compose ${DOCKER_COMPOSE_FLAGS} exec -T test_acceptance npm -q run test:acceptance -- ${MOCHA_ARGS}
|
2017-11-23 16:01:32 +00:00
|
|
|
|
2017-11-24 17:40:24 +00:00
|
|
|
test_acceptance_modules: docker-shared.yml
|
2017-12-01 10:03:42 +00:00
|
|
|
# Break and error on any module failure
|
|
|
|
set -e; \
|
2017-11-24 17:40:24 +00:00
|
|
|
for dir in modules/*; \
|
|
|
|
do \
|
2017-12-01 09:01:36 +00:00
|
|
|
if [ -e $$dir/Makefile ]; then \
|
2017-11-24 17:40:24 +00:00
|
|
|
(make test_acceptance_module MODULE=$$dir) \
|
|
|
|
fi \
|
|
|
|
done
|
|
|
|
|
|
|
|
test_acceptance_module: docker-shared.yml
|
|
|
|
cd $(MODULE) && make test_acceptance
|
|
|
|
|
2017-12-14 09:43:59 +00:00
|
|
|
ci:
|
|
|
|
MOCHA_ARGS="--reporter tap" \
|
|
|
|
$(MAKE) install test
|
2017-12-14 09:32:38 +00:00
|
|
|
|
2017-11-23 16:01:32 +00:00
|
|
|
.PHONY:
|
2017-12-14 14:57:34 +00:00
|
|
|
all add install update test test_unit test_frontend test_acceptance \
|
2017-11-23 16:01:32 +00:00
|
|
|
test_acceptance_start_service test_acceptance_stop_service \
|
2017-12-14 09:32:38 +00:00
|
|
|
test_acceptance_run ci ci_clean
|