#=== FORGE CORE — DO NOT EDIT ===============================================
MK_VERSION ?= 1.0.1
MK_REPO    ?= git@gitlab.com:webediagroup/transverse/shared/makefile.git
MK_DIR     ?= $(HOME)/.webedia/mk/$(MK_VERSION)
include $(MK_DIR)/main.mk
$(MK_DIR)/main.mk:
	@git clone --quiet --config advice.detachedHead=false --depth 1 --branch $(MK_VERSION) $(MK_REPO) $(MK_DIR)
#=== END FORGE CORE =========================================================

.PHONY: login-gcp
login-gcp: ## Login to Google Cloud Platform
	@[ "$(whoami)" != "gitlab-runner" ] && (gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://eu.gcr.io) || echo ""

.PHONY: up
up:
	docker compose build --pull php
	docker compose up -d php

.PHONY: down
down:
	docker compose down

.PHONY: sh
sh:
	docker compose exec php bash

.PHONY: prepare
prepare: up
	docker compose exec php mkdir -p $(BUILDDIR)/logs/coverage $(BUILDDIR)/docs
	docker compose exec php composer install

.PHONY: phpunit
phpunit:
	 docker compose exec php bin/phpunit --log-junit $(BUILDDIR)/logs/phpunit.xml

.PHONY: cleanup
cleanup:
	-rm composer.lock
