Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # This file was auto-generated, do not edit it directly.
  2. # Instead run bin/update_build_scripts from
  3. # https://github.com/sharelatex/sharelatex-dev-environment
  4. BUILD_NUMBER ?= local
  5. BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
  6. PROJECT_NAME = document-updater
  7. BUILD_DIR_NAME = $(shell pwd | xargs basename | tr -cd '[a-zA-Z0-9_.\-]')
  8. DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
  9. DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \
  10. BRANCH_NAME=$(BRANCH_NAME) \
  11. PROJECT_NAME=$(PROJECT_NAME) \
  12. MOCHA_GREP=${MOCHA_GREP} \
  13. docker-compose ${DOCKER_COMPOSE_FLAGS}
  14. DOCKER_COMPOSE_TEST_ACCEPTANCE = \
  15. COMPOSE_PROJECT_NAME=test_acceptance_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE)
  16. DOCKER_COMPOSE_TEST_UNIT = \
  17. COMPOSE_PROJECT_NAME=test_unit_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE)
  18. clean:
  19. docker rmi ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
  20. docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
  21. format:
  22. $(DOCKER_COMPOSE) run --rm test_unit npm run --silent format
  23. format_fix:
  24. $(DOCKER_COMPOSE) run --rm test_unit npm run --silent format:fix
  25. lint:
  26. $(DOCKER_COMPOSE) run --rm test_unit npm run --silent lint
  27. test: format lint test_unit test_acceptance
  28. test_unit:
  29. ifneq (,$(wildcard test/unit))
  30. $(DOCKER_COMPOSE_TEST_UNIT) run --rm test_unit
  31. $(MAKE) test_unit_clean
  32. endif
  33. test_clean: test_unit_clean
  34. test_unit_clean:
  35. ifneq (,$(wildcard test/unit))
  36. $(DOCKER_COMPOSE_TEST_UNIT) down -v -t 0
  37. endif
  38. test_acceptance: test_acceptance_clean test_acceptance_pre_run test_acceptance_run
  39. $(MAKE) test_acceptance_clean
  40. test_acceptance_debug: test_acceptance_clean test_acceptance_pre_run test_acceptance_run_debug
  41. $(MAKE) test_acceptance_clean
  42. test_acceptance_run:
  43. ifneq (,$(wildcard test/acceptance))
  44. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance
  45. endif
  46. test_acceptance_run_debug:
  47. ifneq (,$(wildcard test/acceptance))
  48. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) run -p 127.0.0.9:19999:19999 --rm test_acceptance npm run test:acceptance -- --inspect=0.0.0.0:19999 --inspect-brk
  49. endif
  50. test_clean: test_acceptance_clean
  51. test_acceptance_clean:
  52. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) down -v -t 0
  53. test_acceptance_pre_run:
  54. ifneq (,$(wildcard test/acceptance/js/scripts/pre-run))
  55. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance test/acceptance/js/scripts/pre-run
  56. endif
  57. build:
  58. docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
  59. --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
  60. .
  61. tar:
  62. $(DOCKER_COMPOSE) up tar
  63. publish:
  64. docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
  65. .PHONY: clean test test_unit test_acceptance test_clean build publish