|
|
@@ -9,6 +9,7 @@ DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \
|
|
|
BRANCH_NAME=$(BRANCH_NAME) \
|
|
|
PROJECT_NAME=$(PROJECT_NAME) \
|
|
|
MOCHA_GREP=${MOCHA_GREP} \
|
|
|
+ SHARELATEX_CONFIG=/app/test/acceptance/config/settings.test.coffee \
|
|
|
docker-compose ${DOCKER_COMPOSE_FLAGS}
|
|
|
|
|
|
MODULE_DIRS := $(shell find modules -mindepth 1 -maxdepth 1 -type d -not -name '.git' )
|
|
|
@@ -57,6 +58,10 @@ $(MODULE_MAKEFILES): Makefile.module
|
|
|
cp Makefile.module $$makefile; \
|
|
|
done
|
|
|
|
|
|
+#
|
|
|
+# Clean
|
|
|
+#
|
|
|
+
|
|
|
clean:
|
|
|
rm -f public/stylesheets/*.css*
|
|
|
|
|
|
@@ -66,20 +71,44 @@ clean_ci:
|
|
|
docker image prune -af --filter "until=48h"
|
|
|
docker network prune -f
|
|
|
|
|
|
-test: test_unit test_frontend test_acceptance
|
|
|
+#
|
|
|
+# Tests
|
|
|
+#
|
|
|
|
|
|
-test_module: test_unit_module_run test_acceptance_module_run
|
|
|
+test: test_unit test_frontend test_acceptance
|
|
|
|
|
|
-test_unit:
|
|
|
- @[ ! -d test/unit ] && echo "web has no unit tests" || COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --name unit_test_$(BUILD_DIR_NAME) --rm test_unit
|
|
|
+test_module: test_unit_module test_acceptance_module
|
|
|
|
|
|
-test_unit_module: test_unit_module_run
|
|
|
+#
|
|
|
+# Unit tests
|
|
|
+#
|
|
|
|
|
|
-test_unit_module_run:
|
|
|
- COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --name unit_test_$(BUILD_DIR_NAME) --rm test_unit bin/unit_test_module $(MODULE_NAME) --grep=$(MOCHA_GREP)
|
|
|
+test_unit: test_unit_app test_unit_modules
|
|
|
|
|
|
test_unit_app:
|
|
|
- npm -q run test:unit:app -- ${MOCHA_ARGS}
|
|
|
+ COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
|
|
|
+ COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --name unit_test_$(BUILD_DIR_NAME) --rm test_unit
|
|
|
+ COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
|
|
|
+
|
|
|
+test_unit_modules:
|
|
|
+ @set -e; \
|
|
|
+ for dir in $(MODULE_DIRS); \
|
|
|
+ do \
|
|
|
+ if [ -e $$dir/test/unit ]; then \
|
|
|
+ $(MAKE) test_unit_module MODULE=$$dir; \
|
|
|
+ fi; \
|
|
|
+ done
|
|
|
+
|
|
|
+test_unit_module: $(MODULE_MAKEFILES)
|
|
|
+ @if [ -e modules/$(MODULE_NAME)/test/unit ]; then \
|
|
|
+ COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) $(DOCKER_COMPOSE) down -v -t 0 \
|
|
|
+ && cd modules/$(MODULE_NAME) && COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) $(MAKE) test_unit \
|
|
|
+ && cd $(CURDIR) && COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) $(DOCKER_COMPOSE) down -v -t 0; \
|
|
|
+ fi
|
|
|
+
|
|
|
+#
|
|
|
+# Frontend unit tests
|
|
|
+#
|
|
|
|
|
|
test_frontend: compile build_test_frontend test_frontend_run
|
|
|
|
|
|
@@ -90,39 +119,45 @@ test_frontend_run:
|
|
|
|
|
|
test_frontend_build_run: build_test_frontend test_frontend_run
|
|
|
|
|
|
-test_acceptance: test_acceptance_app_run test_acceptance_modules_run
|
|
|
-
|
|
|
-test_acceptance_app: test_acceptance_app_run
|
|
|
-
|
|
|
-test_acceptance_module: test_acceptance_module_run
|
|
|
+#
|
|
|
+# Acceptance tests
|
|
|
+#
|
|
|
|
|
|
-test_acceptance_run: test_acceptance_app_run test_acceptance_modules_run
|
|
|
+test_acceptance: test_acceptance_app test_acceptance_modules
|
|
|
|
|
|
-test_acceptance_app_run:
|
|
|
+test_acceptance_app:
|
|
|
COMPOSE_PROJECT_NAME=acceptance_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
|
|
|
- COMPOSE_PROJECT_NAME=acceptance_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --rm test_acceptance npm -q run test:acceptance:run_dir test/acceptance/src
|
|
|
+ COMPOSE_PROJECT_NAME=acceptance_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --rm test_acceptance
|
|
|
COMPOSE_PROJECT_NAME=acceptance_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
|
|
|
|
|
|
-test_acceptance_modules_run:
|
|
|
+test_acceptance_modules:
|
|
|
@set -e; \
|
|
|
for dir in $(MODULE_DIRS); \
|
|
|
do \
|
|
|
if [ -e $$dir/test/acceptance ]; then \
|
|
|
- $(MAKE) test_acceptance_module_run MODULE=$$dir; \
|
|
|
+ $(MAKE) test_acceptance_module MODULE=$$dir; \
|
|
|
fi; \
|
|
|
done
|
|
|
|
|
|
-test_acceptance_module_run: $(MODULE_MAKEFILES)
|
|
|
+test_acceptance_module: $(MODULE_MAKEFILES)
|
|
|
@if [ -e modules/$(MODULE_NAME)/test/acceptance ]; then \
|
|
|
COMPOSE_PROJECT_NAME=acceptance_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) $(DOCKER_COMPOSE) down -v -t 0 \
|
|
|
&& cd modules/$(MODULE_NAME) && COMPOSE_PROJECT_NAME=acceptance_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) $(MAKE) test_acceptance \
|
|
|
&& cd $(CURDIR) && COMPOSE_PROJECT_NAME=acceptance_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) $(DOCKER_COMPOSE) down -v -t 0; \
|
|
|
fi
|
|
|
|
|
|
+#
|
|
|
+# CI tests
|
|
|
+#
|
|
|
+
|
|
|
ci:
|
|
|
MOCHA_ARGS="--reporter tap" \
|
|
|
$(MAKE) test
|
|
|
|
|
|
+#
|
|
|
+# Lint & format
|
|
|
+#
|
|
|
+
|
|
|
format:
|
|
|
npm -q run format
|
|
|
|
|
|
@@ -131,7 +166,11 @@ format_fix:
|
|
|
|
|
|
lint:
|
|
|
npm -q run lint
|
|
|
-
|
|
|
+
|
|
|
+#
|
|
|
+# Build & publish
|
|
|
+#
|
|
|
+
|
|
|
build:
|
|
|
docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
|
|
|
--tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
|
|
|
@@ -148,6 +187,10 @@ tar:
|
|
|
COMPOSE_PROJECT_NAME=tar_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
|
|
|
|
|
|
.PHONY:
|
|
|
- all add install update test test_unit test_frontend test_acceptance \
|
|
|
- test_acceptance_start_service test_acceptance_stop_service \
|
|
|
- test_acceptance_run ci ci_clean compile clean css
|
|
|
+ css_full css minify minify_css minify_es compile compile_full \
|
|
|
+ compile_css_full compile_modules compile_modules_full clean clean_frontend \
|
|
|
+ clean_css clean_tests clean_ci test test_module test_unit test_unit_app \
|
|
|
+ test_unit_modules test_unit_module test_frontend test_frontend_run \
|
|
|
+ test_frontend_build_run test_acceptance test_acceptance_app \
|
|
|
+ test_acceptance_modules test_acceptance_module ci format format_fix lint \
|
|
|
+ build build_test_frontend publish tar
|