Makefile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. rm -f app.js
  22. rm -rf app/js
  23. rm -rf test/unit/js
  24. rm -rf test/acceptance/js
  25. test: test_unit test_acceptance
  26. test_unit:
  27. ifneq (,$(wildcard test/unit))
  28. $(DOCKER_COMPOSE_TEST_UNIT) run --rm test_unit
  29. $(MAKE) test_unit_clean
  30. endif
  31. test_clean: test_unit_clean
  32. test_unit_clean:
  33. ifneq (,$(wildcard test/unit))
  34. $(DOCKER_COMPOSE_TEST_UNIT) down -v -t 0
  35. endif
  36. test_acceptance: test_acceptance_clean test_acceptance_pre_run test_acceptance_run
  37. $(MAKE) test_acceptance_clean
  38. test_acceptance_debug: test_acceptance_clean test_acceptance_pre_run test_acceptance_run_debug
  39. $(MAKE) test_acceptance_clean
  40. test_acceptance_run:
  41. ifneq (,$(wildcard test/acceptance))
  42. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance
  43. endif
  44. test_acceptance_run_debug:
  45. ifneq (,$(wildcard test/acceptance))
  46. $(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
  47. endif
  48. test_clean: test_acceptance_clean
  49. test_acceptance_clean:
  50. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) down -v -t 0
  51. test_acceptance_pre_run:
  52. ifneq (,$(wildcard test/acceptance/js/scripts/pre-run))
  53. $(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance test/acceptance/js/scripts/pre-run
  54. endif
  55. build:
  56. docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
  57. --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
  58. .
  59. tar:
  60. $(DOCKER_COMPOSE) up tar
  61. publish:
  62. docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
  63. .PHONY: clean test test_unit test_acceptance test_clean build publish