-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
58 lines (45 loc) · 1.94 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
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: lint update_requirements_dev build_dev mypy update_requirements build test ## Lint, update requirements.txt, build, and test
build: ## Build image 'shakiyam/pptx2txt' from Dockerfile
@echo -e "\033[36m$@\033[0m"
@./tools/build.sh ghcr.io/shakiyam/pptx2txt Dockerfile
build_dev: ## Build image 'shakiyam/pptx2txt_dev' from Dockerfile.dev
@echo -e "\033[36m$@\033[0m"
@./tools/build.sh ghcr.io/shakiyam/pptx2txt_dev Dockerfile.dev
flake8: ## Lint Python code
@echo -e "\033[36m$@\033[0m"
@./tools/flake8.sh
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)
lint: flake8 hadolint shellcheck shfmt ## Lint for all dependencies
mypy: ## Lint Python code
@echo -e "\033[36m$@\033[0m"
@./tools/mypy.sh ghcr.io/shakiyam/pptx2txt_dev --ignore-missing-imports pptx2txt.py
shellcheck: ## Lint shell scripts
@echo -e "\033[36m$@\033[0m"
@./tools/shellcheck.sh pptx2txt pptx2txt_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 pptx2txt pptx2txt_dev test/*.sh tools/*.sh
test: ## Test pptx2txt
@echo -e "\033[36m$@\033[0m"
@./test/run.sh
@./test/clean.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