Makefile 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 = docstore
  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. AWS_BUCKET=${AWS_BUCKET} \
  14. AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
  15. AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
  16. docker-compose ${DOCKER_COMPOSE_FLAGS}
  17. DOCKER_COMPOSE_TEST_ACCEPTANCE = \
  18. COMPOSE_PROJECT_NAME=test_acceptance_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE)
  19. DOCKER_COMPOSE_TEST_UNIT = \
  20. COMPOSE_PROJECT_NAME=test_unit_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE)
  21. clean:
  22. docker rmi ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
  23. docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
  24. format:
  25. $(DOCKER_COMPOSE) run --rm test_unit npm run format
  26. format_fix:
  27. $(DOCKER_COMPOSE) run --rm test_unit npm run format:fix
  28. lint:
  29. $(DOCKER_COMPOSE) run --rm test_unit npm run lint
  30. test: format lint test_unit test_acceptance
  31. test_unit:
  32. ifneq (,$(wildcard test/unit))
  33. $(DOCKER_COMPOSE_TEST_UNIT) run --rm test_unit
  34. $(MAKE) test_unit_clean
  35. endif
  36. test_clean: test_unit_clean
  37. test_unit_clean:
  38. ifneq (,$(wildcard test/unit))
  39. $(DOCKER_COMPOSE_TEST_UNIT) down -v -t 0
  40. endif
  41. test_acceptance: test_acceptance_clean test_acceptance_pre_run test_acceptance_run
  42. $(MAKE) test_acceptance_clean
  43. test_acceptance_debug: test_acceptance_clean test_acceptance_pre_run test_acceptance_run_debug
  44. $(MAKE) test_acceptance_clean
  45. test_acceptance_run:
  46. ifneq (,$(wildcard test/acceptance))
  47. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance
  48. endif
  49. test_acceptance_run_debug:
  50. ifneq (,$(wildcard test/acceptance))
  51. $(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
  52. endif
  53. test_clean: test_acceptance_clean
  54. test_acceptance_clean:
  55. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) down -v -t 0
  56. test_acceptance_pre_run:
  57. ifneq (,$(wildcard test/acceptance/js/scripts/pre-run))
  58. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance test/acceptance/js/scripts/pre-run
  59. endif
  60. build:
  61. docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
  62. --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
  63. .
  64. tar:
  65. $(DOCKER_COMPOSE) up tar
  66. publish:
  67. docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
  68. .PHONY: clean test test_unit test_acceptance test_clean build publish