-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (34 loc) · 1.24 KB
/
Copy pathMakefile
File metadata and controls
42 lines (34 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
SHELL := /bin/bash
PHP_VERSION ?= 8.2
IMAGE_NAME = otel-auto-class
DOCKER_RUN = docker run --rm -t -v $(CURDIR):/app $(IMAGE_NAME):$(PHP_VERSION)
.PHONY: $(wildcard *)
## help: Show available commands
help:
@echo "Usage:"
@sed -n 's/^## //p' Makefile | awk -F': ' '{printf " %-20s %s\n", $$1, $$2}'
## build: Build Docker image
build:
@if ! docker image inspect $(IMAGE_NAME):$(PHP_VERSION) >/dev/null 2>&1; then \
echo "Building $(IMAGE_NAME):$(PHP_VERSION)..."; \
docker build --build-arg PHP_VERSION=$(PHP_VERSION) -t $(IMAGE_NAME):$(PHP_VERSION) docker/; \
fi
## install: Vendor dependencies
vendor: build
@echo "Vendoring dependencies..."
@$(DOCKER_RUN) composer update --no-interaction --quiet
## lint: Lint code
lint: build
@echo "Linting code..."
@$(DOCKER_RUN) vendor/bin/php-cs-fixer fix --show-progress=none
@$(DOCKER_RUN) vendor/bin/phpstan analyse --no-progress
## test: Test code
test: build
@echo "Testing code..."
@$(DOCKER_RUN) php -dxdebug.mode=coverage vendor/bin/phpunit --no-progress --coverage-text --coverage-html var/coverage
## bench: Bench code
bench: build
@echo "Benching code..."
@$(DOCKER_RUN) vendor/bin/phpbench run --report=default --progress=none
## audit: Vendor, lint, test, bench
audit: vendor lint test bench