-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (73 loc) · 2.15 KB
/
Makefile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
NAME := trello-cli
DOCKER_PREFIX = benmatselby
DOCKER_RELEASE ?= latest
DOCKER_PLATFORM ?= --platform=amd64
explain:
### Welcome
#
### Installation
#
# New repo from scratch?
# -> $$ make clean install
#
### Execution
#
# Locally:
# -> $$ export TRELLO_CLI_KEY=[your key]
# -> $$ export TRELLO_CLI_SECRET=[your secret]
# -> $$ bin/trello.php
#
# Docker:
# -> $$ export TRELLO_CLI_KEY=[your key]
# -> $$ export TRELLO_CLI_SECRET=[your secret]
# -> $$ docker run --rm -eTRELLO_CLI_KEY -eTRELLO_CLI_SECRET benmatselby/trello-cli
#
### Targets
@cat Makefile* | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: clean
clean: ## Clean the local dependencies
rm -fr vendor
.PHONY: install
install: ## Install the local dependencies
mkdir -p build/coverage
mkdir -p build/logs
composer install
.PHONY: composer-outdated
composer-outdated: ## Proxy composer command
composer outdated
###
# Quality
###
.PHONY: lint
lint: ## Lint the PHP files
find src -name "*.php" -print0 | xargs -0 -n1 -P4 php -l
.PHONY: static
static: static-phpcs static-phpstan ## Run all the static analysis
.PHONY: static-phpstan
static-phpstan: ## Static analysis of the codebase
./bin/phpstan analyse src tests --xdebug
.PHONY: static-phpcs
static-phpcs: ## Static analysis phpcs
./bin/phpcs --standard=PSR12 src tests
.PHONY: test
test: ## Run the unit tests
bin/phpunit
.PHONY: test-cov
test-cov: ## Run the unit tests with code coverage
XDEBUG_MODE=coverage bin/phpunit --coverage-html=build/coverage/ --log-junit=build/logs/junit.xml --coverage-text
###
# Docker
###
.PHONY: docker-build
docker-build: ## Build the docker image
docker build -t $(DOCKER_PREFIX)/$(NAME) $(DOCKER_PLATFORM) .
.PHONY: docker-push
docker-push:
docker push $(DOCKER_PREFIX)/$(NAME):$(DOCKER_RELEASE)
.PHONY: docker-scan
docker-scan: ## Scan the docker image
docker scout recommendations $(DOCKER_PREFIX)/$(NAME)
docker scout quickview $(DOCKER_PREFIX)/$(NAME)
.PHONY: docker-run
docker-run: ## Run the docker image
docker run --rm -eTRELLO_CLI_KEY -eTRELLO_CLI_SECRET $(DOCKER_PREFIX)/$(NAME) board:list -s