overleaf/services/web/Makefile.module
Timothée Alby d4fc866984 Merge pull request #2658 from overleaf/jpa-import-makefile-changes
[misc] import Makefile changes

GitOrigin-RevId: 6b19abd48cc40bdbaab6b0005711c9c2cca292f7
2020-03-10 04:14:29 +00:00

40 lines
1.3 KiB
Makefile

BUILD_DIR_NAME ?= web
MODULE_NAME := $(notdir $(shell pwd))
MODULE_DIR := modules/$(MODULE_NAME)
PROJECT_NAME = web
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml --log-level ERROR
DOCKER_COMPOSE := cd ../../ && \
MODULE_DIR=$(MODULE_DIR) \
BUILD_NUMBER=$(BUILD_NUMBER) \
BRANCH_NAME=$(BRANCH_NAME) \
PROJECT_NAME=$(PROJECT_NAME) \
MOCHA_GREP=${MOCHA_GREP} \
SHARELATEX_CONFIG=/app/$(MODULE_DIR)/test/acceptance/config/settings.test.coffee \
docker-compose ${DOCKER_COMPOSE_FLAGS}
DOCKER_COMPOSE_TEST_ACCEPTANCE := \
export COMPOSE_PROJECT_NAME=acceptance_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) \
&& $(DOCKER_COMPOSE)
DOCKER_COMPOSE_TEST_UNIT := \
export COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) \
&& $(DOCKER_COMPOSE)
test_unit:
${DOCKER_COMPOSE_TEST_UNIT} run --rm test_unit npm -q run test:unit:run_dir -- ${MOCHA_ARGS} $(MODULE_DIR)/test/unit/src
ifeq (,$(wildcard test/acceptance))
test_acceptance:
clean_test_acceptance:
else
test_acceptance:
$(MAKE) --no-print-directory clean_test_acceptance
${DOCKER_COMPOSE_TEST_ACCEPTANCE} run --rm test_acceptance npm -q run test:acceptance:run_dir -- ${MOCHA_ARGS} $(MODULE_DIR)/test/acceptance/src
$(MAKE) --no-print-directory clean_test_acceptance
clean_test_acceptance:
${DOCKER_COMPOSE_TEST_ACCEPTANCE} down -v -t 0
endif