Skip to content
Snippets Groups Projects
Makefile 4.09 KiB
Newer Older
  • Learn to ignore specific revisions
  • UID := 1000
    GID := 1000
    
    
    François Agneray's avatar
    François Agneray committed
    
    list:
    	@echo ""
    	@echo "Useful targets:"
    	@echo ""
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
    	@echo "  rebuild          > Rebuild all images and start containers for dev only"
    	@echo "  start            > Start containers"
    	@echo "  restart          > Restart containers"
    	@echo "  stop             > Stop and kill running containers"
    	@echo "  status           > Display stack containers status"
    	@echo "  logs             > Display containers logs"
    	@echo "  install_client   > Install client dependencies"
    	@echo "  shell_client     > Shell into angular client container"
    	@echo "  build_client     > Generate the angular client dist application (html, css, js)"
    
    	@echo "  test_client      > Run the angular client unit tests and generate code coverage report"
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
    	@echo "  test_client-live > Run the angular client unit tests on every file change"
    
    	@echo "  open-coverage    > Open the client code coverage report in a browser (only available for Linux)"
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
    	@echo "  install_server   > Install server dependencies"
    	@echo "  shell_server     > Shell into php server container"
    
    François Agneray's avatar
    François Agneray committed
    	@echo "  test_server      > Starts the server php unit tests"
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
    	@echo "  phpcs            > Run php code sniffer test suite"
    
    François Agneray's avatar
    François Agneray committed
    	@echo "  install_services > install services dependencies (virtualenv)"
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
    	@echo "  shell_services   > Shell into python services"
    
    	@echo "  test_services    > Starts the services unit tests"
    
    	@echo "  install_tasks    > install tasks dependencies (virtualenv)"
    	@echo "  shell_tasks      > Shell into python tasks"
    
    	@echo "  test_tasks       > Starts the tasks unit tests"
    
    Tifenn Guillas's avatar
    Tifenn Guillas committed
    	@echo "  create-db        > Create a database for dev only (need token_enabled=0)"
    	@echo "  remove-pgdata    > Remove the anis-next database"
    
    	@echo "  remove-matodata  > Remove the anis-next matomo volumes"
    
    François Agneray's avatar
    François Agneray committed
    	@echo ""
    
    rebuild:
    	@docker-compose up --build -d
    
    start:
    	@docker-compose up -d
    
    restart: stop start
    
    stop:
    	@docker-compose kill
    	@docker-compose rm -v --force
    
    status:
    	@docker-compose ps
    
    logs:
    	@docker-compose logs -f -t
    
    install_client:
    
    François Agneray's avatar
    François Agneray committed
    	@docker run --init -it --rm --user $(UID):$(GID) \
    
    François Agneray's avatar
    François Agneray committed
    	-v $(CURDIR)/client:/project \
    
    François Agneray's avatar
    François Agneray committed
    	-w /project node:16-slim yarn install
    
    François Agneray's avatar
    François Agneray committed
    
    shell_client:
    	@docker-compose exec client bash
    
    build_client:
    
    François Agneray's avatar
    François Agneray committed
    	@docker-compose exec client ng build
    
    François Agneray's avatar
    François Agneray committed
    
    test_client:
    
    	@docker-compose exec client npx jest --coverage --collectCoverageFrom='src/**/*.ts'
    
    test_client_live:
    	@docker-compose exec client npx jest --watchAll --coverage
    
    open_coverage_report:
    	xdg-open client/coverage/anis-client/index.html
    
    François Agneray's avatar
    François Agneray committed
    
    install_server:
    	@docker run --init -it --rm --user $(UID):$(GID) \
    	-e COMPOSER_CACHE_DIR=/dev/null \
    	-v $(CURDIR)/server:/project \
    
    	-w /project composer install --ignore-platform-reqs
    
    François Agneray's avatar
    François Agneray committed
    
    shell_server:
    	@docker-compose exec server bash
    
    test_server:
    	@docker run --init -it --rm --user $(UID):$(GID) \
    	-v $(CURDIR)/server:/project \
    	-w /project jakzal/phpqa:php8.0 phpdbg -qrr ./vendor/bin/phpunit --bootstrap ./tests/bootstrap.php \
    	--whitelist src --colors --coverage-html ./phpunit-coverage ./tests
    
    phpcs:
    	@docker run --init -it --rm --user $(UID):$(GID) \
    	-v $(CURDIR)/server:/project \
    	-w /project jakzal/phpqa:php8.0 phpcs --standard=PSR12 --extensions=php --colors src tests
    
    
    François Agneray's avatar
    François Agneray committed
    install_services:
    	@docker run --init -it --rm --user $(UID):$(GID) -v $(CURDIR)/services:/project -w /project python:3.8 /bin/bash -c "python3 -m venv venv && source /project/venv/bin/activate && pip install -r requirements.txt"
    
    
    François Agneray's avatar
    François Agneray committed
    shell_services:
    	@docker-compose exec services bash
    
    
    test_services:
    	@docker-compose exec services /bin/bash -c "source ./venv/bin/activate && pytest"
    
    
    install_tasks:
    	@docker run --init -it --rm --user $(UID):$(GID) -v $(CURDIR)/tasks:/project -w /project python:3.8 /bin/bash -c "python3 -m venv venv && source /project/venv/bin/activate && pip install -r requirements.txt"
    
    shell_tasks:
    	@docker-compose exec tasks bash
    
    
    test_tasks:
    	@docker-compose exec tasks /bin/bash -c "source ./venv/bin/activate && pytest"
    
    
    François Agneray's avatar
    François Agneray committed
    create-db:
    
    François Agneray's avatar
    François Agneray committed
    	@docker-compose exec server sh /mnt/init-keycloak.sh
    	@docker-compose exec server sh /mnt/create-db.sh
    
    François Agneray's avatar
    François Agneray committed
    
    remove-pgdata:
    	@docker volume rm anis-next_pgdata
    
    
    remove-matodata:
    	@docker volume rm anis-next_mariadata
    	@docker volume rm anis-next_matomo