-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 2.01 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
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --warn-undefined-variables
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
ALL_TARGETS := $(shell grep -E -o ^[0-9A-Za-z_-]+: $(MAKEFILE_LIST) | sed 's/://')
.PHONY: $(ALL_TARGETS)
.DEFAULT_GOAL := help
all: shellcheck shfmt hadolint flake8 update_requirements_dev build_dev mypy test_dev update_requirements build test ## Lint, update requirements.txt, build, and test
build: ## Build image replace_fonts from Dockerfile
@echo -e "\033[36m$@\033[0m"
@./tools/build.sh ghcr.io/shakiyam/replace_fonts Dockerfile
build_dev: ## Build image replace_fonts_dev from Dockerfile_dev
@echo -e "\033[36m$@\033[0m"
@./tools/build.sh ghcr.io/shakiyam/replace_fonts_dev Dockerfile_dev
flake8: ## Lint Python code
@echo -e "\033[36m$@\033[0m"
@./tools/flake8.sh --ignore=E501
hadolint: ## Lint Dockerfile
@echo -e "\033[36m$@\033[0m"
@./tools/hadolint.sh Dockerfile Dockerfile_dev
help: ## Print this help
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[0-9A-Za-z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
mypy: ## Lint Python code
@echo -e "\033[36m$@\033[0m"
@./tools/mypy.sh ghcr.io/shakiyam/replace_fonts_dev --ignore-missing-imports replace_fonts.py
shellcheck: ## Lint shell scripts
@echo -e "\033[36m$@\033[0m"
@./tools/shellcheck.sh replace_fonts replace_fonts_dev test/*.sh tools/*.sh
shfmt: ## Lint shell scripts
@echo -e "\033[36m$@\033[0m"
@./tools/shfmt.sh -l -d -i 2 -ci -bn -kp replace_fonts replace_fonts_dev test/*.sh tools/*.sh
test: ## Test replace_fonts
@echo -e "\033[36m$@\033[0m"
@./test/run.sh
test_dev: ## Test replace_fonts
@echo -e "\033[36m$@\033[0m"
@./test/run_dev.sh
update_requirements: ## Update requirements.txt
@echo -e "\033[36m$@\033[0m"
@./tools/pip-compile.sh --upgrade --strip-extras
update_requirements_dev: ## Update requirements_dev.txt
@echo -e "\033[36m$@\033[0m"
@./tools/pip-compile.sh requirements_dev.in --output-file requirements_dev.txt --upgrade --strip-extras